Wednesday, October 28, 2015

Re: Switching syntax highlighting

2015-10-28 18:34 GMT+03:00 David Fishburn <dfishburn.vim@gmail.com>:
>
>
> On Tue, Oct 27, 2015 at 7:52 PM, sycc <sycc90@mail.com> wrote:
>>
>> Hello all!
>> I'm trying to write a function for switching between the current buffer
>> syntax highlighting and whitespace, but I'm really new to vim scripting and
>> such and am having a hard time.
>> I switch to whitespace syntax highlighting and back quite frequently.
>> However, it's not as simple as switching back to the buffer's filetype
>> syntax because there are times when I've changed it to something else. For
>> instance, data in .txt files that I visualize with different syntax
>> highlighting formats depending on the situation.
>>
>> What I've tried is creating a buffer variable on buffer creation and then
>> updating it, this is what I have so far:
>>
>> au BufEnter * let b:current_syntax=&syntax
>> fu! SwitchHLwhitespace()
>> if &syntax == "whitespace"
>> let &syntax=b:current_syntax
>> else
>> let tmp=&syntax
>> set syntax=whitespace
>> let b:current_syntax=tmp
>> endif
>> endfunction
>>
>>
>
> Didn't quite follow what you are tying to do with whitespace.
>
> I know at times you want to see "invisible" stuff, like tabs, whitespace,
> special codes and so on.
>
> 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). If it
is used highlighting of anything, *but* spaces is disturbing.

>
> HTH,
> David
>
>
> --
> --
> 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:

Post a Comment