aboutsummaryrefslogtreecommitdiffstats
path: root/ftplugin/gitcommit.vim
diff options
context:
space:
mode:
authorTeddy Wing2017-04-29 04:38:49 +0200
committerTeddy Wing2017-04-29 04:38:49 +0200
commitbc4fcb2b082805914d6e87ff38516dbafc5c5538 (patch)
tree19fafe80fe1d606f5caa3992c6f8cd47ee3fb7c8 /ftplugin/gitcommit.vim
parent53caa156b7dfca5b06d74fca9f7b23939298f1b5 (diff)
downloadvim-gitcha-bc4fcb2b082805914d6e87ff38516dbafc5c5538.tar.bz2
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.
Diffstat (limited to 'ftplugin/gitcommit.vim')
-rw-r--r--ftplugin/gitcommit.vim34
1 files changed, 0 insertions, 34 deletions
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 "\<C-x>\<C-u>"
-endfunction
-
-inoremap <expr> <C-x><C-s> StartGitSHACompletion()