I know I can write to a file by simply doing :w <file>. I would like to know though how can I write to a file by appending to it instead of overwriting it.
Example use case: I want to take some samples out of a log file into another file. To achieve that today I can do:
- Open the log file
- Select some lines with
Shift+v - Write to a file:
:w /tmp/samples - Select some more lines with
Shift+v - Append to
/tmp/sampleswith:w !cat - >> /foo/samples
Unfortunately step 5 is long, ugly and error prone (missing a > makes you lose data). I hope Vim has something better here.