I should read the Vim help more often

June 6, 2023

A while back I wrote about handling numbers in Vim when they have a dash in front of them, and in a comment, Seth pointed me to a special option in visual mode, 'g Ctrl-A', which will increment a column of numbers the way I wanted here. Since this is visual mode, I can select the numbers without the leading dashes.

One of the morals I drew from this is that when I'm trying to do something in Vim, I should read the help (more often than I do). In this case the documentation for v_g_CTRL-A was right after the documentation for CTRL-A, so starting there would have immediately given me the answer, but even when this isn't the case the Vim help may give me pointers, cross-references, or general ideas. Vim has a lot of features (too many for me to learn and keep track of), but it also has a lot of documentation for them and my general impression is that it's good reference documentation.

(I haven't read enough of the Vim documentation to have strong opinions. I've also never attempted to learn Vim from its documentation; I absorbed my core Vi knowledge long enough ago that I can't remember exactly how.)

One corollary of this is that I should learn more about how to find documentation in Vim. Vim has its own help system with its own notation, so I should read help.txt until I absorb that, and then ideally remember that I can do ':help' to refresh my memory. Having read it now, I definitely want to remember ':help word CTRL-D'.

(In some theoretical world I'd experiment with ':help' and ':helpgrep' enough to get a feel for them, and maybe read through the vim tutor to see if I'd missed anything. In this world, even though Vim is my main editor I don't feel motivated enough to go to that much effort. My reading of vim documentation is purely an 'in and out' thing to find out specific usage information, instead of any attempt at a deep exploration. This may not be ideal but I'm realistic about what I'll actually do.)

PS: The other thing I should probably start doing is writing down Vim commands that I want to remember, partly because writing things down helps stick them in my mind. I do some of that here in Wandering Thoughts entries, but it's not an ideal fit. Of course the obvious answer is that this whole environment is a wiki, even if almost all of its contents is in Wandering Thoughts. I even have an existing page on Vim tips, although it's just links today.

Written on 06 June 2023.
« The Linux kernel will fix some peculiar argv usage in execve(2)
A retrospective on my thesis about language niches, fifteen years later »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Jun 6 22:39:07 2023
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.