Skip to content

Instantly share code, notes, and snippets.

@nickb-minted
Last active December 11, 2015 19:52
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 nickb-minted/2644ceae133625fda30c to your computer and use it in GitHub Desktop.
Save nickb-minted/2644ceae133625fda30c to your computer and use it in GitHub Desktop.
Collection of some vim text magic

Adding commas to the end of a po numbers

  • This assumes that the items you have are one per line
  1. Go to the top of the list
  2. Go to the end of the word/number of the first word (SHIFT + $)
  3. Hit Crtl + V
  4. Hit Shift + g
  5. Hit Shift + $ (this will remove the highlight of the entire block and only leave the last character highlighted)
  6. Hit Shift + A
  7. Hit , (for this case, but it can be any character that you want)
  8. Hit esc (commas [or whatever character you pressed] are now added to the end

Combining a list into just one line

  • Highlight all that you want to combine
  1. Shift + V
  2. Shift + g
  3. Shift + j

Saving a file even if you did not open it with sudo

:w !sudo tee %

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