Skip to content

Instantly share code, notes, and snippets.

@harryjubb
Last active January 4, 2019 14:41
Show Gist options
  • Save harryjubb/966b68ed9fa3f5a661cb09efc994eb1a to your computer and use it in GitHub Desktop.
Save harryjubb/966b68ed9fa3f5a661cb09efc994eb1a to your computer and use it in GitHub Desktop.
Vim Tricks

Javascript

Macros

Console log everything on current line, turning the current line into a string:

"l   Iconsole.log('^[A')^[

Console log everything on current line, comma separating the content as a string and as a JS expression. Requires surround.vim

"k   ^iconsole.log(^[ly$Pa, ^[hhysiw'A)^[

" Better version:
viWygvS)a, ^[hi''^[PIconsole.log^[
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment