aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2019-02-25 18:23:40 +0900
committerGitHub <noreply@github.com>2019-02-25 18:23:40 +0900
commite5848c2375d2b470685d39bfdb9c0227e39411bf (patch)
treebf79366b1f2a4028e0cf18e702f6225823c342e2
parentf6571375fd13cafe9e060103795db93a956cfaf6 (diff)
parentf339748675727d8c31353671906e0872db39446e (diff)
downloadvim-sonictemplate-e5848c2375d2b470685d39bfdb9c0227e39411bf.tar.gz
vim-sonictemplate-e5848c2375d2b470685d39bfdb9c0227e39411bf.tar.bz2
vim-sonictemplate-e5848c2375d2b470685d39bfdb9c0227e39411bf.zip
Merge pull request #29 from mityu/master
Fix command completion on command-line window.
-rw-r--r--autoload/sonictemplate.vim14
1 files changed, 12 insertions, 2 deletions
diff --git a/autoload/sonictemplate.vim b/autoload/sonictemplate.vim
index cbadd45..2c68664 100644
--- a/autoload/sonictemplate.vim
+++ b/autoload/sonictemplate.vim
@@ -1,7 +1,7 @@
"=============================================================================
" sonictemplate.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 03-Sep-2013.
+" Last Change: 25-Feb-2019.
let s:save_cpo = &cpo
set cpo&vim
@@ -55,7 +55,17 @@ endfunction
function! s:get_candidate(fts, lead)
let fts = a:fts
let filter = ''
- let prefix = search('[^ \t]', 'wn') ? 'snip' : 'base'
+ if getcmdwintype() ==# ''
+ let prefix = search('[^ \t]', 'wn') ? 'snip' : 'base'
+ else
+ let prefix = 'base'
+ for line in getbufline(bufnr('#'), 1, '$')
+ if match(line, '[^ \t]') != -1
+ let prefix = 'snip'
+ break
+ endif
+ endfor
+ endif
try
let ft = s:get_filetype()
let cxt = sonictemplate#lang#{ft!=""?ft:"_"}#guess()