Wednesday, October 28, 2015

Re: Switching syntax highlighting

Well, I thought I was supposed to create the variable outside the scope
of the function... but I see that's not necessary. And not setting it on
BufEnter actually solves my problem, great!
Just for clarification though, I'm not using filetype because sometimes
I change the syntax highlighting, so I'd need it to go back to the one
I'd changed to instead of the filetype.

Thank you very much!

-- Sycc


On 10/28/2015 08:20 PM, Nikolay Pavlov wrote:
> 2015-10-29 2:19 GMT+03:00 Nikolay Pavlov <zyx.vim@gmail.com>:
>> 2015-10-29 0:52 GMT+03:00 sycc <sycc90@mail.com>:
>>> Thank you all for the answers!
>>>
>>> Yes, I'm actually using it to highlight whitespace... I know it's a
>>> programming language on its own, but it works perfectly well for my needs so
>>> I don't see a reason to install extra plugins for it.
>>>
>>> I hadn't realized that b:current_syntax had a special meaning... that
>>> clearly explains the problem with the tmp var and makes me feel like an
>>> idiot =)
>>> But even after changing that (now I've named it b:current_buffer_syntax and
>>> I can see that this one's not used) problem 2) keeps happening. Maybe this
>>> buffer variables don't work the way I though they did...? I'd like to store
>>> the syntax of each buffer I have open, how can this be done?
>> Why are you setting this variable on BufEnter? I would do this just
>> before setting the option to whitespace and *only* before setting the
>> option to whitespace. Not sure this will fix the issue.
> And also note that &syntax is usually the same thing as &filetype. So
> toggler may look like
>
> if &l:syntax is# &l:filetype
> setlocal syntax=whitespace
> else
> let &l:syntax = &l:filetype
> endif
>
>>> -- Sycc
>>>
>>>
>>> On 10/28/2015 12:38 PM, David Fishburn wrote:
>>>>
>>>> > Didn't quite follow what you are tying to do with whitespace.
>>>> >
>>>> ...
>>>>
>>>> > I use this plugin:
>>>> >
>>>> > cream-showinvisibles : Toggle view of invisible tabs, returns,
>>>> trailing
>>>> > spaces
>>>> > http://vim.sourceforge.net/scripts/script.php?script_id=363
>>>> >
>>>> >
>>>> > Anytime I want to see that stuff, I just hit F4 (that is the
>>>> default mapping
>>>> > for the plugin).
>>>>
>>>> Whitespace is an esoteric programming language:
>>>> https://en.wikipedia.org/wiki/Whitespace_(programming_language)
>>>> <https://en.wikipedia.org/wiki/Whitespace_%28programming_language%29>.
>>>> If it
>>>> is used highlighting of anything, *but* spaces is disturbing.
>>>>
>>>>
>>>> Okay, scratch that reply!!
>>>>
>>>> --
>>>> --
>>>> You received this message from the "vim_use" maillist.
>>>> Do not top-post! Type your reply below the text you are replying to.
>>>> For more information, visit http://www.vim.org/maillist.php
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google Groups
>>>> "vim_use" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>> email to vim_use+unsubscribe@googlegroups.com
>>>> <mailto:vim_use+unsubscribe@googlegroups.com>.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> --
>>> You received this message from the "vim_use" maillist.
>>> Do not top-post! Type your reply below the text you are replying to.
>>> For more information, visit http://www.vim.org/maillist.php
>>>
>>> --- You received this message because you are subscribed to the Google
>>> Groups "vim_use" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to vim_use+unsubscribe@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: