3 ms·
>I either go down with arrows (I know it's controversial) Probably not that controversial any more. It used to be (although I would use the word inadvisable in
by vram22 8y ago
>I either go down with arrows (I know it's controversial)
Probably not that controversial any more. It used to be (although I would use the word inadvisable instead), because dumb terminals like VT-100 and some emulators of them, would emit escape sequences when arrow keys were pressed. Since an escape sequence starts with the Escape key and then has some other keys following it, it would result in your going from input mode (if you happened to be in it) back into command mode (due to the Esc key) and then the remaining keys in the sequence would be likely interpreted as vim commands (since many letters of the alphabet are vim commands), so any unwanted modification could happen to the file you were editing, maybe without your noticing. Then if you saved the file without knowing that there was some such inadvertent change, you could have lost or mangled some of your content.
Nowadays common emulators that I have come across, don't have that issue, so arrow key usage should be fine.
The other reason why people may comment if you use arrow keys for movement in vim, is because if you instead use the default and recommended hjkl keys (for left, down, up, right respectively), your fingers stay on the home row (on a QWERTY keyboard), which may make for less finger / hand movement, so less strain.
>beginning of file with :1, end of file with G, line number with :[line number]
You can use 1G for beginning of file, G for end of file, and nG for going to line n, without having to hit Enter after some of those commands as you have to with the :[line number] method, thereby potentially saving one keystroke many times per edit session.
>I use ^ for beginning of line, $ for end of line, e to move quickly in a line
0 goes to the real start of the line, ^ goes to the first non-blank character on the line.
>I use the arrow keys, and I don't care about all the arrow-key shamers out there.
Good on you.
>I also use o quite often (as it just goes into insert mode).
O (a capital O) Opens a line above the cursor, o (small o) opens a line below it.
> Repeating substitutions
>one thing I would recommend is bogado/file-line plugin which lets you open a file at a line, e.g. vim app/models/user.rb:48
vi(m) +n filename
will open filename at line n, for both vi and vim, so I'm not sure why that plugin is needed, unless it does other stuff too.
And:
vi(m) +/pattern filename will open filename at the first occurrence of pattern in filename.
- aboutruby 8y agoNot sure if you are directing this comment at me, but I know most of these already. Didn't know about the older terminal emulator issues with arrow keys though.
- vram22 8y agoIt was partly for you and partly for other readers. It seemed to me that, based on your comment, you may not have known about some of the points I mentioned, like use of G with number modifiers instead of the "colon then <number> then Enter" method. Maybe I should have been more specific, and put the more general points in a separate comment. Also, I guess you may prefer to use the colon method even though the G method is one key less. I know I do at times, too :)
- vram22 8y ago>Didn't know about the older terminal emulator issues with arrow keys though. NP. Yes, I've found that some people do not know about those issues, which is why I mention them (and also, like others, recommend the use of the hjkl keys) in my quickstart tutorial that I mentioned elsewhere in this thread: https://gumroad.com/l/vi_quick https://gumroad.com/l/vi_quick
- yuubi 8y agoIt seems to be more a function of the vi-like in use. Old-school vi behaved that way, but (at least some) vim interprets ESC [ A close together as a movement command.