Age | Commit message (Collapse) | Author |
|
Remove all the cruft from 60bc8ea8b3b7be511c4240ca1d7dc1cc1149b113:
* Don't store user-defined 'completefunc' any more since we no longer
change that setting.
* Remove the commented `a:findstart` code, which is no longer relevant
since this function is no longer a 'completefunc'.
* Remove commented test & debugging code
* Remove the `gitcha#StartGitSHACompletion()` function, which was there
only to facilitate mapping to the user completion function defined in
'completefunc' using the Vim-assigned mapping `<C-x><C-u>`. Our map
now directly invokes `gitcha#GitSHAComplete()`.
|
|
Work in progress
Rough code for a working implementation using `complete()` instead of
'completefunc'.
Rejigger `start` and make a new `base` variable since we can no longer
get it as an argument.
Correctly reset 'completeopt' to its original user value after opening
the popup menu.
Return an empty string from the function as recommended by
:h complete()
|
|
Work in progress
Adds 'menuone' to the 'completeopt' option. This makes the popup menu
display even if there's only a single result. We want this because it
allows us to see the commit message subject for the completed SHA,
providing a way to confirm that the completed SHA is the right one.
Here, the idea was to try to save the user's 'completeopt' setting and
restore it after completion, but we can't do that in
`gitcha#GitSHAComplete` because if we do, it restores 'completeopt'
before the completion menu is shown. Thus, it cancels out our custom
`+=menuone` setting.
After checking online to see how other plugins handle this
(https://github.com/search?utf8=%E2%9C%93&q=completeopt+language%3AVimL+path%3A%2Fautoload&type=Code&ref=advsearch&l=&l=),
I found that they use the `complete()` built-in function instead of
overriding the user-designated 'completefunc' setting:
https://github.com/heavenshell/vim-flood/blob/2bd8580642c56c2a090a8e44cc768e98019310be/autoload/flood/complete.vim
This allows us to add `+=menuone` before calling `complete()` and remove
the setting afterwards.
Using `complete()` seems like the way to go here, so it looks like I'm
going to have to refactor the code to do that instead in order to get
"menuone" to work.
The way I originally wrote the program was intuitive at the time. I'm
glad I did it that way, because it provided me with the knowledge of how
to remap the built-in completion mappings in Auditory.vim. Will have to
try that out at some point.
|
|
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.
|