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