reddit / emacs
Running tmux inside emacs
BigCandySurprise · 2022-07-26 19:13
One hell of feature would be having TMUX to work properly with the emacs terminal emulator, It really adds everything useful from my old command line workflow into the doom emacs experience, anyone knows a package to make TMUX stop buggin inside emacs terminal emulator?
trilledcheese · 2022-07-26 20:09
You can just use emacs buffers and vterm to get most of the same functionality. What is it about tmux you want that emacs doesn’t already have?
jxfreeman · 2022-07-26 20:47
tmux + emacs = inception
Horrih · 2022-07-26 20:59
Not what you are asking, but using the terminal version of emacs inside of tmux is also an alternative if you don't use the graphical features.
It has the following pros :
- flawless performance when working on a remote server
- you don't lose your terminals if emacs (or more likely one of your plugins) freezes/crashes
- no need to change your habits
- with tmux attach, get instantly Everything setup like you left the last time you disconnected from ssh
- really nice for peer programming
In my experience, this is what i miss in terminal mode :
- experience is sub-par for org or latex : no inline images or variable fonts
- no fancy GUI if you use dap-mode or the built in gud debugger. You need to do Everything with the keyboard (not a bad habit)
- more spartan/less pretty overall
straynrg · 2022-07-26 21:00
for me its having multiple panes / workspaces for the same project/git repo. thats easy in tmux, in emacs i restrict myself to one pane because I don't know better
electricity-wizard · 2022-07-26 22:24
I want to do this but I have trouble getting some keybindings to work. C-> for example.
What terminal are you using?
I’ve seen a bunch of [suggestions](https://stackoverflow.com/questions/11110801/why-does-ctrl-not-work-when-i-bind-it-to-a-command-in-emacs) but non of them worked. I’m curious about your terminal setup
glrsn · 2022-07-27 00:07
I don't use Doom, I do use tmux in vterm in emacs daily.
FluidDr1nker · 2022-07-27 00:25
C-> is undefined for me, what package uses it?
Anyway, you just can rebind it.
One suggestion, unbind M-c (capitalize-word) and use it for your bindings. I like meta key bindings because I can press them with my thumbs.
You will find you don't have to rebind much for terminal use(I have like 3-5) and the ones you end rebinding will end more ergonomic.
trilledcheese · 2022-07-27 01:00
https://smythp.com/emacs_buffers/
EDIT: with a better link https://www.oreilly.com/library/view/learning-gnu-emacs/0596006489/ch04.html
Moments like these are always a great opportunity to dive deeper into our tooling. I would encourage you to struggle a bit with emacs buffers before reaching for tmux.
Hooxen · 2022-07-27 02:27
exactly this. learn to use vterm and buffers and tmux becomes obsolete.
electricity-wizard · 2022-07-27 02:29
I have C-> bound to mark-more-like-this for multiple cursors. Unfortunately it’s stuck in my brain.
I was wondering if you found a terminal set up for weird escape sequences.
Thank you for your suggestions though!
FluidDr1nker · 2022-07-27 03:19
If you are on a mac/iterm it may be worth to look at https://iterm2.com/documentation-csiu.html
and the last question the FAQ https://iterm2.com/faq.html
Never bothered with it so don't know how well it works
Horrih · 2022-07-27 06:39
That's true, some bindings don't exist in terminal.
E.g, for a command *foo* i wanted to use C-i which is the same as tab in terminal, but not in gui version.
Here is the workaround i ended up using:
- i add another exotic binding for *foo* in my .emacs (e.g C-f12)
- i rebind C-i to C-f12 in my terminal app (konsole or xterm lets you do this under linux, powertoys in windows)
straynrg · 2022-07-27 06:58
Thanks!
skele_turtle · 2022-07-27 16:44
I do this! Lets me use emacs and neovim interchangeably.
BigCandySurprise · 2022-07-27 17:13
Not inside emacs? I used emacs with tmux for a while, it worked fine, but I woud prefer to have an alternative to this setup.
Drack37 · 2022-07-27 21:56
Use [VTerm](https://github.com/akermu/emacs-libvterm) in Emacs and you'll be able to run `tmux` flawlessly (you could even run `vim` inside Emacs!). All my terminal management is done with `multi-vterm` and Emacs's `shell`. I mostly run `tmux` inside Emacs for session persistence. Two use cases:
1. Remote shell. Running `tmux` inside `vterm` inside `emacs` allows you to benefit from the Emacs-way, while keeping the remote session running and ready to be fired again.
2. Crash or accidental closing. Crashes are extremely rare on my side, but when running long commands, keeping them inside a `tmux` session is really helpful.
jsled · 2022-07-27 22:02
tmux works /wonderfully/ inside vterm
glrsn · 2022-07-27 22:17
Yes in emacs. Run emacs, then M-x vterm<ret>, tmux. You could also ditch tmux and run multiple instances of vterm (see multi-vterm). I use tmux in this way when using legacy cli dev tools in parallel. Prefer this over multi-term as it keeps the old cli tools confined to one emacs window.
BigCandySurprise · 2022-07-27 22:38
Nice, I will try that, thanks!