83
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 17 Jul 2024
83 points (97.7% liked)
Ask Experienced Devs
0 readers
1 users here now
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
I use vim bindings in vscode, but I'm trying to switch to neovim.
It's hard to talk about efficiencies without use cases but here's some that I like:
Instead of remembering what line number you were at, you can use marks (
:help mark-motions
) to immediately jump back to where you left off.For example, type
mx
to mark the current position withx
(or anything you want). Say now you are at the top of the file, just type'x
to go back to the line marked withx
.Do you have any more compelling examples?
Ooh fun, these all take 2-3 key presses
And these more/less key presses
But it misses the point, of course every editor can do just about anything, but there is a lot more mouse involved and learning it is more difficult because the keybinds aren't combinatorial
1 is just going to highlight right?
2, how about 6 words, 10 words, 100 words
3, 4 I use all the time
5 if your edit locations don't line up so that you can alt drag a single column, this is what I mean by jagged. I would use a combination of find and repeat action.
Start from scratch - skill issue :p
Yes exactly my point. How often do you need to delete exactly 100 words? Do you count them? Obviously not - you probably guess and delete 50, and then 25 and then 20 etc.
10dw . . .
Superficially, typing + seems to be the same as typing , but these are two completely different paradigms of using the editor.
Vim does not use shortcuts or hotkeys to edit the text, it uses a language to communicate with the editor.
For me, shortcuts and hotkeys are rote memorization, and I'm bad at rote memorization โ compare your point "5. Ctrl-{ or } does this I think". Do I need Ctrl-left, Super-left, Alt-left, Shift-left or Ctrl-Shift-left to jump back a word?
The vim editing language is mostly consistent and logical. I did not need to memorize it, I could learn and understand it. But that's just me.
Far too much examples:
Most commands are abbreviations โ a for append, b for back, c for change, d for delete, e for end of word, f for forward, g for goto (and more), hjkl are special, i for insert, m for mark, n for next, o for open line, p for paste, q for reqord macro is a strange spelling, r for replace, s for substitute, t for to, u for undo, v for visual mode, w for word, x for extinguish, y for yank, z is just a prefix for arcane stuff. Capital letters are usually variants of their minuscle counterpart โ like A for append at end of line.
Commands take a repeat count, and a lot of commands take objects/movements, and these reuse the commands, like "delete inside backticks" => di`, "yank inside brackets" => yi{, "change up to third slash" => c3t/
If you are fluent in vim, you won't type shortcuts while editing, you will talk to your editor.
As for more compelling examples:
"I'd like to change the next 2 sentences" translates to )c2)
"Please format this paragraph." translates to gqap
"Swap these two characters." translates to xp
And I did not touch ex mode, vimscript and plugins yet.
Nah I don't have any more examples cuz I haven't been using vim for like 30 years. I think the other comments make good points tho