|
|
|
|
|
by opan
28 days ago
|
|
I find it fun and satisfying, a joy to edit in. The best way to learn is to just use it all the time. If something seems slow or hard to do, try to figure out a better way to do it. There is a lot of consistency and logic, so once you get a basic grasp you can intuitively figure out new motions. Like once you know the verbs to delete or change you can pair them with various movements. dw to delete a word, but if you're gonna go into insert mode right after anyway you might as well do cw to change word. There are some interesting niche things vim can do that I don't know another easy way to do as well. Need exactly 80 dash characters? 80i- will do it. Can similarly use o instead of i (the new line + insert bind) to make n lines of something that are identical. It's like very accurate efficient copy-pasting. Another fun one is if you've accidentally typed a sentence with caps lock on "a BIT LIKE THIS.", you can select it in visual mode and hit ~ to swap the caps for the whole selection. I think most people would just retype it, or maybe force lower all of it somehow then retype the first letter. Macros are really neat as well. Basically, think through the motions to do a particular edit, even if it's very convoluted, maybe 20 motions, then you can record it and play it back, repeat it any number of times (like to do the same edit to 100 lines in a row), or save it to a keybind in your config. Macros can also include commands and [vim] window management. Like I have two files I work in side by side a lot and I made a bind to delete the second line of both files and save both files. Under the hood it is very manually jumping to line 2, deleting, saving the file, swapping windows, doing the same, swapping back at the end. When played back it appears as though it did just what you wanted instantly, though. If I ever find I'm doing a bunch of repetitive manual steps like that a lot, I think about whether a macro saved to a keybind would be a good idea. I use vim for personal notes, editing configs, managing playlist (.m3u) files, etc. I'm not a programmer. |
|