Thursday, October 27, 2011

Vi Tips - QuickFix


See
:help :compiler
:help :make

(the latter without a preceding exclamation mark) which will
automagically display the first error (if any) as soon as the make job
terminates. (Not sure if you'll get to the first _warning_ or _error_),
and a few other useful commands for use after that:

:cfir[st]
:cla[st]
:cn[ext]
:cp[revious]
:cnf[ile]
:cpf[ile]

for navigating the error list, and

:cope[n]
:ccl[ose]

to see it in its own window (the "quickfix" window), where hitting Enter
on an error moves to that line in the source. Of course, these commands
can be mapped for ease of use; for instance I have the following in my
vimrc:

:map :cnext
:map :cprev

which I use not so much for compiling but for the ":helpgrep" and
":vimgrep" commands (whose results also come in a quickfix window).

See also ":help quickfix.txt"



====================Vimdiff ==================
# vimdiff
Most of what you asked for is folding: vim user manual chapter on folding. Outside of diffs I sometime use:
   * zo -> open fold.
   * zc -> close fold.
But you wll probably be better served by:
   * zr -> reducing folding level.
   * zm -> one more folding level, please.
or even:

   * zR -> Reduce completely the folding, I said!.
   * zM -> fold Most!.
   
]c - Jump to the next change.
[c - Jump to the previous change.
:diffupdate :diffu -> recalculate the diff,