Re: Question about listchars

2006-10-19 Thread Jean-Rene David
* Jeff Lanzarotta [2006.10.19 13:13]:
> If there a way to check and see if the listchar
> is actually set or not?

For options I change often, I use the following to
display its value in the statusline. 

function! OptSet(opt, string)
   if(exists("a:opt") && expand(a:opt))
  return a:string
   else
  return ""
   endif
endfunction

Then put the following in the statusline:

set statusline=%<%f\%h%m%r%y%{OptSet(&ic,'[ic]')}[...]
 

So in this specific case, if 'ic' is set, I will
have '[ic]' in my status line.

I use that for 'ic' and 'ws' because I toggle them
quite ofen.

HTH,

-- 
JR


Re: Question about listchars

2006-10-19 Thread Steve Hall
On Thu, 2006-10-19 at 08:59 -0700, Jeff Lanzarotta wrote:
> 
> I have the following in my vimrc,
> 
> 
> " This shows spaces and tabs characters. Visual Whitespace.
> set listchars=tab:»·,trail:·
> set list
> 
> 
> That all work well and good, but I would like to disable this
> display of visual white space temporarily, do something, and then
> reset it back to what I had. Is there a way to do this?

I wrote a plugin that toggles "invisible" characters with F4:

  http://vim.sourceforge.net/scripts/script.php?script_id=363


-- 
Steve Hall  [ digitect dancingpaper com ]




Re: Question about listchars

2006-10-19 Thread Jeff Lanzarotta
Awesome. Thanks...

--- Tim Chase <[EMAIL PROTECTED]> wrote:

> > Thanks for all the suggestions. They helped out... If there a way
> to
> > check and see if the listchar is actually set or not?
> > 
> > In my script, I now turn off the display with 'set invlist list?',
> but
> > I do not want to turn it back on if it was not previously set...
> 
> 
> Well, you can use the common idiom
> 
>   let l:old_list = &list
>   set nolist
>   " do stuff
>   let &list = l:old_list
> 
> which will allow you to temporarily disable the 'list' setting, 
> do stuff without it, and then restore it to whatever it was 
> previously...
> 
> -tim
> 
> 
> 
> 
> 
>   
> 



Re: Question about listchars

2006-10-19 Thread Tim Chase

Thanks for all the suggestions. They helped out... If there a way to
check and see if the listchar is actually set or not?

In my script, I now turn off the display with 'set invlist list?', but
I do not want to turn it back on if it was not previously set...



Well, you can use the common idiom

let l:old_list = &list
set nolist
" do stuff
let &list = l:old_list

which will allow you to temporarily disable the 'list' setting, 
do stuff without it, and then restore it to whatever it was 
previously...


-tim








Re: Question about listchars

2006-10-19 Thread Jeff Lanzarotta
Thanks for all the suggestions. They helped out... If there a way to
check and see if the listchar is actually set or not?

In my script, I now turn off the display with 'set invlist list?', but
I do not want to turn it back on if it was not previously set...


--- Bill McCarthy <[EMAIL PROTECTED]> wrote:

> On Thu 19-Oct-06 10:59am -0600, Jeff Lanzarotta wrote:
> 
> > I have the following in my vimrc,
> >
> > 
> > " This shows spaces and tabs characters. Visual Whitespace.
> > set listchars=tab:»·,trail:·
> > set list
> > 
> >
> > That all work well and good, but I would like to disable this
> display
> > of visual white space temporarily, do something, and then reset it
> back
> > to what I had. Is there a way to do this?
> 
> You can toggle back and forth with:
> 
> :se invlist
> 
> This can be placed in a map like this:
> 
> nm  l :se invlist list?
> 
> where "invlist" will toggle the 'list' option and "list?"
> will display the new state.
> 
> For help on ":se {option}?" and ":se inv{option}" see:
> 
> :h set-option
> 
> -- 
> Best regards,
> Bill
> 
> 



Re: Question about listchars

2006-10-19 Thread Karl Guertin

On 10/19/06, Jeff Lanzarotta <[EMAIL PROTECTED]> wrote:

That all work well and good, but I would like to disable this display
of visual white space temporarily, do something, and then reset it back
to what I had. Is there a way to do this?


:map  l :set invlist

Then type \l when you want to toggle ( is \ by default).
Change the binding however you like, but invfoo inverts the foo
setting.


Re: Question about listchars

2006-10-19 Thread Bill McCarthy
On Thu 19-Oct-06 10:59am -0600, Jeff Lanzarotta wrote:

> I have the following in my vimrc,
>
> 
> " This shows spaces and tabs characters. Visual Whitespace.
> set listchars=tab:»·,trail:·
> set list
> 
>
> That all work well and good, but I would like to disable this display
> of visual white space temporarily, do something, and then reset it back
> to what I had. Is there a way to do this?

You can toggle back and forth with:

:se invlist

This can be placed in a map like this:

nm  l :se invlist list?

where "invlist" will toggle the 'list' option and "list?"
will display the new state.

For help on ":se {option}?" and ":se inv{option}" see:

:h set-option

-- 
Best regards,
Bill



Re: Question about listchars

2006-10-19 Thread Marius Roets

On 10/19/06, Jeff Lanzarotta <[EMAIL PROTECTED]> wrote:

Hello,

I have the following in my vimrc,


" This shows spaces and tabs characters. Visual Whitespace.
set listchars=tab:»·,trail:·
set list


That all work well and good, but I would like to disable this display
of visual white space temporarily, do something, and then reset it back
to what I had. Is there a way to do this?

Peace,

How about this in your .vimrc
nmap  :set invlist
imap  :set invlista

and then F5 would toggle list on and off.

HTH
Marius


Re: Question about listchars

2006-10-19 Thread Tim Chase

" This shows spaces and tabs characters. Visual Whitespace.
set listchars=tab:»·,trail:·
set list


That all work well and good, but I would like to disable this
display of visual white space temporarily, do something, and
then reset it back to what I had. Is there a way to do this?


Well, there are a number of possible solutions.  The 'listchars' 
setting only allows for showing trailing whitespace.  If this is 
what you're looking for, you can do something like


set listchars+=trail:_

do your thing, and then

set listchars-=trail:_

to undo it.

If you want to visualize all your whitespace, you can do it with

1) search highlighting (to get cleared on your next search):

:set hls
/\s

and then optionally reset with

:set nohls

or

:noh


2) match highlighting (to optionally be used in complement to 
search highlighting):


:match SpellBad /\s/

and then reset with

:match NONE

3) or you can do it by substituting all of your white-space with 
some visual character:


:%s/\s/#/g

and then just undoing with "u" as usual.

Just a few ideas...

-tkc





Question about listchars

2006-10-19 Thread Jeff Lanzarotta
Hello,

I have the following in my vimrc,


" This shows spaces and tabs characters. Visual Whitespace.
set listchars=tab:»·,trail:·
set list


That all work well and good, but I would like to disable this display
of visual white space temporarily, do something, and then reset it back
to what I had. Is there a way to do this?

Peace,

-Jeff





-Jeff