Last active
February 12, 2016 15:30
-
-
Save abuseofnotation/f032ee58b8fdb4ef7429 to your computer and use it in GitHub Desktop.
Debug node.js Apps from 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
" A handy mapping for debugging node.js applications from vim using the node build-in debugger. | |
" Add the following mapping to your .vimrc file: | |
nnoremap <C-D> Odebugger<esc>:w<CR>:!node debug %:p <CR>dd:w<CR> | |
" Now in vim, go to the place where you want to break and press Ctrl + D. | |
" This inserts a 'debugger' statement, at your current line and launches the file in debug mode. | |
" You can also combine this with a testing framework like nodeunit: | |
nnoremap <C-D> Odebugger<esc>:w<CR>:!node debug nodeunit<CR>dd:w<CR> | |
" This works if vim is launched from the project root. | |
nnoremap <C-D> Odebugger<esc>:w<CR>:!node debug node_modules/nodeunit/bin/nodeunit<CR>dd:w<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment