> -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Christian Brabandt > Sent: Tuesday, November 24, 2009 10:38 PM > To: [email protected] > Subject: Re: Problem with 'hidden' and :bufdo > > > On Wed, November 25, 2009 2:49 am, Craig Barkhouse wrote: > > > And then invoke Vim as follows in a directory that has several .c > > files (it seems you could use any :bufdo command here, this is just > an > > example): vim -c "bufdo normal gg" *.c > > > > The problem I see is that the first and last buffers have syntax > > highlighting, but all the intermediate buffers do not. For example, > > if there are 10 .c files, then only buffers 1 and 10 will have syntax > > highlighting. > > When issuing :bufdo, the Syntax autocommand event is added to the > 'eventignore' option, so that bufdo can perform faster. This is > described at :h :bufdo > > If you don't like this, you could possibly set this option within the > :bufdo command like this: > > vim -c "bufdo set ei=| normal gg" *.c > > > P.S. I actually don't remember why I set 'hidden' in my .vimrc, it's > > just been that way for so long! > > It enables you to switch buffers, even when the current buffer is > modified. Otherwise you would have save the current buffer before > switching to another one. > > regards, > Christian
Thanks Christian (and John Beckett) for the explanation. This still doesn't quite explain the interaction with 'hidden'. If I comment out the "set hidden" line in my .vimrc, reducing it to the following 2-line .vimrc: filetype on syntax on ... then I do in fact get syntax highlighting for every buffer. (Unfortunately then 'nohidden' is set, which I don't want, for exactly the reason you pointed out.) Your suggested workaround does the trick. So does this: vim -c "set nohidden" -c "bufdo normal gg" -c "set hidden" *.c --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
