Live data from Hacker News

History and effective use of Vim (2019)

begriffs.com

51–60 of 98 posts

Re: History and effective use of Vim (2019)

#51
post #45

Earlier quoted context omitted.

Unsolicited advice for scrolling without spamming j and k: - C-u and C-d to jump up/down - [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code) - from the article: 50% to go the halfway point of a document - 100gg to go to line 100 - 100k to go 100 lines down Are there any more good ones? Edit: occurs to me that you might have r…

:set relativenumber The line the cursor is on is now shown in the left sidebar as 0, counting up for each line away from the cursor. So now it tells you what number to use for "10j" and "10k" to move up and down a specific number of lines. m[a-z] `[a-z] Mark a point in a file into a register, and jump back to that point. Or even more interesting: m[A-Z] `[A-Z] Same as above, except capital marks are global and work a…

I also set scrolloff to 10 or so that way I can always see what's above/below what I'm currently editing.

Re: History and effective use of Vim (2019)

#52
post #45

Earlier quoted context omitted.

Unsolicited advice for scrolling without spamming j and k: - C-u and C-d to jump up/down - [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code) - from the article: 50% to go the halfway point of a document - 100gg to go to line 100 - 100k to go 100 lines down Are there any more good ones? Edit: occurs to me that you might have r…

:set relativenumber The line the cursor is on is now shown in the left sidebar as 0, counting up for each line away from the cursor. So now it tells you what number to use for "10j" and "10k" to move up and down a specific number of lines. m[a-z] `[a-z] Mark a point in a file into a register, and jump back to that point. Or even more interesting: m[A-Z] `[A-Z] Same as above, except capital marks are global and work a…

My only problem with relative line numbers (and I use them despite this) is working with ranges of line numbers. For instance, I'll maybe be doing some refactoring and want to see what it looks like to move lines 127,137 to my current cursor (127,137t.). With relative line numbers I have to do some quick arithmetic to sort out the range.

Re: History and effective use of Vim (2019)

#53
post #9

If Vim was a GUI application (and could smoothly handle long lines), it would the perfect editor for me. Alas, the best I've seen so far is Neovim's discontinued GUI frontends.

It's probably not what you're looking for but I find vim bindings for VSCode is a good balance between vanilla vim and an IDE.

Re: History and effective use of Vim (2019)

#54

Earlier quoted context omitted.

This is me all the time. The worst is “kkk”. I can’t remember why I type it in vim (it’s muscle memory, and I’m not at a computer to try it out), but it has really bad connotations here in the US south, so… no bueno.

Unsolicited advice for scrolling without spamming j and k: - C-u and C-d to jump up/down - [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code) - from the article: 50% to go the halfway point of a document - 100gg to go to line 100 - 100k to go 100 lines down Are there any more good ones? Edit: occurs to me that you might have r…

> advice for scrolling without spamming j and k

Or just use the directional keys and PgUp/PgDown like any person in the last 30 yrs

Re: History and effective use of Vim (2019)

#55

Earlier quoted context omitted.

This is me all the time. The worst is “kkk”. I can’t remember why I type it in vim (it’s muscle memory, and I’m not at a computer to try it out), but it has really bad connotations here in the US south, so… no bueno.

Unsolicited advice for scrolling without spamming j and k: - C-u and C-d to jump up/down - [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code) - from the article: 50% to go the halfway point of a document - 100gg to go to line 100 - 100k to go 100 lines down Are there any more good ones? Edit: occurs to me that you might have r…

H, M, and L will move the cursor to the top, middle and bottom (respectively) of the screen. That is, H moves the cursor to the top visible line on the screen, L to the last line currently visible, and M to the middle. Cursor moves but text does not.

zt, zz, and zb are similar but move the text not the cursor. So, zt will take the current line the cursor is on and make it the first visible line on the screen (and keep the cursor on that line). zz to the middle, zb to the bottom.

Personally, I use [ and ] to jump around most often in code, but the above are handy when you are working with documents.

Re: History and effective use of Vim (2019)

#56
I’ve used vim for decades and have utterly failed at switching away every time I tried to. I miss everything about it too much. My only real complaint is I have a hard time using IDEs, because my vim muscle memory is too strong and despite many offering vim key bindings they never offer all the features/keys I typically use. Often missing are recording/playback, visual mode, anchors, vim’s (unique) regex syntax, buffer manipulation, etc.

Re: History and effective use of Vim (2019)

#57

Earlier quoted context omitted.

Unsolicited advice for scrolling without spamming j and k: - C-u and C-d to jump up/down - [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code) - from the article: 50% to go the halfway point of a document - 100gg to go to line 100 - 100k to go 100 lines down Are there any more good ones? Edit: occurs to me that you might have r…

> advice for scrolling without spamming j and k Or just use the directional keys and PgUp/PgDown like any person in the last 30 yrs

Every time my fingers have to leave the home row I feel pain. Mostly from knowing that I’m likely to typo straight after, or have to remove my gaze from the screen to check my fingers and then find my position on the screen again. It really breaks flow and that flow was a big motivation for me to start using vim

Re: History and effective use of Vim (2019)

#58

Earlier quoted context omitted.

This is me all the time. The worst is “kkk”. I can’t remember why I type it in vim (it’s muscle memory, and I’m not at a computer to try it out), but it has really bad connotations here in the US south, so… no bueno.

Unsolicited advice for scrolling without spamming j and k: - C-u and C-d to jump up/down - [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code) - from the article: 50% to go the halfway point of a document - 100gg to go to line 100 - 100k to go 100 lines down Are there any more good ones? Edit: occurs to me that you might have r…

:1 to go to the top of the file, G to goto the bottom of the file

Re: History and effective use of Vim (2019)

#59
post #6

Earlier quoted context omitted.

Am a similarly profiled (neo)vim user .. but without cat. Sometimes I catch strange letter combinations like "gqip" in my emails that baffle the recipients. Want vim keys everywhere!

This is me all the time. The worst is “kkk”. I can’t remember why I type it in vim (it’s muscle memory, and I’m not at a computer to try it out), but it has really bad connotations here in the US south, so… no bueno.

Can I ask what kkk means?

I thought it meant that you were laughing like haha (a leas in Brazil)

I didn't know it had bad connotations

Re: History and effective use of Vim (2019)

#60
I don't know exactly when I started "porting" vim into Linux on the Web (it's actually a complete rewrite in JS). It's been a few years at least. You can play with it by going to http://lotw.site/shell and then entering `import fs && vim` at the prompt.

(A tip... if you do `echo "import fs" >> ~/.bashrc`, the 'fs' command library—which contains the vim command—will be automatically imported into the current shell's execution context.)

Post reply on HN