On 2015-10-21, glts wrote:
> On Tuesday, October 20, 2015 at 8:47:27 PM UTC+2, ZyX wrote:
> > 2015-10-20 21:11 GMT+03:00 glts <676c7...@gmail.com>:
> > > In a plain Vim installation, if I have a personal ftplugin
> > > ~/.vim/ftplugin/text.vim that contains the line
> > >
> > >         setlocal expandtab
> > 
> > This file is missing `b:undo_ftplugin` variable, see :h undo_ftplugin.
> > Examples are in every or nearly every ftplugin file in default
> > distribution.
> 
> That does mean that the information in the user manual at ":h 43.1" is
> incorrect, though -- or at least incomplete. The example in the user
> manual has just a setting and a mapping, and no undo boilerplate.
> 
> In fact, I get the feeling I'm back to square one regarding personal
> filetype settings -- is there at all a robust way to tweak settings for
> some filetype and have them undone properly after another :setfiletype?
> 
> This belongs in vim_use, but documentation could be more accurate. And
> the original request still stands.

I assume that you added the setting of b:undo_ftplugin to your
~/.vim/ftplugin/text.vim and you are still seeing 'expandtab' set in
help files.

The problem is that b:undo_ftplugin is also being set in
$VIMRUNTIME/ftplugin/text.vim and since that file is sourced after
your ~/.vim/ftplugin/text.vim, its setting is overriding yours.

The solution is to put your text.vim file into ~/.vim/after/ftplugin
so that it is sourced after $VIMRUNTIME/ftplugin/text.vim and than
add the following to your text.vim:

    if exists("b:undo_ftplugin")
        let b:undo_ftplugin .= " | setlocal expandtab<"
    else
        let b:undo_ftplugin = "setlocal expandtab<"
    endif

Yes, the documentation should be updated.

Regards,
Gary

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to