I'm trying to write an
autocmd to make a commit to a git repository. Here is some non-functional code that should illustrate what I'm trying to do:
let g: CommMsg = '' augroup misc autocmd! autocmd nmap <buffer> gc :call GetCommMsg()<CR>!git commit -m '=CommMsg'<CR> augroup END function! GetCommMsg() let curline = getline('.') call inputsave() let name = input('Enter message: ') call inputrestore() let CommMsg = call setline(',', curline . ' ' . name) endfunction
The intention here is to use the
GetCommMsg() function to get the message from the user, set a global variable to this value and then pass it to the
git commit command as the message argument.
Is this possible?