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

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.

2

u/dscottboggs Apr 02 '19

That one fucks me up a lot if I have caps lock on.

Which brings us to the ever essential u -- undo!

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

14

u/lordheart Apr 01 '19

Also dd Deleted current line

4

u/carterja Apr 02 '19

Ohh yeah that’s a handy one too.

→ 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)

0

u/[deleted] Apr 01 '19

[deleted]

2

u/stone_henge Apr 02 '19

You want to use the i motion if you want to replace the entire content of a string literal. The t motion starts from the current cursor position while the i motion addresses a matching pair of characters. For example:

static const char *v = "Hello";
  ^- cursor is here (normal mode)

then, after ci":

static const char *v = "";
                        ^- cursor is here (insert mode)
→ More replies (2)
→ More replies (2)

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)

3

u/c0nnector Apr 01 '19

There's no i in :we

2

u/AvianPoliceForce Apr 01 '19

no need with a

→ More replies (5)