Skip to content

Instantly share code, notes, and snippets.

@ritajitk
Last active February 15, 2019 17:09
Show Gist options
  • Select an option

  • Save ritajitk/88ab03f39ccca71be2cdb832465ca8bf to your computer and use it in GitHub Desktop.

Select an option

Save ritajitk/88ab03f39ccca71be2cdb832465ca8bf to your computer and use it in GitHub Desktop.
Appending lines to a file inside two marks with vim

Between lines with marks a and b (inclusive), append each line starting with "Error" to a file:

:'a,'b g/^Error/ .w >> errors.txt

After selecting lines in visual mode you can use this. After visually selecting text, press :,

'<,'> g/The/ .w>>newfile.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment