What would be the best way to set Vim up to always put the cursor in insert mode at the end of the first line (to account for commit message templates) when running git commit
? This would basically do something identical to pressing ggA every time. Ideally this should be a Vim configuration (presumably in ~/.vim/after/ftplugin/gitcommit.vim), because I rely on $VISUAL
rather than configuring editors for everything separately.
This almost works:
call feedkeys('ggA', 'int')
However, when running echo 'some text' >/tmp/COMMIT_EDITMSG && vim -Nu NONE --cmd 'filetype plugin on' /tmp/COMMIT_EDITMSG
the cursor is on the status line until I press something:
1 | startinsert!
works for echo 'some text' >/tmp/COMMIT_EDITMSG && vim -Nu NONE --cmd 'filetype plugin on' /tmp/COMMIT_EDITMSG
, but when running git commit -t /tmp/COMMIT_EDITMSG
it breaks completely - the commit message is not shown and the commit template is shown below the status line:
After pressing right arrow the commit message and cursor shows up, and the editor is in insert mode, but the cursor is at the second character rather than at the end of line:
Do I need to add something to the configuration to tell Vim to show the actual contents of the buffer?
ggA
every time I commit. It's really frustrating how I can't just put that string in a configuration file, but instead have to learn a completely and weirdly documented new language.