66610Re: Does b:undo_ftplugin actually work?
- Oct 1, 2012On 2012-09-28, ZyX wrote:
> > I'm just looking for a way to reset those local options when I editHere is the current solution, which has been working fine so far
> > a new file, b:undo_ftplugin seemed to be the way to do it, but it
> > doesn't seem to do anything useful.
> > Not using :edit is not a solution. For example, if I start vim
> > and use ":MRU" to open a recently-used C file, I wind up with
> > 'indentexpr' set as above, which wrongly indents C.
> Unset 'indentoptions' on any filetype event, adding definition of
> needed autocommand somewhere at the beginning of the vimrc (as it
> is the first file sourced), definitely before “filetype plugin
> indent on” or similar command, it should not interfere with
> ftplugins then. Use 'autoindent' instead of your 'indentexpr', it
> is here just for that reason.
today. (I explained in a separate post how 'autoindent' does not
behave the same as this 'indentexpr'.)
au BufWinEnter * if &ft == "" || &ft == "text"
\ | setlocal indentexpr=indent(prevnonblank(v:lnum-1))
\ | setlocal indentkeys-=o
\ | let b:undo_indent = "setlocal indentexpr< indentkeys<"
\ | endif
au FileType * setlocal indentexpr< indentkeys<
Thanks for your help.
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>