Hello,
> Suppose that I open 3 .R files with "gvim -o". All the three .R files
> are correctly syntax highlighted. However, if I use :bd to close one
> window, the next window's syntax highlight will be gone.
-- <snip> --
I had the same rescently.
:set hidden
fixed it for me.
> Regards,
> Peng
Regards,
--
bye Thilo
4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F
This works. Thank you!
--
Regards,
Peng
-- <snip> --
> I'm glad it works, but something is wrong here.
>
> Syntax highlight is local to a buffer. If you have 3 separate buffers
> opened in 3 separate Windows, deleting one buffer (and closing its
> window) should have no effect on the other buffers/windows.
I suspected that but haven't had time nor enough motivation to dig deeper into
that. But i had quick look some minutes ago and i can tell, that a plugin
probably has to be blaimed. Without plugins an 'nohidden' set the syntax does
not disapeare anymore.
I will try to nail it down to the faulty one.
--
Regards,
Hello
> -- <snip> --
>
>> I'm glad it works, but something is wrong here.
>>
>> Syntax highlight is local to a buffer. If you have 3 separate buffers
>> opened in 3 separate Windows, deleting one buffer (and closing its
>> window) should have no effect on the other buffers/windows.
>
> I suspected that but haven't had time nor enough motivation to dig deeper into
> that. But i had quick look some minutes ago and i can tell, that a plugin
> probably has to be blaimed. Without plugins an 'nohidden' set the syntax does
> not disapeare anymore.
> I will try to nail it down to the faulty one.
It seems tabbar.vim is involved, though i haven't currently figured how. Peng do
you also have tabbar.vim installed?
No. I have the following packages installed. Does anybody know which
one might cause the problem?
~/.vim$ find . -type f
./after/syntax/r.vim
./after/syntax/.sh.vim
./after/filetype.vim
./bitmaps/rstart.xpm
./bitmaps/rfunction.xpm
./bitmaps/rbuffer.xpm
./bitmaps/rcomplete.xpm
./bitmaps/rline.xpm
./bitmaps/rregion.xpm
./bitmaps/RSendFile.png
./bitmaps/RListSpace.png
./bitmaps/RClear.png
./bitmaps/RClearAll.bmp
./bitmaps/RClose.png
./bitmaps/RSendFile.bmp
./bitmaps/RSendSelection.png
./bitmaps/r-control-clearall.png
./bitmaps/r-control-clear.png
./bitmaps/r-control-listspace.png
./bitmaps/r-send-line.png
./bitmaps/r-send-selection.png
./bitmaps/r-send-paragraph.png
./bitmaps/r-send-function.png
./bitmaps/r-send-block.png
./bitmaps/r-send-file.png
./bitmaps/r-close.xpm
./bitmaps/r-start.xpm
./bitmaps/ricon.png
./bitmaps/ricon.xbm
./bitmaps/RSendLine.bmp
./bitmaps/RSendParagraph.bmp
./bitmaps/RSendSelection.bmp
./bitmaps/RStart.bmp
./bitmaps/RStart.png
./bitmaps/RListSpace.bmp
./bitmaps/RSendFunction.bmp
./bitmaps/RSendParagraph.png
./bitmaps/RSendLine.png
./bitmaps/RSendFunction.png
./bitmaps/RSendBlock.png
./bitmaps/RClearAll.png
./bitmaps/RClear.bmp
./bitmaps/RClose.bmp
./bitmaps/RSendBlock.bmp
./ftplugin/python.vim
./ftplugin/rnoweb.vim
./ftplugin/rhelp.vim
./ftplugin/r.vim
./ftplugin/perl.vim
./ftplugin/perl6.vim
./ftplugin/xs.vim
./ftplugin/csv.vim
./ftplugin/rbrowser.vim
./ftplugin/rdoc.vim
./ftplugin/bib_latexSuite.vim
./ftplugin/tex_latexSuite.vim
./ftplugin/latex-suite/dictionaries/dictionary
./ftplugin/latex-suite/dictionaries/SIunits
./ftplugin/latex-suite/bibtex.vim
./ftplugin/latex-suite/bibtools.py
./ftplugin/latex-suite/bibtools.pyc
./ftplugin/latex-suite/brackets.vim
./ftplugin/latex-suite/compiler.vim
./ftplugin/latex-suite/custommacros.vim
./ftplugin/latex-suite/diacritics.vim
./ftplugin/latex-suite/macros/example
./ftplugin/latex-suite/packages/accents
./ftplugin/latex-suite/packages/acromake
./ftplugin/latex-suite/packages/afterpage
./ftplugin/latex-suite/packages/alltt
./ftplugin/latex-suite/packages/amsmath
./ftplugin/latex-suite/packages/amsthm
./ftplugin/latex-suite/packages/amsxtra
./ftplugin/latex-suite/packages/arabic
./ftplugin/latex-suite/packages/array
./ftplugin/latex-suite/packages/babel
./ftplugin/latex-suite/packages/bar
./ftplugin/latex-suite/packages/biblatex
./ftplugin/latex-suite/packages/bm
./ftplugin/latex-suite/packages/bophook
./ftplugin/latex-suite/packages/boxedminipage
./ftplugin/latex-suite/packages/caption2
./ftplugin/latex-suite/packages/cases
./ftplugin/latex-suite/packages/ccaption
./ftplugin/latex-suite/packages/changebar
./ftplugin/latex-suite/packages/chapterbib
./ftplugin/latex-suite/packages/cite
./ftplugin/latex-suite/packages/color
./ftplugin/latex-suite/packages/comma
./ftplugin/latex-suite/packages/csquotes
./ftplugin/latex-suite/packages/deleq
./ftplugin/latex-suite/packages/drftcite
./ftplugin/latex-suite/packages/dropping
./ftplugin/latex-suite/packages/enumerate
./ftplugin/latex-suite/packages/eqlist
./ftplugin/latex-suite/packages/eqparbox
./ftplugin/latex-suite/packages/everyshi
./ftplugin/latex-suite/packages/exmpl
./ftplugin/latex-suite/packages/fixme
./ftplugin/latex-suite/packages/flafter
./ftplugin/latex-suite/packages/float
./ftplugin/latex-suite/packages/floatflt
./ftplugin/latex-suite/packages/fn2end
./ftplugin/latex-suite/packages/footmisc
./ftplugin/latex-suite/packages/geometry
./ftplugin/latex-suite/packages/german
./ftplugin/latex-suite/packages/graphicx
./ftplugin/latex-suite/packages/graphpap
./ftplugin/latex-suite/packages/harpoon
./ftplugin/latex-suite/packages/hhline
./ftplugin/latex-suite/packages/histogram
./ftplugin/latex-suite/packages/hyperref
./ftplugin/latex-suite/packages/ifthen
./ftplugin/latex-suite/packages/inputenc
./ftplugin/latex-suite/packages/letterspace
./ftplugin/latex-suite/packages/lineno
./ftplugin/latex-suite/packages/longtable
./ftplugin/latex-suite/packages/lscape
./ftplugin/latex-suite/packages/manyfoot
./ftplugin/latex-suite/packages/moreverb
./ftplugin/latex-suite/packages/multibox
./ftplugin/latex-suite/packages/multicol
./ftplugin/latex-suite/packages/newalg
./ftplugin/latex-suite/packages/ngerman
./ftplugin/latex-suite/packages/numprint
./ftplugin/latex-suite/packages/oldstyle
./ftplugin/latex-suite/packages/outliner
./ftplugin/latex-suite/packages/overcite
./ftplugin/latex-suite/packages/pagenote
./ftplugin/latex-suite/packages/parallel
./ftplugin/latex-suite/packages/plain
./ftplugin/latex-suite/packages/plates
./ftplugin/latex-suite/packages/polski
./ftplugin/latex-suite/packages/psgo
./ftplugin/latex-suite/packages/schedule
./ftplugin/latex-suite/packages/SIunits
./ftplugin/latex-suite/packages/textfit
./ftplugin/latex-suite/packages/times
./ftplugin/latex-suite/packages/tipa
./ftplugin/latex-suite/packages/ulem
./ftplugin/latex-suite/packages/url
./ftplugin/latex-suite/packages/verbatim
./ftplugin/latex-suite/packages/version
./ftplugin/latex-suite/templates/article.tex
./ftplugin/latex-suite/templates/IEEEtran.tex
./ftplugin/latex-suite/templates/report.tex
./ftplugin/latex-suite/templates/report_two_column.tex
./ftplugin/latex-suite/elementmacros.vim
./ftplugin/latex-suite/envmacros.vim
./ftplugin/latex-suite/folding.vim
./ftplugin/latex-suite/main.vim
./ftplugin/latex-suite/mathmacros-utf.vim
./ftplugin/latex-suite/mathmacros.vim
./ftplugin/latex-suite/multicompile.vim
./ftplugin/latex-suite/outline.py
./ftplugin/latex-suite/outline.pyc
./ftplugin/latex-suite/packages.vim
./ftplugin/latex-suite/projecttemplate.vim
./ftplugin/latex-suite/pytools.py
./ftplugin/latex-suite/smartspace.vim
./ftplugin/latex-suite/templates.vim
./ftplugin/latex-suite/texmenuconf.vim
./ftplugin/latex-suite/texproject.vim
./ftplugin/latex-suite/texrc
./ftplugin/latex-suite/texviewer.vim
./ftplugin/latex-suite/version.vim
./ftplugin/latex-suite/wizardfuncs.vim
./ftplugin/xml.vim
./tools/rtags
./tools/rfunctions
./tools/rpager.sh
./tools/rvimsource.R
./tools/rvimplot.R
./tools/rtags.R
./tools/rargs.R
./.VimballRecord
./autoload/rcomplete.vim
./autoload/dbext_dbi.vim
./autoload/sqlcomplete.vim
./autoload/dbext.vim
./tags/python.ctags
./Makefile
./indent/python.vim
./indent/r.vim
./indent/html.vim
./indent/perl.vim
./indent/perl6.vim
./indent/rhelp.vim
./indent/rnoweb.vim
./indent/javascript.vim
./indent/tex.vim
./indent/IndentAnything_html.vim
./indent/xml.vim
./.session
./plugin/pydoc.vim
./plugin/LargeFile.vim
./plugin/a.vim
./plugin/head.vim
./plugin/matchit.vim
./plugin/SyntaxFolds.vim
./plugin/filebrowser.vim
./plugin/imaps.vim
./plugin/libList.vim
./plugin/remoteOpen.vim
./plugin/IndentAnything.vim
./plugin/dbext.vim
./plugin/test/IndentAnything/test.js
./doc/tags
./doc/LargeFile.txt
./doc/r-plugin.txt
./doc/ft-csv.txt
./doc/matchit.txt
./doc/IndentAnything.txt
./doc/dbext_gpl.dat
./doc/xml-plugin.txt
./doc/Makefile.in
./doc/README
./doc/README.new
./doc/catalog.xml
./doc/imaps.txt
./doc/latex-suite-chunk.xsl
./doc/latex-suite-common.xsl
./doc/latex-suite-quickstart.css
./doc/latex-suite-quickstart.txt
./doc/latex-suite-quickstart.xml
./doc/latex-suite.css
./doc/latex-suite.xsl
./doc/latexhelp.txt
./doc/latex-suite.txt
./doc/latex-suite.xml
./doc/dbext.txt
./syntax/python.vim
./syntax/r.vim
./syntax/rout.vim
./syntax/scons.vim
./syntax/perl.vim
./syntax/perl6.vim
./syntax/pod.vim
./syntax/tt2.vim
./syntax/tt2html.vim
./syntax/xs.vim
./syntax/csv.vim
./syntax/rbrowser.vim
./syntax/rdoc.vim
./syntax/rhelp.vim
./syntax/json.vim
./compiler/scons.vim
./compiler/tex.vim
./ftdetect/csv.vim
./ftdetect/r.vim
./ftdetect/json.vim
./r-plugin/build_omniList.R
./r-plugin/common_buffer.vim
./r-plugin/common_global.vim
./r-plugin/etags2ctags.R
./r-plugin/functions.vim
./r-plugin/global_r_plugin.vim
./r-plugin/omniList
./r-plugin/r.snippets
./r-plugin/screenrc
./r-plugin/specialfuns.R
./r-plugin/tex_indent.vim
./r-plugin/tmux.conf
./r-plugin/vimActivate.js
./r-plugin/vimbrowser.R
./r-plugin/vimhelp.R
./r-plugin/vimprint.R
./r-plugin/vimSweave.R
./r-plugin/windows.py
./.netrwhist
--
Regards,
Peng
Hello
-- <snip> --
>>>> I'm glad it works, but something is wrong here.
-- <snip> --
>> It seems tabbar.vim is involved, though i haven't currently figured how. Peng do
>> you also have tabbar.vim installed?
>
> No. I have the following packages installed. Does anybody know which
> one might cause the problem?
-- <snip> --
hmm it seems we do not have any plugins in commen. Though i can reproducible get
the error if i have 'set nohidden' and tabbar.vim, then open one file
'vim foo' and an other ':e bar' then ':bd'.
I have noticed not all buffers get syntax turned off, but instead if you have
three, or four files open it is reproducible the last but one that get turned
off and that even with ':echo syntax_on' = 1 in that buffer. And if you have
some other files open and switch between them syntax highlighting is turned on
again in the buffer when switching back.
Tabbar.vim has a comment saying:
,----[ tabbar.vim ]--------
" VIM sometimes turns syntax highlighting off,
" we can force it on, but this may cause weird
" behavior so this is an optional hack to force
" syntax back on when we enter a buffer
if g:Tb_ForceSyntaxEnable
if g:Tb_DBG_LVL > 0
call <SID>DEBUG('Tb_AutoUpdt: Enable Syntax', 9)
endif
exec 'syntax enable'
endif
`---------------------------------------------
This is with vim 7.2.445.
Can someone test with a up to date vim to see if it happens there, too?
I've checked tabbar.vim, v0.7, vimscript #1338.
Reason for missing syntax highlighting (no bug in Vim): autocommands are
not called recursively per default
:h autocmd-nested
tabbar executes :bn! within a BufEnter autocmd (BufEnter without
"nested" argument). Thus :bn! can't trigger further autocommands.
But with 'nohidden', buffers are unloaded when they are not shown in a
window. :bn! needs to execute BufRead autocommands for syntax/ftplugin
stuff (just like with :edit) when it creates the first window for a
buffer.
--
Andy
Hello Andy,
-- <snip> --
> Reason for missing syntax highlighting (no bug in Vim): autocommands are
> not called recursively per default
> :h autocmd-nested
-- <snip> --
Thank you Andy. It is working now!
Peng maybe you should also check, if there are any 'autocmd' definitions in
those r related vim files. There are quite a few in your profile though.
If you want to know how to use the 'nested' flag look at:
':h autocmd-define'
> Andy Wokula wrote the following on 15.11.2011 22:16
>
> Hello Andy,
>
> -- <snip> --
>> Reason for missing syntax highlighting (no bug in Vim): autocommands are
>> not called recursively per default
>> :h autocmd-nested
> -- <snip> --
>
> Thank you Andy. It is working now!
..but now yankring.vim stopped working:
Error detected while processing function
<SNR>26_YRWindowActionN..<SNR>26_YRWindowAction..<SNR>26_YRGetElem:
line 56:
E21: Cannot make changes, 'modifiable' is off
Press ENTER or type command to continue
...oh well.. :/
Not sure about the fix ... adding "nested" seems risky. Odd enough that
tabbar executes :bn within a BufEnter autocmd ...
Just wanted to make sure this issue is not related to the "Buffer
unloading bug" (vim_dev).
--
Andy
-- <snip> --
> Not sure about the fix ... adding "nested" seems risky. Odd enough that
> tabbar executes :bn within a BufEnter autocmd ...
>
> Just wanted to make sure this issue is not related to the "Buffer
> unloading bug" (vim_dev).
ic. Thanks again for finding the root cause.