Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim syntax off when one buffer quit?

Tags:

vim

I have two buffers in my vim session, and I set syntax on in my vimrc , I used minibufexpl to manage bufs.

I used :q to quit the current buf, but the other buf would auto set the syntax off, I have to use :set syntax=on to open the syntax highlight manually. Could someone give me a solution that not set the syntax off automatic after one buf quit? Thanks!! (I tried :bd to quit the buf instead of :q, sometimes it stay the syntax on but sometimes no).

like image 738
Alpha Liu Avatar asked Apr 27 '12 01:04

Alpha Liu


2 Answers

If you're using minibufexpl.vim, add the following to your .vimrc:

let g:miniBufExplForceSyntaxEnable = 1

It appears to be caused by a bug in vim. For the details, refer to the release notes for minibufexpl version 6.3.1

Note that this will work for :bd but not :q

like image 51
silvernightstar Avatar answered Sep 22 '22 10:09

silvernightstar


This might be much too late, but I was experiencing the exact same problem and found that adding the line

set hidden

to my .vimrc solves this problem. This makes vim hide buffers rather than closing them when you enter ":q" It also seems to keep my syntax highlighting enabled between files when I navigate with minibufexplorer.

Hope this helps.

like image 24
SSACody Avatar answered Sep 18 '22 10:09

SSACody