tmux and vim

Started by Hunterman1043, February 02, 2017, 04:03:54 PM

Previous topic - Next topic

Hunterman1043

I just learned about how to use tmux and vim and man my life is so much better now. Even for basic tasks I can't switch back to regular nano and tty.

deanwebb

#1
Quote from: Hunterman1043 on February 02, 2017, 04:03:54 PM
I just learned about how to use tmux and vim and man my life is so much better now. Even for basic tasks I can't switch back to regular nano and tty.

There was once a time in my life when I would have recoiled in horror at such a sentence. But now, I am drawn to it... I am embracing the *nix that is all around me...
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.

Hunterman1043

#2
Vim is such a powerful program. Like it can honestly replace or at least supplement Visual Studio if you can set it up right with tmux. The key that I'm figuring out is to save my tmux sessions in scripts so that I can call up each environment on command... Like I want a pure monitoring window, load that script. If I want a pure programming window, load that script. Etc.

It's just rn I'm only working in headless mode over ssh because I have no room for a dedicated station with a monitor/keyboard for the server. lol. It's literally just stacked up next to my desktop. Though I'm looking for a good open source management software to use via the browser but that's an easy button solution. lol

Otanx

Vim is pretty good. I usually just "use" vi because it is always installed. If vim is installed most system link vi to vim so I get to use it when it is there. I need to start poking at tmux and/or screen. One of our other guys uses screen heavily, and I see the benefits. Just have not had time to dig into it.

-Otanx

Hunterman1043

#4
I'll have to check out screen. I would use i3 but I don't think that works over ssh without x11 forwarding and a big headache. Lol

srg

Quote from: Hunterman1043 on February 04, 2017, 05:05:25 PM
I'll have to check out screen. I would use i3 but I don't think that works over ssh without x11 forwarding and a big headache. Lol
I would start with tmux instead. I've been using screen since forever, changed to tmux a couple of years ago and never looked back.
som om sinnet hade svartnat för evigt.

wintermute000

I've only looked @ tmux briefly (installed it, set it up with a template).


What's the main advantages to screen?

srg

Quote from: wintermute000 on February 05, 2017, 05:37:11 PM
I've only looked @ tmux briefly (installed it, set it up with a template).


What's the main advantages to screen?
Years ago when I migrated to tmux it had not been developed for quite a while, did not have vertical splitting and generally lacked in flexibility. No idea if this is still true.

There's great scripting opportunities with the tmux shell where you're able to use send-keys to send instructions to specific panes from outside of tmux.
som om sinnet hade svartnat för evigt.

Hunterman1043

#8
Quote from: wintermute000 on February 05, 2017, 05:37:11 PM
I've only looked @ tmux briefly (installed it, set it up with a template).


What's the main advantages to screen?

For me, it's scripting and automation that really attracted me to tmux. I'm providing a more detailed answer given by another user for a similar question on the superuser answerhub.

Quoted from source: (http://superuser.com/questions/236158/tmux-vs-screen)

QuoteSome of the (major) reasons I prefer tmux over screen:

Status bar is much easier to use. You can easily set up different text/styles for current window, windows with activity, etc. and you can put things on the left and right of the status bar, including shell commands that can be run at a specified interval (default 15s).

Almost any command you can run inside tmux can be run from a shell with tmux command [args]. This makes it very easily scriptable, as well as making it easy to do complex commands.

Much more accurate automatic window renaming. While screen sets the title based on the first word of the command, and requires shell configuration to do even that in a shell window, tmux keeps track of what processes are actually running in each window, and updates the title accordingly. This way you get dynamic renaming with any shell and zero configuration. For example: Let's say you're running Z Shell; the window's name would be "zsh". Now let's say you want to edit some configuration file, so you type sudo emacs /etc/somefile. While sudo is asking for your password, the window's name will be "sudo", but once you've done that and sudo launches emacs, the title will be "emacs". When you're all done and you exit emacs, the title will change back to "zsh". This is pretty useful for keeping track of windows, and it can also be especially useful in specific situations, like if you have some long-running process in another window that occasionally prompts you for input using dialog; the window name would change to "dialog" when that happened, so you would know you had to switch to that window and do something.

Nicer session handling (IMHO). You can do a lot more with sessions within tmux itself. You can easily switch, rename, etc. and you can move and share windows between sessions. It also has a different model, where each user has a server which controls his/her sessions and which the client connects to. The downside of this is that if the server crashes, you lose everything; I've never had the server crash on me, though.

tmux seems to be more actively developed. There are updates pretty frequently, and you can file a bug report or feature request through SourceForge and get an answer within a few days.