My divergence from 'proper' Vim by not using and exploring features
I've read a reasonable number of Vim tutorials and introductions by now, and one of the things that stands out is how some of what I do differs from what seems to be considered 'proper' Vim. The simple way to put it is that I use less of Vim's features than the tutorials often introduce. One of the best examples is something that I do all of the time, which is reflowing paragraphs.
The official proper Vim way to reflow paragraphs (based on tutorials
I've read) is gq{motion}
. Often the most flexible version is
gqip
or gqap
(where 'ip' or 'ap' select the paragraph you're
in). Assuming that various things are set correctly, this will
magically reflow your paragraph, much as M-q does in Emacs (a command
I'm accustomed to using there).
However, for various reasons I don't use this; instead I rely on
the general purpose hammer of '!
' and the (relatively) standard
Unix fmt
command. My conditioned reflex sequence of commands for
formatting the paragraph I'm writing is 'ESC { !}fmt }', and in
general I'll use '!}fmt' more or less reflexively.
At one level this is somewhere between a curiosity and a deliberate
choice not to learn all of Vim and try to Vim golf everything in
sight (a choice that I've written about before).
At another level this is kind of a weakness. As an example, in
writing this entry I discovered not just that the gq
command could
be made to use fmt
, but also discovered or re-discovered the ip
and ap
motion modifiers, which might be useful periodically,
including in my usual paragraph reflowing.
Or perhaps not, because now that I experiment with it, using ip
instead of moving to the start of the paragraph causes the cursor
to jump up to the start after the paragraph is reflowed. Using an
explicit { command means that I'm (relatively) conscious that I'm
actively moving before I reflow, instead of having the cursor jump.
If Vim was Emacs, I probably wouldn't mind, but since Vim is Vim I
think I may prefer the explicitness of my current approach.
(And on character golfing, using ip
or ap
saves no characters
in this situation. To really golf, I would need to switch to gq
.)
As before, I probably shouldn't be surprised. Vim's sets of commands and motions are now really quite large, and people generally pick and choose what they use out of large sets like that. I suspect that plenty of Vim users use only various subsets of them, subsets that would strike other Vim users as annoyingly inefficient or old-fashioned.
Comments on this page:
|
|