I wish to write a function which I can add to my .vimrc file that will call a terminal command, and then bind it to <leader>u.
I cant seem to get it to work tho. I believe that I can use the system() function, but there is very little documentation available and I cant seem to get it to work.
The terminal command in question is ‘git push origin master‘.
I know that there are plugins available for git but I am not looking for any of these, just a simple function to bind a terminal command to a key combination.
function gitPush()
system("git push origin master")
endfunction
:nmap <leader>u :call gitPush()
I know this is waaay out, but vim doesnt seem to want to make documentation very available.
Ty
Is the way to run a command in a subshell.
EDIT: User defined functions must begin with a capital letter too 😉