This simple test case demonstrates my problem:
vim -u NONE -N -i NONE
:autocmd BufRead *.txt setlocal wrap
:view test.txt
:tabe test.c
:setlocal nowrap
Now modify test.txt outside of Vim and give focus back to Vim to
trigger a reload of test.txt.
Vim is still in the test.c tab, so when the BufRead autocmd fires,
'wrap' is set for test.c instead of test.txt.
I'm not sure whether this is supposed to happen or not...if someone
could point me to the proper help section that describes this
behavior, that would be great. It is fairly unexpected, but I doubt it
is a bug.
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
I think I should be able to find a way to use <afile> to find the
correct buffer using an autocmd separate from the filetype plugin, but
I'd rather get something working with the plugin file instead. Does
anyone have an idea of how to do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---