Obsolete tip
This tip has been merged into another tip.
See VimTip330 for the current tip.
Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip330.
created November 7, 2005 · complexity basic · author Yakov Lerner · version 6.0
The 'set paste' command disables autoindenting, but the downside is that imaps (insertion-mode maps) do not work.
I needed imaps to work and autoindenting disabled, together.
This means I had to disable all autoindenting and 'set nopaste'. This combination turned out surprisingly difficult to grok. Finally I found the 6 relevant options, and the proper autocommand to resist persistent attempts of filetype-scripts to turn autoindenting on.
Here is the solution that finally worked for me:
" Begin disable-autoindent-with-nopaste stuff set noai noautoindent nocin nocindent nosi nosmartindent nopaste au BufWinEnter * :set noci nocindent indentexpr= indentkeys= map \a :call ShowAutoIndent()<CR> fu! ShowAutoIndent() 20verbose set ai? cin? si? paste? indentexpr? indentkeys? endfu
If indenting is still not disabled, you can diagnose the problem using \a, or :call ShowAutoIndent()<CR>. This will show you which script turned autoindenting back on. The 'correct' output (all autoindenting disabled) should look like this:
noautoindent nocindent nosmartindent nopaste indentexpr= indentkeys=