Closed xsrvmy closed 2 years ago
So, the selection of a tabstop moves Vim into select-mode (see help select-mode
) which is neither insert nor visual mode and uses different keymaps, so your imap
is not defined in that case. You might be able to make your imaps also smap
or xmap
s, but I doubt that this is really feasible in your case. I do not have a good suggestion on how to handle your use case, it seems a weird combination of limitations of UltiSnips + Limitations of Vim + Limitations of vimtex combined.....
@xsrvmy Did you figure something out for this?
I switched to using \(\)
in vimtex so this isn't a problem anymore.
Using an imap keymapping will remove the placeholder when the first key is pressed.
Expected behavior: Placeholder is cleared only after imap executes, and only if the command types text in insert mode.
Actual behavior: Placeholder is cleared on first keystroke.
Steps to reproduce First use case: Consider a snippet like this:
while (${1:true}) {$0}
. If I havejk
mapped to escape, then hittingjk
to escape will clear thetrue
inside the snippets, so only escape works here.Second use case (my use case): Consider this snippet:
$${1: }$
, which enters math mode in latex. Here the default space prevents the lexer from interpreting$$
as entering display math, which would mess up syntax highlighting and conceal. If I immediately type`a
after this snippet to enter an alpha, the first backtick clears the placeholder which negates the benefit of the extra space. To be clear, the placeholder should still be cleared in this case, but only because the result of the imap is to input characters.Note:
`a
is a vimtex-defined imap from`a
to\alpha
(or in my case, a unicode alpha).imap
andinoremap
doesn't make a difference.