Skip to content

Commit

Permalink
Create undo point before expanding snippet in insert mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
henrik authored and garbas committed Feb 3, 2011
1 parent dbd8dd5 commit 73a7255
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion after/plugin/snipMate.vim
Expand Up @@ -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-r>=TriggerSnippet()<cr>
ino <silent> <tab> <c-g>u<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>
Expand Down

7 comments on commit 73a7255

@blueyed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create an undo point always, not just when a snippet gets expanded.

When trying to use an undefined snippet for example (which won't expand to anything) this will cause undo breakpoints that have changed nothing.

Can you insert the undo breakpoint only if something was changed? I was thinking about doing it in snipMate#expandSnip.

@MarcWeber
Copy link
Owner

@MarcWeber MarcWeber commented on 73a7255 Apr 23, 2011 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henrik
Copy link
Author

@henrik henrik commented on 73a7255 Apr 23, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BlueEyed Good catch. I've been using this for months now and have never noticed any issues in practice, so I don't think I will bother to look into it either, but I would be interested to see that fix if you do it.

@MarcWeber
Copy link
Owner

@MarcWeber MarcWeber commented on 73a7255 Apr 24, 2011 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blueyed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcWeber: I do not want to drop the feature altogether, just only create the undo point if there are any changes.
I was thinking about executing "u" in snipMate#expandSnip somewhere before any expansion will happen, instead of within the mapping.

@MarcWeber
Copy link
Owner

@MarcWeber MarcWeber commented on 73a7255 Apr 24, 2011 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blueyed
Copy link
Collaborator

@blueyed blueyed commented on 73a7255 Apr 25, 2011 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.