I've found some older posts here that discuss the difficulty with mapping the <C-j> shortcut in vim, i.e.
map <C-j> <C-w>j
due to latex-suite's usage of <C-j> to jump forward in the text. I'm in a similar situation, but I would like to keep latex-suite's normal shortcuts for when editing tex files, and only use the new mapping when editing non-tex files. I'm a little confused by why this isn't the default behavior - latex-suite's <C-j> shortcut shows up as a shortcut in the :map output even when I don't have a tex file loaded and other shortcuts (like `a mapping to \alpha) don't work. Am I understanding correctly that unlike most of latex-suite's shortcuts, this <C-j> shortcut from latex-suite gets loaded regardless of filetype for some reason? And if so, how do I make it so that it only gets loaded for tex files, so that I can use other <C-j> mappings for non-tex files?
The only sane solution would be for the maintainers of that plugin to move all their filetype-specific mappings to an ftplugin, where they belong. The way they currently implement them is a silly mix of good practices (
<Plug>) and bad practices (global filetype-specific mappings), all in a single script underplugin/. This is very bad.What they currently do:
:help <Plug>mappings as much as possible in order to allow users to write their own mappings easily.IMAP_JumpForwardshould be in parentheses, though.:help hasmapto()guard is pointless.plugin/imaps.vimis a "global plugin". As such, whatever it does that is not explicitly scoped to a buffer or a window is done for every buffer and window. That<C-j>mapping only makes sense…texfiles, when using that latex-suite plugin,imaps.vimplugin elsewhere.What they should do:
Frankly, the way that thing is designed should raise all kinds of red flags. I don't do (la)tex at all but https://github.com/lervag/vimtex seems more competently done.