Vim is a text editor, part of the standard suite on a UNIX system.
This is a short post which is a store of some Vim keystrokes that I am progressively discovering, and which are worth sharing for anyone interested.
The main point is that with Vim you learn a new method of moving around a text file, so it is a bit like learning new paradigms for a foreign language if you like.
- Don’t move with the arrows, move by words or by searching.
This means that for scanning through text you might do:- Move forwards and back quickly with W, B and E (move by words, without recognizing punctuation),
- Get closer by releasing the shift and using w, b or e in the final stages to home in.
And to move through larger distances use a quick search:
- hit / and type a bit of text to search forward, with n and N to move forward and back along those points,
- hit ? and type text to search backward, then use n and N likewise.
- Copy text you just typed for a paste later:
- Enter the text, then ESC and v to enter VISUAL mode,
- use ‘[ (moves to the point of where text was last changed),
- yank it with y.
For example, if I need to add something like ‘_{\text{N}}’ to a few ‘\sigma’ in my article I do this:
- find a ‘\sigma’ with /\\sigma,
- move to the end with e, and then append with a,
- type ‘_{\text{N}}’,
- ESC out and v into VISUAL mode,
- ‘[ and y to copy that text,
- now an n will take me to the next instance of ‘\sigma’
- and a quick e then p will paste the text where I want it.
Nice! In short, Vim seems to be a good fit for all of the usual text manipulations I do in a Latex article.