Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I like some of the features provided by the Vim-LaTeX suite, but not all of them.

In particular, I dislike all of the mappings like [[ = \left[ \right] and the automatic placeholder stuff with <++>. I am a very fast typist but with that comes more typing mistakes, which I correct almost instantly by pressing backspace. Unfortunately, if something has automatically added a bunch of place-holders or expanded some expression, I then have to move around the document and remove more characters than necessary. For example, if I accidentally press [ twice, instead of only having to delete one character, I have to delete 10.

Having already looked through the documentation, and some of the source, I have managed to disable some of these "features", but not all of them:

In particular:

let g:Tex_SmartKeyBS = 0
let g:Tex_SmartKeyQuote = 0
let g:Tex_SmartKeyDot = 0

(Turn off maps for backspace, double quote and triple dot.)

let g:Imap_UsePlaceHolders = 0

(Turn off <++> placeholder insertion.)

But I can't seem to find a way of turning off the other stuff. Anyone have any suggestions?

Edit: I was able to "disable" some more things by setting:

let g:Tex_Leader = '`tex'
let g:Tex_Leader2 = ',tex'

(Which stops some expansions but still not all. It's not really disabling it but just making it less likely that you're going to type in `texa as opposed to the potentially more common `a, for example.)

PS: Personally, I think it is very poor practice to make an optional package that, when installed, greatly changes the default handling of your system. I don't mind some intelligent source highlighting etc, or some new commands (that don't clobber any old ones), but it seems unhelpful to enable this drastic kind of key remapping by default.

share|improve this question
2  
I got annoyed by that as well. Too much magic. In the end, I removed vim-latex and installed latex-box+snipMate instead. I have just been using this for a few days, but so far I am more than happy. –  Daniel Jul 4 '12 at 6:39
    
Thanks Daniel, I'm giving latex-box a shot now. Seems okay so far, with some nice completion features that don't get in the way. –  codebeard Jul 4 '12 at 15:08
1  
Hey @Daniel -- I'm liking latex-box so far. One thing I changed though was the indenting code because that was a bit broken. In ftplugin/latex-box/indent.vim, change line 11 to this for much more sensible settings: setlocal indentkeys=0=\\end,0=\\end{enumerate},0=\\end{itemize},0=\\item,0),0],0},o,O,0\\ –  codebeard Jul 7 '12 at 16:31
2  
Probably not what you want, but if you execute command :set paste, then all special mappings are disabled, and also the automatic indentation, etc. It is intended for use when you are pasting properly formatted code from elsewhere, but it can be also handy in other cases. –  JLDiaz Jul 7 '12 at 19:42
    
@JLDiaz Yeah, I often use :set paste for pasting code. I like automatic indenting, but yeah it's good to know that I can turn on paste if I'm entering text with strange side-effects (for example, after changing catcodes). –  codebeard Jul 7 '12 at 23:54

3 Answers 3

Side note for anyone who ends up here looking for the same thing I am:

To disable specific IMAPs, add trivial IMAP commands to the file ~/.vim/after/ftplugin/tex.vim (you may have to create it if it does not exist). For instance,

" Undo stupid latex-suite macros
call IMAP('()', '()', 'tex')
call IMAP('{}', '{}', 'tex')
call IMAP('[]', '[]', 'tex')
call IMAP('::', '::', 'tex')
call IMAP('{{', '{{', 'tex')
call IMAP('((', '((', 'tex')
call IMAP('[[', '[[', 'tex')
call IMAP('$$', '$$', 'tex')
share|improve this answer

I put let g:Imap_FreezeImap=1 in my .vimrc. It should disable all of this annoying “magic”.

share|improve this answer
    
If that worked, it would be a great solution. Unfortunately, even if I add this, vim-latex still makes dozens of mappings (just check :map and :imap ). In fact, it even makes mappings when you're editing non-.tex files. But yes, this does certainly remove some of the more annoying maps. However, I'm pretty happy to use latex-box for the foreseeable future so I uninstalled vim-latex. –  codebeard Jul 14 '12 at 17:25

It should really not be the case, that the tex mappings are enabled for all files. So either you need to update your vim-latex or change a configuration option there.

I had the same problem with expansion like [[ ~> \left[ <++> \right]<++>. It always took to long to undo any errors, because normal undo will remove too much. So I found that you can insert undo marks with ^Gu (literal Ctrl-G u) before the replacement. This way whenever I type [[ by mistake or even want a literal [[, I just press the <undo> key and then only the [[ is left.

See also my question on SO, where I asked for the way to get the <undo> key in insert mode.

To automatically insert the undo mark, you need to change the imap.vim file of vim-latex and at the end of the LookupCharacter function, change the return line to

return a:char . "^Gu\<bs>" . bs . IMAP_PutTextWithMovement(rhs, phs, phe)

Notice that in order to write ^G you have to type Ctrl-V Ctrl-G, only copy-paste will not suffice here.

I send this change as a suggestion to the vim-latex mailing list, but unfortunately there doesn't seem to be an active maintainer...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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