mirror of
https://github.com/gryf/snipmate.vim.git
synced 2025-12-23 22:52:27 +01:00
fixed bug with cancelling multi-snippet
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
" File: snipMate.vim
|
||||
" Author: Michael Sanders
|
||||
" Version: 0.8
|
||||
" Version: 0.81
|
||||
" Description: snipMate.vim implements some of TextMate's snippets features in
|
||||
" Vim. A snippet is a piece of often-typed text that you can
|
||||
" insert into your document using a trigger word followed by a "<tab>".
|
||||
@@ -77,7 +77,7 @@ fun! ExtractSnipsFile(file, ft)
|
||||
let inSnip = 0
|
||||
endif
|
||||
|
||||
if stridx(line, 'snippet') == 0
|
||||
if line[:6] == 'snippet'
|
||||
let inSnip = 1
|
||||
let trigger = strpart(line, 8)
|
||||
let name = ''
|
||||
@@ -143,7 +143,7 @@ fun! TriggerSnippet()
|
||||
let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
|
||||
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
|
||||
let [trigger, snippet] = s:GetSnippet(word, scope)
|
||||
" If word is a trigger for a snippet, delete the trigger & expand
|
||||
" If word is a trigger for a snippet, delete the trigger & expand
|
||||
" the snippet.
|
||||
if snippet != ''
|
||||
let col = col('.') - len(trigger)
|
||||
@@ -168,6 +168,7 @@ fun s:GetSnippet(word, scope)
|
||||
let snippet = s:snippets[a:scope][word]
|
||||
elseif exists('s:multi_snips["'.a:scope.'"]["'.escape(word, '\"').'"]')
|
||||
let snippet = s:ChooseSnippet(a:scope, word)
|
||||
if snippet == '' | break | endif
|
||||
else
|
||||
if match(word, '\W') == -1 | break | endif
|
||||
let word = substitute(word, '.\{-}\W', '', '')
|
||||
|
||||
Reference in New Issue
Block a user