Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porjo/f30ed55b05691a815705 to your computer and use it in GitHub Desktop.
Save porjo/f30ed55b05691a815705 to your computer and use it in GitHub Desktop.
vim tips

Replace all occurrences of text block A with block B

visually select A "ay , visually select B "by then :s/<ctrl-r>a/<ctrl-r>b/g

Note: pasting in from register produces ^M and ^I in place of newlines and tabs. These need to be converted to \n and \t respectively.

(Technique also documented here: http://vim.wikia.com/wiki/Search_and_replace)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment