Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Break undo only if a snippet gets expanded.

Instead of creating a new undo point always, this gets done now only if
a snippet gets expanded.
This means that "foobarbaz<tab>" won't break undo (with a non-change

See the discussion at
  • Loading branch information...
commit 824f9024c9cb3d330f052a13e0737e05bb65e5ca 1 parent 23f1cb7
@blueyed blueyed authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  after/plugin/snipMate.vim
  2. +1 −0  plugin/snipMate.vim
2  after/plugin/snipMate.vim
@@ -10,7 +10,7 @@ let s:did_snips_mappings = 1
" You can safely adjust these mappings to your preferences (as explained in
" :help snipMate-remap).
-ino <silent> <tab> <c-g>u<c-r>=TriggerSnippet()<cr>
+ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
snor <silent> <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
ino <silent> <s-tab> <c-r>=BackwardsSnippet()<cr>
snor <silent> <s-tab> <esc>i<right><c-r>=BackwardsSnippet()<cr>
1  plugin/snipMate.vim
@@ -83,6 +83,7 @@ fun! TriggerSnippet()
" If word is a trigger for a snippet, delete the trigger & expand
" the snippet.
if snippet != ''
+ let &undolevels = &undolevels " create new undo point
let col = col('.') - len(trigger)
sil exe 's/\V'.escape(trigger, '/\.').'\%#//'
return snipMate#expandSnip(snippet, col)
Please sign in to comment.
Something went wrong with that request. Please try again.