I am trying to do something like this, from a function:
nmap <F5> :!python %
Pressing F5 in this case causes the command :!python %
to be left in the command line. This is preferred for me, because occasionally I may want to add extra command arguments or stuff to the end of the command.
However, I'm not sure how to create this behavior from a vim function. The execute()
function simply executes the command directly, with no chance of editing, while the normal
command doesn't seem to work.
nmap <F5> :call MyDebugFunction()<cr>
function! MyDebugFunction()
" This just executes right away with no chance of editing
execute("python %")
" Neither of these work
normal! :!python %
execute "normal! :!python%"
endfunction