I like to switch from my terminal to magit or dired in my emacs
I have a made a zsh function that works to launch a function in emacs and focus it:
function _emacs_action() {
emacsclient -u --eval "($1)"
(( $+commands[osascript] )) && osascript -e "tell application \"Emacs\" to activate"
(( $+commands[swaymsg] )) && swaymsg '[app_id="emacs"] focus'
}
and use it like this:
alias magit="_emacs_action magit"
alias dired="_emacs_action dired-jump"
I like to switch from my terminal to magit or dired in my emacs
I have a made a zsh function that works to launch a function in emacs and focus it:
@chmouel this is very cool, but it might be easier to simply use Eshell within Emacs itself instead of Zsh. In Eshell you can execute ordinary Emacs commands in the command line as long as they don’t conflict with programs in your PATH
. There are exceptions, such as man
or grep
which are aliased to Emacs commands in Eshell.
;; ---- in Eshell ---
$ ;; open "~/.local" directory in Dired
$ dired ~/.local
$
$ ;; run "git status" but open in an Emacs Magit window
$ magit-status
$
$ ;; opens a file in the current window
$ find-file ~/.emacs.d/init.el
$
$ ;; opens the manual page for Emacs in the Emacs manual browser
$ man emacs
$
$ ;; run `grep` but captures output in
$ ;; a `*grep*` buffer with hyperlinks to matches.
$ grep -i '\<eshell\>' -nHR /usr/share/emacs
$
$ ;; run an ordinary shell command
$ ./configure && make && sudo make install
@ramin_hal9001 yeah you are right and I believe vterm (https://fosstodon.org/@chmouel/113786163667742045) has such integration as well, but I never got into fully using the terminal in emacs train (only sometimes for some specific scenarios) and am happy to switch back and forth with kitty....
@ramin_hal9001 @chmouel my text rendering with eshell has been quite wired
my text rendering with eshell has been quite wired
@xameer what kind of commands are you using when Eshell text rendering is weird?
@ramin_hal9001 net time I ll note and share
but my default shell is zsh and I use regular commands like term , backspace doesn't halt
@chmouel wonderful. I placed into a zprezto module that I am now using