From bc4fcb2b082805914d6e87ff38516dbafc5c5538 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 Apr 2017 04:38:49 +0200 Subject: Move ftplugin to ftplugin/gitcommit/gitcha.vim 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. --- ftplugin/gitcommit.vim | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 ftplugin/gitcommit.vim (limited to 'ftplugin/gitcommit.vim') diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim deleted file mode 100644 index e08f2e0..0000000 --- a/ftplugin/gitcommit.vim +++ /dev/null @@ -1,34 +0,0 @@ -let s:old_completefunc = &completefunc - -function! GitSHAComplete(findstart, base) - if a:findstart - " locate the start of the word - let line = getline('.') - let start = col('.') - 1 - while start > 0 && line[start - 1] =~ '\a' - let start -= 1 - endwhile - return start - endif - - " Restore user completion function - let &completefunc = s:old_completefunc - - " Match Git SHAs in the current repository - let matches = [] - let revs = system('git rev-list --all') - for m in split(revs) - if m =~ '^' . a:base - call add(matches, m) - endif - endfor - - return matches -endfunction - -function! StartGitSHACompletion() - set completefunc=GitSHAComplete - return "\\" -endfunction - -inoremap StartGitSHACompletion() -- cgit v1.2.3