Skip to content

Instantly share code, notes, and snippets.

@millionfor
Created June 16, 2021 09:58
Show Gist options
  • Save millionfor/2d543ae00b539f7bb1390d9e926b4b67 to your computer and use it in GitHub Desktop.
Save millionfor/2d543ae00b539f7bb1390d9e926b4b67 to your computer and use it in GitHub Desktop.
vnoremap <silent><buffer> C :<c-u>call <SID>console()<cr>
func s:console()
let tag = getline(line("."))[col("'<") - 1 : col("'>") - 2]
let l = line('.')
let space = substitute(getline(l), '\v(^\s*).*', '\1', '')
call appendbufline('%', line('.'), printf(space . 'console.log(`[logger-%s] => `, %s)', tag, tag))
endf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment