In LaTeX, I'm trying to write if \(|x - a| < \delta\) then ... but in math mode, the combination < | is automatically replaced by x \bra{.

I've been editing tex files with neovim for years, and this has only started to happen. How do I identify and disable this mapping?

Based on other posts, I've already tried searching for the key combination using :verbose map and help index but can't find it anywhere in the lists.

  • 4
    My guess is that it is due to a plugin. Anyway, try :verbose imap. It will show the mappings for insert mode.:verbose map will show only the mappings for normal, visual, and operator modes.
    – husB
    Feb 12 at 14:50
  • Thanks. I actually did try that but couldn’t find anything :/
    – akm
    Feb 12 at 20:35

2 Answers 2


It is hard to answer this question, because it is most likely explained by either your own personal configuration or by a plugin that you are using. The behaviour you mention is not caused by VimTeX with default settings. I'll therefore instead reply with a list of possible actions that can help for figuring out what causes your problem.

  • You can inspect :verbose imap. It will show the current insert-mode mappings and where they were defined.

  • You can disable some or all of the plugin bundles you use and check if it helps. Narrow the search by changing which plugin bundles you've disabled. If this is caused by a plugin bundle, then this method can be used to pinpoint which plugin bundle. Most people use a plugin manager today, e.g. vim-plug, so this should be relatively easy to do.

  • You can disable your own configuration. Make sure you are aware of all of it - do you have custom ftplugin/tex.vim files? If so, inspect them.

Speculation: I suspect that the issue may be related to a snippet from e.g. UltiSnips. I don't think it is a default snippet, which means you probably made it or copied it yourself.

  • Thanks. I disabled my personalized settings, but the problem is still occurring. You may be right about it being a snippet. In trying to fix the problem, I see that typing <| is replaced by \bra{} and then typing > turns it into \braket{}{}. A person asking a question at the following link is talking about a package called "braket" but I'm not using it in my TeX file or vim config file: vi.stackexchange.com/questions/24971/…
    – akm
    Feb 13 at 23:34

I figured it out, though am not sure why it started happening, since I hadn't made any changes. In case anyone else has the same problem, I fixed it by editing "plugged/vim-snippets/Ultisnips/tex.snippets". There's a section in the file titled #POSTFIX with the snippets below. I'm not sure why typing <| in math mode was causing a problem, but deleting the following lines fixed it.

snippet "\<(.*?)\|" "bra" Awri
\bra{`!p snip.rv = match.group(1).replace('q', f'\psi').replace('f', f'\phi')`}
snippet "\|(.*?)\>" "ket" Awri
\ket{`!p snip.rv = match.group(1).replace('q', f'\psi').replace('f', f'\phi')`}
  • Glad you found the problem. To help make sense of the first line: "\<(.*?)\|" is a regular expression, and checks if you typed things of the form < ... | . If so, the second line replaces it with \bra{...}. The Ultisnips docs should provide more detail.
    – husB
    Feb 14 at 9:29
  • 1
    Also, I suggest to delete a third snippet here in addition to those two mentioned in your answer. That snippet is responsible for turning \bra{}> into \braket{}{}
    – husB
    Feb 14 at 9:31
  • Thanks. It's unclear to me why UltiSnips would replace |< in LaTeX, since it is common to write "if |x - a| < \delta" etc., but I'll delete it
    – akm
    Feb 14 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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