Age | Commit message (Collapse) | Author |
|
Include a short description, screenshot, and license information.
|
|
|
|
Include a short description, information about the included completion
mapping, and license text.
|
|
Clean up the check for `g:no_plugin_maps` based on this style from
tpope's gitrebase.vim:
https://github.com/tpope/vim-git/blob/5fcaf2b4f66cd28984cf4fe814d7803bbf073a12/ftplugin/gitrebase.vim
|
|
Allow the plugin's actions to be undone. Will be executed automatically
when users change the filetype, as explained here:
:h undo_ftplugin
|
|
|
|
Instead of forcing the mapping '<C-x><C-s>' to activate Git SHA
completion, allow users to define a different custom mapping.
|
|
|
|
Previously, we were using the completion function sample copied from the
Vim manual. This function determined `a:findstart` using a match against
`\a`, which only matches alphanumeric characters.
Git commit SHAs are SHA-1s, which can contain alphanumeric characters.
With the previous match regex, if the word to be completed contained
numbers, the `a:findstart` match would fail. This resulted in `a:base`
being empty, causing all SHAs to be added to the `matches` array.
Now we correctly match only the characters that can appear in a SHA-1,
and the completion correctly fills in the rest given the start of a SHA.
|
|
|
|
Only show the first 10 characters of the commit SHA in the popup menu to
allow more room for the subject. The first part of the SHA is enough to
be able to identify it, so this gets rid of some non-essential
information.
The full commit SHA will still be inserted as a result of the
completion.
|
|
Fix the subject issue from 0773fdd7bde5e7ce462c15bd1c71db3a3e46862a and
show the entire commit subject in the popup menu.
|
|
|
|
Initial try at adding the commit subject to the popup menu to provide
context for the commit.
Currently only shows the first word of the subject because I'm using
`split()`.
|
|
|
|
|
|
Don't force our functions to be loaded when the ftplugin is loaded. Be
good Vimscript citizens and respect load performance.
|
|
To ensure that we don't conflict with the real "gitcommit" ftplugin,
move ours into a new custom file.
As described in
:h ftplugin-name
we can create additional ftplugins for the same filetype by putting our
script in a directory named for the filetype.
|
|
|
|
|
|
Make our custom mapping work while retaining any user-defined
`completefunc`.
Doing it this way enables us to get away without having to set a hacky
`CursorMovedI` unsetting autocommand as imagined in
e70d92c495001c0af0037b9fadbeec170d2c318f.
We clutter our `GitSHAComplete` completion function a bit with
functionality that doesn't really belong to it in order to get a win for
simple implementation of the `completefunc` restore feature.
|
|
|
|
Experiment with providing a custom mapping for our Git SHA completion
function. We use <C-x><C-s>.
The custom mapping should set our function as the custom `completefunc`,
call the user completion function by programmatically running
`<C-x><C-u>`, and then unset and restore the previous `completefunc`
value.
This allows us to not clobber a user-defined completion function and
also give ourselves a special custom <C-x> mapping.
Just experimenting for now. Figured out how to get this to work using a
test `ASDF` function along with these resources:
* http://stackoverflow.com/questions/15643234/remapping-tab-completions-in-vim
* https://github.com/ervandew/supertab/blob/master/plugin/supertab.vim
* http://stackoverflow.com/questions/6926034/creating-a-mapping-for-insert-mode-but-not-for-autocomplete-submode
It works. The only problem is that we can't restore the old
`completefunc` value. Thinking about ways to do this, and for now my
most promising idea is to use the `CursorMovedI` autocommand.
|
|
Get the list of SHAs from `git rev-list` and use this for
completion. Not too different from the original structure.
Renamed `res` to `matches` because that seemed clearer to me.
|
|
Copy the completion function included in `:h complete-functions` to
give us a base custom completion function to work from. We'll be using
this to provide completion for Git SHAs.
|