Created
September 6, 2012 08:13
-
-
Save nervetattoo/3652878 to your computer and use it in GitHub Desktop.
console.log in vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Console log from insert mode; Puts focus inside parentheses | |
imap cll console.log();<Esc>==f(a | |
" Console log from visual mode on next line, puts visual selection inside parentheses | |
vmap cll yocll<Esc>p | |
" Console log from normal mode, inserted on next line with word your on inside parentheses | |
nmap cll yiwocll<Esc>p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
one maybe more "modern" alternative to this gist (which i used happily for years already, but wanted to try out something new) is to use "snippet" plugins like https://github.com/hrsh7th/vim-vsnip
Procedure:
Install vim-vsnip plugin
Run :VsnipOpen
Select type global (or filetype specific)
This opens a blank file where you can put your snippets
Put this in the snip file
console.log is the name of the snippet. you can add more to the file for custom usages. Then while you are typing in insert mode