0

In tmux, I can press some key combination and split the current window into two windows in the same directory.

I've tried the split-window-* function, but found it just duplicates the same buffer in emacs, so you end up with two windows that are each mutually synced to be identical. Not exactly what I had in mind...

You can get around this using (eshell 'N), but that only seems to work for eshell. I think I found some more complicated approach involving renaming buffers for shell, but I still couldn't get it to automatically cd into the directory I was in at the time I split the window.

I found some approach suggested on the emacs wiki where you configure the prompt to show you your full directory and parse it.

https://www.emacswiki.org/emacs/ShellDirtrackByPrompt

It seemed strange that no one's come up with a better way to track what directory you're currently in than to send to the prompt and parse the result, so I figured I'd ask this one more time just in case something's changed or someone has a way to do this without the prompt parsing hack. Also, a lot of those prompt parsing hack solutions were suggested quite a while ago, and maybe something's new in Emacs 26 that solves this problem.

Ideally, I'd like to be able to track remote directories too, but I'd be relatively happy if I could just get this to work for local directories.

I'm still pretty new at emacs, but getting this part in place would make it a lot easier to switch over and make it my default development environment.

2 Answers 2

1

I use shell pop to do what I think you are asking for. When I press Ctrl-t, it splits the window, creating a new buffer with a shell in that buffer set to the directory that matches the directory of the buffer I started in. When I press Ctrl-t again, it closes the window and shell it had opened.

0

C-u M-x shell <ret> opens a shell in a new buffer in same location. It allows you to name the buffer or press <ret> for default: "shell 2". I thought that there should be a hydra that adds functionality to shell, such as you are after. But I can't find one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.