0

The question

When editing TeX files (to do so, I use vimtex) if I've discovered that if I write lll in insert mode, I get \ell.

How do I find why this is happening?

My research

I thought "ok, I'll find out where this mapping or abbreviation is and whther vimtex or something else creates it".

I've checked :ab lll and all :*map lll, and the culprit turns out to be lmap, as the output of :verbose lmap lll is the following:

Kitty keyboard protocol: Cleared
l  l           * L
        Last set from ~/.vimrc line 654

And that line is where the following function is defined,

for c in range(char2nr('A'), char2nr('Z'))
    exe 'lnoremap ' . nr2char(c+32) . ' ' . nr2char(c)
    exe 'lnoremap ' . nr2char(c) . ' ' . nr2char(c+32)
endfor

which I took from here eons ago (and which comes with autocmd InsertLeave * set iminsert=0 too).

But how is that causing the behavior I described above? And why only when filetype is tex???

Well the answer is that it is not, because if I delete that stuff the issue persists. After all, the output of :verbose lmap lll is not really telling me that lll is mapped to anything. Just that l is, and that's ok. Indeed, deleting the for loop above, :verbose lmap lll too gives no result.

So I'm left with :ab lll and all of :*map lll giving no output.

Where does this behavior come from?

1

1 Answer 1

0

I had forgotten about this. However, yes, it's vim-snippets's UltiSnips snippet for TeX.

snippet lll "l" Aw
\ell
endsnippet

Eventually, I pushed a fix.

3
  • 1
    Thanks for the feedback :-) Jan 15, 2023 at 13:14
  • 1
    @Enlicc Maybe could you accept your own answer (you can do that two days after you post the answer). This will make the question rest :-) Feb 14, 2023 at 13:41
  • 1
    @VivianDeSmedt, thanks. I've linked the fix I pused to the repo.
    – Enlico
    Feb 14, 2023 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.