aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-04-29 06:17:49 +0200
committerTeddy Wing2017-04-29 06:17:49 +0200
commit884a799b977d5f747ac73d75e9fe7c8e529af349 (patch)
treee47e0e4eb49ed70e57ec2d04d1c8e397eb95f840
parentc33f28d0f78aa171874367134f477c1dee5a8220 (diff)
downloadvim-gitcha-884a799b977d5f747ac73d75e9fe7c8e529af349.tar.bz2
autoload/gitcha.vim: Fix match list population
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.
-rw-r--r--autoload/gitcha.vim2
1 files changed, 1 insertions, 1 deletions
diff --git a/autoload/gitcha.vim b/autoload/gitcha.vim
index 0ceebab..7ed45c7 100644
--- a/autoload/gitcha.vim
+++ b/autoload/gitcha.vim
@@ -8,7 +8,7 @@ function! gitcha#GitSHAComplete(findstart, base)
" locate the start of the word
let line = getline('.')
let start = col('.') - 1
- while start > 0 && line[start - 1] =~ '\a'
+ while start > 0 && line[start - 1] =~ '[0-9a-f]'
let start -= 1
endwhile
return start