when you do ':bnext' syntax-highlighting does not work in some states.

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

when you do ':bnext' syntax-highlighting does not work in some states.

Dewr

I loaded a file in which some vim-scripts are and I did ':setlocal
filetype=vim' then I saw beautiful syntax-highlighting. :)
but win32-gvim didn't keep it up. I did ':bnext' and ':bprevious'
several times and i found that win32-gvim didn't keep syntax-
highlighting up. win32-gvim just regards the filename not filetype
(option value) when it's doing :bnext and :bprevious.

p.s. execuse me but I cant write english text well.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Tony Mechelynck

On 06/02/09 07:53, 듀르 wrote:
> I loaded a file in which some vim-scripts are and I did ':setlocal
> filetype=vim' then I saw beautiful syntax-highlighting. :)
> but win32-gvim didn't keep it up. I did ':bnext' and ':bprevious'
> several times and i found that win32-gvim didn't keep syntax-
> highlighting up. win32-gvim just regards the filename not filetype
> (option value) when it's doing :bnext and :bprevious.

Check whether your vimrc includes either

        runtime vimrc_example.vim

(or "source $VIMRUNTIME/vimrc_example.vim", without the quotes, which
amounts to the same thing), or at least

        syntax on

; to the latter I recommend to add

        filetype plugin on

or, depending on your indenting preferences,

        filetype plugin indent on

Also, check that each of your scripts has either the .vim extension or
one of the names vimrc .vimrc _vimrc gvimrc .gvimrc _gvimrc .exrc _exrc

With the above, any file which Vim knows how to highlight will be
highlighted.


Best regards,
Tony.
--
How long a minute is depends on which side of the bathroom door you're
on.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Dewr
Thank you, Tony. but my Vim works well when it is working with _vimrc or blahblah.vim.
I just wanted Vim to keep the syntax-highlighting made by ':setlocal filetype=vim'. but Vim loses syntax-highlighting when ':bnext'|':bprevious' command is given.
I thought it's a bug. isn't it a bug?
be happy.

p.s. execuse me for my poor english speaking skill. :q

2009/2/6 Tony Mechelynck <[hidden email]>

On 06/02/09 07:53, 듀르 wrote:
> I loaded a file in which some vim-scripts are and I did ':setlocal
> filetype=vim' then I saw beautiful syntax-highlighting. :)
> but win32-gvim didn't keep it up. I did ':bnext' and ':bprevious'
> several times and i found that win32-gvim didn't keep syntax-
> highlighting up. win32-gvim just regards the filename not filetype
> (option value) when it's doing :bnext and :bprevious.

Check whether your vimrc includes either

       runtime vimrc_example.vim

(or "source $VIMRUNTIME/vimrc_example.vim", without the quotes, which
amounts to the same thing), or at least

       syntax on

; to the latter I recommend to add

       filetype plugin on

or, depending on your indenting preferences,

       filetype plugin indent on

Also, check that each of your scripts has either the .vim extension or
one of the names vimrc .vimrc _vimrc gvimrc .gvimrc _gvimrc .exrc _exrc

With the above, any file which Vim knows how to highlight will be
highlighted.


Best regards,
Tony.
--
How long a minute is depends on which side of the bathroom door you're
on.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Lech Lorens

2009/2/6 Dewr <[hidden email]>:
> Thank you, Tony. but my Vim works well when it is working with _vimrc or
> blahblah.vim.
> I just wanted Vim to keep the syntax-highlighting made by ':setlocal
> filetype=vim'. but Vim loses syntax-highlighting when ':bnext'|':bprevious'
> command is given.
> I thought it's a bug. isn't it a bug?

It is not. :help 'ft' states that 'ft' is local to a buffer. When you
do :bnext, you change the buffer, so the value of 'ft' changes as
well. Seems logical to me.

--
Cheers,
Lech

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Ingo Karkat

On 06-Feb-09 11:14, Lech Lorens wrote:

> 2009/2/6 Dewr <[hidden email]>:
>> Thank you, Tony. but my Vim works well when it is working with _vimrc or
>> blahblah.vim.
>> I just wanted Vim to keep the syntax-highlighting made by ':setlocal
>> filetype=vim'. but Vim loses syntax-highlighting when ':bnext'|':bprevious'
>> command is given.
>> I thought it's a bug. isn't it a bug?
>
> It is not. :help 'ft' states that 'ft' is local to a buffer. When you
> do :bnext, you change the buffer, so the value of 'ft' changes as
> well. Seems logical to me.

Right, but Dewr is doing :bnext followed by :bprev, so he's back at the original
buffer!
I can reproduce this, and for me, too, this behavior is unexpected. When I
manually :set filetype=vim, the buffer's filetype changes and is highlighted as
vimscript. After :bnext|bprevious, the buffer's filetype is still 'vim' (okay),
but the highlighting is gone. I have to do :syntax enable to let the
highlighting show up again.

-- regards, ingo


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Tony Mechelynck
In reply to this post by Dewr

On 06/02/09 10:54, Dewr wrote:
> Thank you, Tony. but my Vim works well when it is working with _vimrc or
> blahblah.vim.
> I just wanted Vim to keep the syntax-highlighting made by ':setlocal
> filetype=vim'. but Vim loses syntax-highlighting when
> ':bnext'|':bprevious' command is given.
> I thought it's a bug. isn't it a bug?

Hm, I'm not sure.

> be happy.
>
> p.s. execuse me for my poor english speaking skill. :q

No need -- if you were not constantly mentioning it, no one here would
notice that you find it hard to write English.


Best regards,
Tony.
--
If a putt passes over the hole without dropping, it is deemed to have
dropped.  The law of gravity holds that any object attempting to
maintain a position in the atmosphere without something to support it
must drop.  The law of gravity supercedes the law of golf.
                -- Donald A. Metz

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Tony Mechelynck
In reply to this post by Lech Lorens

On 06/02/09 11:14, Lech Lorens wrote:

> 2009/2/6 Dewr<[hidden email]>:
>> Thank you, Tony. but my Vim works well when it is working with _vimrc or
>> blahblah.vim.
>> I just wanted Vim to keep the syntax-highlighting made by ':setlocal
>> filetype=vim'. but Vim loses syntax-highlighting when ':bnext'|':bprevious'
>> command is given.
>> I thought it's a bug. isn't it a bug?
>
> It is not. :help 'ft' states that 'ft' is local to a buffer. When you
> do :bnext, you change the buffer, so the value of 'ft' changes as
> well. Seems logical to me.
>

yes, but when he does :bnext _followed by :bprev_, doesn't he go back to
the former buffer? Or has that buffer been unloaded in the meantime and
its filetype lost? Hm, that could be a possibility. 듀르、 if you use
":setlocal bufhidden=hide" on the first buffer (before using ":bnext"),
does it keep its filetype then?


Best regards,
Tony.
--
It is an important and popular fact that things are not always what
they seem.  For instance, on the planet Earth, man had always assumed
that he was more intelligent than dolphins because he had achieved so
much -- the wheel, New York wars and so on -- whilst all the dolphins
had ever done was muck about in the water having a good time.  But
conversely, the dolphins had always believed that they were far more
intelligent than man -- for precisely the same reasons.

Curiously enough, the dolphins had long known of the impending
destruction of the of the planet Earth and had made many attempts to
alert mankind to the danger; but most of their communications were
misinterpreted ...
                -- Douglas Admas "The Hitch-Hikers' Guide To The
                   Galaxy"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Dewr
it keeps its filetype even if you didn't give ":setlocal bufhidden=hide".
anyway! Vim keeps syntax-highlighting when I've used ":setlocal bufhidden=hide" before I use "bnext"|"bprevious".


2009/2/6 Tony Mechelynck <[hidden email]>
 듀르、 if you use
":setlocal bufhidden=hide" on the first buffer (before using ":bnext"),
does it keep its filetype then?



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Tony Mechelynck

On 07/02/09 07:27, Dewr wrote:
> it keeps its filetype even if you didn't give ":setlocal bufhidden=hide".
> anyway! Vim keeps syntax-highlighting when I've used ":setlocal
> bufhidden=hide" before I use "bnext"|"bprevious".
>

Then I think it's working as it should (though it may surprise you). If
you "hide" the buffer, it keeps everything. If you "unload" it, some of
the information (including, maybe, the buffer-local 'syntax' set by
hand) gets lost.

Another way to keep everything is to use split-windows or tab pages.
When not in use, it is possible to reduce a split-window to only a
status line and nooothing else (if 'winminheight' is zero) and a tab
page to even less than that.

Best regards,
Tony.
--
Five is a sufficiently close approximation to infinity.
                -- Robert Firth

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Dewr
it made me surprise a little. the default value of bufhidden is ""(none). when the value of bufhidden is "" vim does work like the value of bufhidden is "hide". but it unloaded the syntax-highlighting.
thank you very much.
be happy.

2009/2/7 Tony Mechelynck <[hidden email]>

On 07/02/09 07:27, Dewr wrote:
> it keeps its filetype even if you didn't give ":setlocal bufhidden=hide".
> anyway! Vim keeps syntax-highlighting when I've used ":setlocal
> bufhidden=hide" before I use "bnext"|"bprevious".
>

Then I think it's working as it should (though it may surprise you). If
you "hide" the buffer, it keeps everything. If you "unload" it, some of
the information (including, maybe, the buffer-local 'syntax' set by
hand) gets lost.

Another way to keep everything is to use split-windows or tab pages.
When not in use, it is possible to reduce a split-window to only a
status line and nooothing else (if 'winminheight' is zero) and a tab
page to even less than that.

Best regards,
Tony.
--
Five is a sufficiently close approximation to infinity.
               -- Robert Firth




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Ingo Karkat
In reply to this post by Tony Mechelynck

On 07-Feb-09 7:38, Tony Mechelynck wrote:

> On 07/02/09 07:27, Dewr wrote:
>> it keeps its filetype even if you didn't give ":setlocal bufhidden=hide".
>> anyway! Vim keeps syntax-highlighting when I've used ":setlocal
>> bufhidden=hide" before I use "bnext"|"bprevious".
>>
>
> Then I think it's working as it should (though it may surprise you). If
> you "hide" the buffer, it keeps everything. If you "unload" it, some of
> the information (including, maybe, the buffer-local 'syntax' set by
> hand) gets lost.

I still think it's a bug, because the behavior is inconsistent (buffer-local
settings like 'filetype' and 'syntax' are kept when the buffer is unloaded, but
the syntax highlighting isn't) and unexpected (when I manually make a setting,
*all* its effects should be kept after :bnext|bprev).
I couldn't find an explanation or description of how it should work in the help,
so maybe Bram has to chime in with his opinion?!

Anyway, I found another workaround (that could be placed in .vimrc if you're
annoyed by the current behavior), which I hope has fewer side effects than ':set
hidden':

autocmd! BufRead * if exists('syntax_on') || exists('syntax_manual') | syntax
enable | endif

-- regards, ingo


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: when you do ':bnext' syntax-highlighting does not work in some states.

Dewr
In reply to this post by Dewr
2009/2/7 Dewr <[hidden email]>
it made me surprise a little. the default value of bufhidden is ""(none). when the value of bufhidden is "" vim does work like the value of bufhidden is "hide". but it unloaded the syntax-highlighting.
thank you very much.
be happy.

oops. when the value of bufhidden is "", It does not work like when it does while the value of bufhidden is "hide". I lost my data.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---