diff --git a/autoload/snipMate.vim b/autoload/snipMate.vim index 74366fa8..d3d39cc5 100644 --- a/autoload/snipMate.vim +++ b/autoload/snipMate.vim @@ -196,9 +196,12 @@ fun! snipMate#ReadSnippetsFile(file) abort if line[:6] == 'snippet' let inSnip = 1 let bang = (line[7] == '!') - if bang + if bang "!! let bang += line[8] == '!' endif + if bang "!!! + let bang += line[9] == '!' + endif let trigger = strpart(line, 8 + bang) let name = '' let space = stridx(trigger, ' ') + 1 @@ -314,7 +317,13 @@ endfunction function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) abort let d = a:dict - if a:bang == 2 + if a:bang == 3 + unlet! d[a:trigger][a:path] + if len(d[a:trigger]) == 0 + unlet! d[a:trigger] + endif + return + elseif a:bang == 2 unlet! d[a:trigger] return elseif !has_key(d, a:trigger) || a:bang == 1 diff --git a/doc/SnipMate.txt b/doc/SnipMate.txt index 230fe686..e4b2c27d 100644 --- a/doc/SnipMate.txt +++ b/doc/SnipMate.txt @@ -255,6 +255,9 @@ overridden on a per-snippet basis by defining the snippet with a bang (!): > Two bangs will remove the trigger entirely from SnipMate's lookup. In this case any snippet text is unused. +Three bangs will remove the trigger from the current scope. In this +case any snippet text is unused. + Note: Hard tabs in the expansion text are required. When the snippet is expanded in the text and 'expandtab' is set, each tab will be replaced with spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise.