vim-infest is a simple set of functions that allow you to debug your code lickity-split.
you can install the plugin using whatever package/plugin manager you want, here is an example using minpac:
call minpac#add('jssee/vim-infest')This plugin is really specifically made with javascript coding in mind so optionally, you can take a more involved approach and choose to only load the plugin for javascript and its different variants:
" only load infest for javascript files and its various flavors
call minpac#add('jssee/vim-infest', {'type': 'opt'})
augroup infest_file
autocmd!
autocmd FileType *.js,*.ts,*.jsx,*.tsx packadd vim-infest
augroup ENDThere are 3 functions and 1 command included. Default mappings are intentionally not provided.
Places a debugger statement in the line below the current line.
nmap <key> <Plug>(infest_statement)take the word under the cursor, wrap it in a console.debug statement, place it on the line below.
nmap <key> <Plug>(infest_cword)prompts for a message, wrap that message in a console.debug() statement, place
it on the line below.
nmap <key> <Plug>(infest_prompt)this command is meant to cleanup all the debugger andconsole.debug statements
in the current buffer. You have to confirm this action unless you invoke it
with a !
:InfestRaid(!)