r/programming • • May 23 '17

Stack Overflow: Helping One Million Developers Exit Vim

https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/
9.2k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

328

u/DownvoteALot May 23 '17

"Alt-Tab" damn noobs not on a headless server.

182

u/elpfen May 23 '17

...you don't have alt-tab mapped to next buffer in tmux?

69

u/-gh0stRush- May 23 '17

screen master race

22

u/schwerpunk May 23 '17 edited Mar 02 '24

I like to travel.

2

u/sihat May 24 '17

The latest version of byobu uses tmux as the backend instead of screen. :)

(I was a screen user, before it crashed on me a couple of times. So I switched to tmux. )

3

u/[deleted] May 24 '17

I recently switched to tmux from screen and rather like it. Maybe give it a shot if you haven't :)

1

u/[deleted] May 24 '17

Huh. I thought for most people it was the opposite direction. Maybe I'm just old.

→ More replies (2)

1

u/Mensa180 May 23 '17

god bless

12

u/[deleted] May 23 '17 edited May 23 '17

I keep meaning to try tmux.

One day. Muscle memory is a heckuva thing.

EDIT: "brew install tmux" locally. Added it to the list of packages my dev centos VMs get from Vagrant.

Me: https://media.giphy.com/media/rUS4Wfh2t2qdO/giphy.gif

7

u/TRiG_Ireland May 23 '17

Muscle memory is my problem with vim and git. Git always drops me into nano on my computer, but into vim on the server. I do remember how to get out of vim again, but I always hit the wrong button first.

10

u/xiongchiamiov May 24 '17

Fix your EDITOR. ;)

1

u/[deleted] May 24 '17

So, install nano?

→ More replies (2)

2

u/dreamin_in_space May 24 '17

Change one of the configured editors lol.

→ More replies (2)

1

u/WinEpic May 24 '17

Ah, the number of times I've accidentally written :wq in a file open in Nano.

NOTE: I know that ZZ or :x are superior ways to exit vim. But:

  • Vim is a text editor. I don't give a shit what the best way to exit it is, as long as it saves and quits.

  • Muscle memory is a bitch.

2

u/noratat May 24 '17

If you're on a Mac locally, use iTerm2 and lookup it's tmux integration feature.

No need to memorize any new bindings, iTerm2 will simply replicate the tmux panes and windows in the local UI.

This works for both local and remote tmux sessions.

1

u/[deleted] May 24 '17

I've always just used terminal.app - does iTerm2 do stuff that the stock OS X terminal doesn't?

I'll admit that integration with tmux sounds pretty sweet.

1

u/flukus May 23 '17

It's used to switch windows in the DE. I need more accelerator keys.

1

u/Shitty_Orangutan May 24 '17

I actually use alt+vim movement keys.

17

u/Cr3X1eUZ May 23 '17

Ctrl-Z to suspend it and kill from the shell?

6

u/aim2free May 23 '17

Doesn't work for me, I tried both

kill %1 and kill 1 "bash: kill: (1) - Operation not permitted", but it's still there. Aha, if I did

kill -9 %1    

then it worked.

3

u/towo May 24 '17

vim is suspended and can't react to the SIGTERM you sent with kill %1. You'd need to send a kill -CONT %1 after the SIGTERM so that it can be processed.

SIGKILL isn't parsed by the program itself, so it works regardless.

12

u/skztr May 23 '17

Yeah, clearly it should be ctrl+a n, ctrl+a c, killall vim, ctrl+a p, ctrl+a n, killall -9 vim, ctrl+a p, ctrl+a n, ps e | grep vim, ctrl+a p, ctrl+a :kill, ctrl+a n, man screen, man vim, man ps, restart, sudo restart, man sudo, visudo- AH FUCK

1

u/Bobshayd May 23 '17

Ctrl-B %, come on.

1

u/steamruler May 24 '17

I have multiple SSH sessions running