rspec - vim function external call -
currently vimrc has following key mappings:
map <leader>m :w\|!clear && rspec --drb %<cr> map <leader>k :w\|!clear && rspec --drb %:<c-r>=line('.')<cr><cr> map <leader>c :w\|:!clear && cucumber --drb -r ./features %<cr> map <leader>x :w\|!clear && cucumber --drb -r ./features %:<c-r>=line('.')<cr><cr> however want consolidate them (two) functions have same keymap line vs file, i've tried following vim complains missing parentheses:
function! testcurrentline() let spec = '*_spec\.rb' if !(expand("%") =~ spec) :!clear && cucumber --drb -r ./features %:<c-r>=line('.')<cr> else :!clear && rspec --drb %:<c-r>=line('.')<cr> end endfunction function! testcurrentfile() let spec = '*_spec\.rb' if !(expand("%") =~ spec) :!clear && cucumber --drb -r ./features % else :!clear && rspec --drb % end endfunction map <leader>m :w\|call testcurrentfile<cr> map <leader>k :w\|call testcurrentline<cr> any ideas?
add parentheses function calls:
map <leader>m :w\|call testcurrentfile()<cr> map <leader>k :w\|call testcurrentline()<cr>
Comments
Post a Comment