I know a numeric prefix will create (or switch to) a new eshell session with that number. Is there a way to assign a string instead of a number?
For example, normally I get the following:
*eshell*<1>
*eshell*<2>
*eshell*<3>
*eshell*<4>
I would like
*eshell*<project1/source>
*eshell*<project1/doc>
*eshell*<project2/source>
*eshell*<project2/doc>
I figure I can use counsel to quickly switch between a large number of eshells.
My ultimate goal is to have a command say eshell-dir
. It will parse out the last 2 or 3 directories from default-directory
and create the eshell string. Then I can either switch to that eshell session if it exists or I can open a new eshell session with the name eshell.
Even better yet if the name could use uniquify
that would be amazing!
I figure if I get this to work, I can do 90% of my shell work in emacs which would be a huge plus for me.
C-mouse-1
in the mode line identification (i.e., the buffer name). I create a new eshell-buffer and rename so it afterwards.(defun mode-line-rename-buffer (e) "Just like 'rename-buffer' only do it with the buffer of the window of the clicked mode-line" (interactive "e") (let ((buf (window-buffer (posn-window (event-start e))))) (when buf (with-current-buffer buf (call-interactively 'rename-buffer))))) (define-key mode-line-buffer-identification-keymap (kbd "<mode-line> <C-mouse-1>") 'mode-line-rename-buffer)
eshell
function, but you could easily write your own version that handles things differently.