this post was submitted on 09 Nov 2023
1 points (100.0% liked)

Emacs

313 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Hi there,

I recently saw that emacs can replace tmux, but I haven't found complete information about it.

top 19 comments
sorted by: hot top controversial new old
[–] iensu@alien.top 1 points 1 year ago

I’ve tried to adopt tmux in my workflow but it’s just so much more convenient to do it from Emacs, especially with vterm. I think you can create multiple vterm instances with C-u M-x vterm but that might be something I added myself, can’t remember.

Is there anything I’m missing out on by not using tmux?

[–] shirleygreenalt@alien.top 1 points 1 year ago
[–] reddit_ran@alien.top 1 points 1 year ago

I do exactly the opposite for you, because the connection is so unstable and I have no control over it. TM-UX serves as a more robust way for the access.

but I do want to say that it's the drawback is there's not too much in a package I can you can use all it can be used but it's just so annoying to reinstall all those necessarily those requirements so hassle but the good point is I always adopt a banana conversion so it's as long as it's just basic it's okay and as soon as there's some complicated manipulations over the code definitely just had a local editing done and send it by you know you know you know synchronize server

[–] easyEggplant@alien.top 1 points 1 year ago (1 children)

I just built emacs from source, I love emacs, but no, it does not replace tmux; I use tmux to have multiple long lived sessions on a remote machine, so I SSH into something, start up tmux and then kick off a CLI process that will take a long time to finish.

I'm not even remotely interested in installing emacs on several EC2 instances.

[–] heartb1t@alien.top 1 points 1 year ago (1 children)

I love emacs, but no, it does not replace tmux; I use tmux to have multiple long lived sessions on a remote machine, so I SSH into something, start up tmux and then kick off a CLI process that will take a long time to finish.

i believe that's doable in Emacs with detached.el, there's a section on their docs regarding working with remote connections. you can also find some videos on YouTube from the author.

[–] easyEggplant@alien.top 1 points 1 year ago

Perhaps that would work? It looks like a gigantic pain in the ass, that after several hours of futzing with it one would find that a bastion server in the way fucks it all up, or it somehow gets lost. I have doubts about it's stability.

If that's working for you, good on you, but I still contend that does not replace tmux. Especially if you have peers.

Thank you for showing it to me though!

[–] nimzobogo@alien.top 1 points 1 year ago

I use emacs as a daemon and attach to it via emacsclient. That makes it persist across disconnects.

I also spawn all my shells inside emacs, which gives it tmux functionality.

[–] ejingles@alien.top 1 points 1 year ago

I love this post, exactly what I’m looking for. I mostly work on remote servers and need to debug python and needless to say, it’s a real pain, I did a workaround of using pdb for this case. Nevertheless, using tmux inside emacs feels rly clunky.

[–] BackToPlebbit69@alien.top 1 points 1 year ago (1 children)

Use multi-vterm: https://github.com/suonlight/multi-vterm

Anything else is a waste of time since vterm is the only decent terminal for Emacs.

[–] terminal_prognosis@alien.top 1 points 1 year ago (1 children)

What's wrong with eat? Not a rhetorical question; I don't know, but I keep thinking of migrating to it.

[–] Psionikus@alien.top 1 points 1 year ago (1 children)

They're out of date, but it was a decent opinion before eat.

[–] BackToPlebbit69@alien.top 1 points 1 year ago

eat

Doesn't look like its on GitHub or MELPA:

- https://codeberg.org/akib/emacs-eat

My opinion still stands.

[–] MarrusAstarte@alien.top 1 points 1 year ago

Basically, you start an emacs server instance, then open emacs client frames/buffers for your shells.

You can split the frame like tmux, and you can "detach" your client windows, while leaving the emacs server running with your shells and anything that you are running in the shells still active.

If you're already spending a lot of time in emacs, this works quite nicely. If not, I opine that it's better to just use tmux or screen.

[–] Firerrr@alien.top 1 points 1 year ago

Try zellij, could save you a lot of time and trouble

[–] heartb1t@alien.top 1 points 1 year ago

i guess it depends on what you use tmux for. in another reply in this post i've mentioned detached.el, which allows you to have sessions of commands that live even if your Emacs dies, and it can be seamlessly integrated to your shell, meaning you can use your shell as usual in Emacs but instruct it to run certain commands through detached.el. there are more lightweight alternatives to this, such as sending commands to a compilation buffer (i could link you to those as well, just ping me).

the windows/panes setup can be replicated using tabs and the default window management system for Emacs (which you can tweak to your pleasing). you can even store window configurations (i do something similar to that with tmux).

so what is it that you need from tmux that you would like to see in Emacs?

[–] SS4L1234@alien.top 1 points 1 year ago

Join the cult of those of us who use emacs within tmux.

[–] TistelTech@alien.top 1 points 1 year ago

ssh remote_machine

# create a new screen session

screen -S multibuffer

emacs # console mode aka -nw

# do all the screen splits needed

# m-x shell to start any number of shells

# CTRL-D to disconnect

# leave machine

exit

# decide to go back

ssh remote_machine

# reconnect to existing shell

screen -r multibuffer

# tada! your shells are back

[–] 80286@alien.top 1 points 1 year ago

I've used tmux inside a single vterm buffer for several years now, and together with vterm-toggle to toggle buffer visibility with a single keypress, it's been a nearly perfect setup (apart from vterm-toggle messing up winner-mode's undo history). I remapped the default tmux operator key to ';' so it kinda logically fits with devil-mode, which I've been using for a few months.

I've also augmented vterm with custom functions, such as I can quickly cd to another dir using ivy completion in the minibuffer, which is much faster than using shell's integrated completion system.

[–] akirakom@alien.top 1 points 1 year ago

I forgot about tmux, because I don't need it when I use Emacs and Emacs lets me think in a different way. Just learn the Emacs way, and you don't need tmux.