r/programming • • Apr 01 '19

Stack Overflow ~ Helping One Million Developers Exit Vim 😂

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

441 comments sorted by

View all comments

53

u/wildjokers Apr 01 '19

If a developer uses a *nix system (linux, mac os, etc) how do they survive without using VI? I use it dozens of times every day.

I wish every application had VI key bindings. Any serious IDE absolutely has to have a VI plugin, or it is worthless to me.

98

u/ghostfacedcoder Apr 01 '19

how do they survive without using VI?

emacs and nano

45

u/chicametipo Apr 01 '19

mmm nano <3

7

u/Eilai Apr 01 '19

Nano illuminati ftw!

12

u/chicametipo Apr 01 '19

Ctrl + X + Y/N + Enter all day.

→ More replies (5)

16

u/ACoderGirl Apr 01 '19

If a developer uses a *nix system (linux, mac os, etc) how do they survive without using VI?

I mean, it's not the only command line editor. And while I wouldn't set one as my EDITOR, GUI editors like VS Code are really easy to use. I vaguely recall some machines I've seen where Nano is the default EDITOR.

As for the hotkeys... I've never tried to use one of those plugins in an IDE, but I'm not sure I agree that those key bindings are inherently better for any reason. There's definitely value in consistency across applications, though. But many of vim's hotkeys are straight up inferior in my mind. Like take tab navigation. The default is g-t/g-T. That takes longer than the ctrl-tab/ctrl-shift-tab most GUI editors use and less intuitive in my mind (and certainly ctrl-tab is pretty much universal now).

Or consider opening a file. You'd probably use :tabe or :e to open the file from inside vim (to make things confusing, there's several other slightly different such commands). "E" for edit is pretty intuitive... but too bad every other program has cemented on the terminology of "opening" a file and the obvious ctrl-o hotkey. God forbid you get confused and try to use :open in vim, cause that's some archaic old command that I don't even fully understand what it does or why it still exists.

I use vim for quick, command line editing only. It's ideal to not be rapidly switching between windows when unnecessary. Tmux is the only thing I ever set to use vim hotkeys and that's because tmux's defaults are even dumber (I have several modifications because fuck trying to remember some of those defaults).

3

u/[deleted] Apr 02 '19

gt is two index finger movements from the homerow and three to go to any tab! #gt How does that take long? That's actually a lot faster.

4

u/watsreddit Apr 02 '19

Tabs in vim are not the same as tabs in other programs, so that's not really a comparison. Vim's tabs are a collection of windows (or panes if you prefer). Buffers are vim's analog to tabs, and they are incredible. Cycling through tabs is incredibly slow compared to the vim way, which is immediately jumping to a particular buffer based on a partial substring match of a buffer's name. So to jump to a buffer with the name foo.c, you can just type :b foo and you'll jump to it. It supports globbing patterns, so you can do :b foo*.c<Tab> and tab through buffers with the name foo.c, fooBar.c, fooBarBaz.c, etc.

Likewise, :edit is not really comparable to <C-o> in other editors as it is much more powerful. You can use shell globbing to recursively match a pattern in all subdirectories, so you could for example do :e **/*foo<Tab> and tab through all files containing "foo" in the current directory and every subdirectory. You can even use wildignore to exclude certain results, much like a gitignore.

All of this is just the tip of the iceberg for these two commands, and indeed, vim as a whole. Vim's defaults are very effective and sensible if you take the time to learn them.

6

u/[deleted] Apr 01 '19

I learned to code on Solaris 7 in ksh with vi through a putty terminal. I remember the day I discovered :syntax on after we'd upgraded to Solaris 8, and it changed my life.

1

u/[deleted] Apr 02 '19

It changed my life too. Now i have to google each time i have a new system how to turn syntax highlighting off because i can't read dark blue on black comments and in general can't stand that eye-gouging color salad explosion.

→ More replies (1)

38

u/[deleted] Apr 01 '19

Nano, or even better Micro. It has modern keyboard shortcuts. How do you think you exit Micro?

Blows my mind that people still think vim is a sensible default editor in any situation. Fine, if you love it use it, but it's total madness to have it as the default. It kind of shows how little regard most Linux devs have for usability, and tangentially why there will never be a year of Linux on the desktop.

7

u/drunkdragon Apr 02 '19

I think you hit the nail on the head.

Hitting roadblocks like this are only going to feed the idea that Linux is hard to use for newbies.

Sometimes when you've been trying for hours to get something working, you just don't want more roadblocks.

The Linux community should be mindful of this.

→ More replies (17)

3

u/verrius Apr 01 '19

ed? ...I've unfortunately been on AIX systems that only had vi support (no vim) and one thing you learn is that vi had hard max file size limits back in the day.

2

u/ironnomi Apr 01 '19

Max file size limits would suck ... as I fix this 845GB banking import file. :D

2

u/instanced_banana Apr 01 '19

As a heretic, either Nano, VSCode or Pluma.

3

u/Sayfog Apr 01 '19

Yep nano for quick and dirty CLI edits, VS Code gets opened for literally anything else. Keyboard shortcuts aren't why I liked using IDEs, the higher order language features such as mouse over comments and autocomplete are.

2

u/wildjokers Apr 02 '19

VSCode actually has a really nice VI plugin. I use VSCode for Arduino and OpenSCAD and really like the fact it has a vi plugin.

2

u/[deleted] Apr 02 '19

gedit for one-off and elevated file editing, vs code or atom for projects

2

u/[deleted] Apr 01 '19

I like vim as a cli editor but what is the reasoning/point for having a VI/VIM plugin in UI IDE?

12

u/xtownaga Apr 01 '19

The keyboard shortcuts for manipulating text are faster than the ide equivalents once you're used to them, and there's nothing you need to go into a menu / use the mouse for. Things like moving the text cursor down a few lines and to the beginning of a line, or doing a regex find/replace are quick and easy to do with a vim plugin without needing to move my hands off the keyboard (or over to the arrow keys).

If I want to, say, add a comma to the end of lines 27-38 in some file, it's a lot faster to <esc> :27,38s/$/,/ <Enter> than to (in IntelliJ) command-R, $ <tab> , alt-x, Click In Selection checkbox, highlight the lines (either with the mouse or with some text shortcut), alt-a. It's a somewhat contrived example, but stuff like that

Personally I wouldn't go anywhere near so far as to say an IDE is worthless for me without it, but it makes me somewhat more productive.

6

u/KinterVonHurin Apr 01 '19

Because once you get used to it productivity skyrockets

2

u/wildjokers Apr 01 '19

Navigate around the file with h,j,k,l. Yank (yy), put ( p), delete (dd), mark then copy/paste with v, yy, then p. Basically do everything I need to do to edit a file, but inside an IDE without having to touch the mouse or learn an IDE's custom keymap for basic editing.

1

u/Amuro_Ray Apr 02 '19

Necromancy