Pressing F4 from within VIM

Instantly launches CodeClap and breaks at the same place

There are a million ways to do this with VIM/Bash but wanted to share in case it is useful for anyone.
Add to existing vimrc file
1 2 3 4 5 6 7 8 9 | nnoremap <F4> :call CodeClapRunToCursor()<CR> function! CodeClapRunToCursor() :call system('./codeClapDebug.bash ' . expand('%:t') . ' ' . line(".")) endfunction nnoremap <F5> :call CodeClapRunToMain()<CR> function! CodeClapRunToMain() :call system('./codeClapDebug.bash') endfunction |
codeClapDebug.bash file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/bash fileName=$1 lineNum=$2 #configuration executable=~/dev/projects/engine2d/build/a.out workingDir=~/dev/projects/engine2d/build codeClap=~/dev/codeclap/codeclap if [ $# == 2 ]; then $codeClap --chdir $workingDir $executable $fileName:$lineNum else $codeClap --chdir $workingDir $executable fi |