On May 12, 6:55 am, Andy Wokula <[email protected]> wrote:

>
> I found that  :setf {ft-name}  does nothing when auto-reloading a file
> (intentionally I guess), so
>
>    :au FileType text setl wrap
>
> works better for me.  And it somehow looks better anyway ...
>
> Of course you need to define the filetype "text".
>
> In other words ...
>
> Setting a window-local option from a buffer-event like BufRead does not
> look right ... and Vim indeed has some separation:
>
>     BufRead event -> FileType event
>
> BufRead: buffer must match
> FileType: buffer + buffer's window must be current, else FileType event
>           is not fired
>

Your method does not seem to work for me. My simple test case may be
too simple. From the vim_use email:

> My actual situation is more complicated. The :setlocal wrap is not in
> an autocmd, but rather in $HOME/vimfiles/ftplugin/txt.vim, detected by
> file extension in $HOME/vimfiles/ftdetect/txt.vim with the following
> command:
>
> au BufNewFile,BufRead *.t{e,}xt,*.log,*.csv,*.err set filetype=txt

This is the case in which I originally observed the behavior.

When I remove the setlocal wrap from the ftplugin file, and add an
FileType autocmd to do the same, I get the same results.

It was always my understanding that the ftplugin files only got
sourced during application of a filetype, which also fires off the
FileType event. Am I missing something? Or perhaps I'm setting the
filetype in a strange manner?

I think I can use a combination of <afile> and setbufvar() in an
autocmd, if the ftplugin route doesn't work.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui