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

Show parent comments

118

u/rageingnonsense Apr 01 '19

I can sum up my vim usage in 4 commands:

  • :q

  • :w

  • a

  • /

That's it. That's as much as I am willing to learn. If I need anything more powerful than that, it's straight to the ide

75

u/[deleted] Apr 01 '19

[removed] β€” view removed comment

48

u/carterja Apr 01 '19

i is important.. o is pretty damn handy as well.

16

u/ring2ding Apr 01 '19

What's o?

52

u/e_man604 Apr 01 '19

Insert a blank line underneath the current line and toggle insert mode. Capital O is above the current line.

21

u/Bobshayd Apr 01 '19

J is the inverse - puts the next line on the end of the current line.

→ More replies (3)
→ More replies (1)
→ More replies (2)

14

u/lordheart Apr 01 '19

Also dd Deleted current line

→ More replies (1)
→ More replies (1)

9

u/phire Apr 01 '19

Don't you mean a, left-arrow?

8

u/TommaClock Apr 01 '19

Also no d ?

33

u/caltheon Apr 01 '19

i use dd more than d

29

u/thirdegree Apr 01 '19

For me it's either dd or dsome obscenely intricate movement that really should probably be a macro and will definitely go wrong

25

u/cleeder Apr 01 '19

dspend 3x as long figuring out the correct movement than just rewriting the entire line from scratch

→ More replies (1)

17

u/ajayrockrock Apr 01 '19

My new favorite is dt"

It's like 'delete till you hit the quote'. And that can be any character. dt-, dtX, dt/, etc

15

u/thirdegree Apr 01 '19

Getting the hang of t, T, f, and F was a huge speed boost for sure. Another huge one is using vim-surround. Can do something like ds" to delete surrounding quotes. Or ysiw" to surround a word with quotes.

6

u/irrelevantPseudonym Apr 01 '19

If you've not found it yet, I'd definitely recommend the quick scope plugin. It highlights the first occurrence of each letter so that you can quickly jump forward to the closest place to where you want to be.

→ More replies (1)
→ More replies (1)
→ More replies (6)

6

u/wirelyre Apr 01 '19

Someday someone will hook up eye tracking and I'll be able to bind gs to "wherever I'm looking (exclusive)" and finally enter the Matrix.

→ More replies (2)
→ More replies (3)
→ More replies (1)
→ More replies (8)

0

u/[deleted] Apr 01 '19

[deleted]

36

u/NovaX81 Apr 01 '19

:q!, for when you want to make absolutely sure you didn't fuck with it.

→ More replies (1)

19

u/W0rldcrafter Apr 01 '19

:x or ZZ are also shorthand for :wq

15

u/ChocolateBunny Apr 01 '19

TIL about :x. I've used VIM for 15 years and have never done :x.

5

u/King_Joffreys_Tits Apr 02 '19

I know :x is a thing but I don’t trust it. :wq all day

→ More replies (1)
→ More replies (2)
→ More replies (2)

5

u/[deleted] Apr 01 '19

I’d at least recommend learning macros. Also:

  • w

  • b

  • G

  • gg

  • <num>G

βŠ• the different modes. Visual mode for example.

→ More replies (2)

16

u/[deleted] Apr 01 '19 edited Apr 01 '19

Wow. That's more than the two (three, if you count 'i') I know:

  • :x

  • :qa!

Though, the most important one is this:

git config --global core.editor nano

Because, FFS, I'm editing a commit message, I shouldn't need a Ph.D. in editors to do that.

→ More replies (4)
→ More replies (77)