Mapping UltiSnipsJumpForwardTrigger to <C-H> causes problems with placeholders

Bug #1252091 reported by Hans Chen on 2013-11-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Won't Fix

Bug Description


When UltiSnipsJumpForwardTrigger (same for BackwardTrigger) is set to <C-H> and a placeholder is selected, hitting <C-H> again will delete the placeholder instead of jumping forward (backward).

How to reproduce:

1. Add
let g:UltiSnipsJumpForwardTrigger="<c-h>"
to your .vimrc file.
2. Open a file in vim (filetype should have some snippets defined).
3. Expand a snippet that has some placeholders.
4. Press C-H a few times.

Expected result:

C-H should jump to the next position in the snippet, leaving placeholders unchanged.

Actual result:

C-H jumps to the next position, but if a placeholder is selected, the text will be deleted. Pressing C-H again will jump to the next position.

More details:

I tracked down this issue to plugin/UltiSnips.vim, line 218:

    snoremap <silent> <c-h> <c-g>c

Commenting out this line makes it work as expected. Tested with Konsole (XFree 4 key bindings) and xterm.

SirVer (sirver) wrote :

You'll find that it works as expected in gvim. the reason is that <c-h> is the default escape sequence for backspace in old terminals and therefore terminal emulators do exactly that. Some emulators can be told to pass this control sequences on, but most can't.

Sorry, either use gvim or switch your terminal emulator (no idea which one can be used in linux though, on mac iterm2 should be able to do this).

Changed in ultisnips:
status: New → Invalid
Hans Chen (hanswchen) wrote :

Thanks for the fast reply!

Actually, I get the same problem in gvim. I believe it is due to the mapping "snoremap <silent> <c-h> <c-g>c" in plugin/UltiSnips.vim, since removing that line makes it work fine in terminal vim and gvim (and doesn't seem to affect my backspace).

SirVer (sirver) wrote :

that mapping is only used in select mode mappings. It is needed so that backspacing on a tab deletes it completely. If you can live without this feature, you can remove the line.

To work around the issues, one would need to save and restore the mappings for <c-h>, but I think you are better off using a different jump forward trigger instead.

Changed in ultisnips:
status: Invalid → Incomplete
Hans Chen (hanswchen) wrote :

Got it, I'll simply keep that line commented out to work around the issue.

Launchpad Janitor (janitor) wrote :

[Expired for UltiSnips because there has been no activity for 60 days.]

Changed in ultisnips:
status: Incomplete → Expired
SirVer (sirver) on 2014-01-19
Changed in ultisnips:
status: Expired → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers