Hi I am trying to make a VIM mapping to run a script when I press F2. I am struggle to get a full path for the file that is being edited with vim into the command function.
nnoremap <F2> :! php /home/kbuczynski/diff_re.php fix <full file path here> flagArg
Any idea ?
You can get the full path to the current buffer with:
expand('%:p')
Your mapping could look something like this (you will also need to use the execute function):
function! CallPHP()
execute '!php /home/kbuczynski/diff_re.php fix '.expand('%:p').' flagArg'
endfunction
nnoremap <F2> :call CallPHP()<CR>
Here is some good documentation on dealing with file paths.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With