I find myself often repeating the names of the functions I've edited, in the commit message, and it'd be nice to have autocompletion for the functions I've just changed when writing the commit messasges.
Is it possible to get vim to somehow search through the current commited files and grab the function names, or better yet, only the modified ones?
I'm using gVim7.3 and C#, if that's at all relevant.
If you use the -v
option to git commit
that will cause git to place the diff of what you're committing in the file used to create the commit message. With most languages the headers of hunks within that diff will indicate the name of the function being modified. This will make the names of modified functions available for completing with Ctrl+N or Ctrl+P
To simplify this I long ago did
git config --global alias.ci 'commit -v'
And always use git ci
rather than git commit
.
Newer versions of git support configuration to turn this on for all commits.
git config --global commit.verbose true
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