Saturday, December 26, 2009

Re: cursorline/cursorcolumn highlighting

Gary Johnson wrote:
> That's odd. I just tried your function with b:lico and it
> worked fine for me: each call to LiCo() advanced the state of
> the cursor highlights as you described. I only tried it with
> one buffer.

Yes, odd. When I run the following I get errors.
Both terminal versions Vim 7.2.315 and Vi 6.2

" toggle cursorline/cursorcolumn or center line
highlight CursorLine NONE ctermbg=Yellow
highlight CursorColumn NONE ctermbg=Yellow
let b:lico=0
function LiCo()
let b:lico=b:lico>2 ?0 :b:lico+1
let &cursorline=b:lico % 2
let &cursorcolumn=b:lico / 2
endfun
nmap <silent> <F7> :call LiCo()<cr>


Error detected while processing function LiCo:
line 1:
E121: Undefined variable: b:lico
E15: Invalid expression: b:lico>2 ?0 :b:lico+1
line 2:
E121: Undefined variable: b:lico
E15: Invalid expression: b:lico % 2
line 3:
E121: Undefined variable: b:lico
E15: Invalid expression: b:lico / 2

--
Bill
Santa Cruz, California

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

No comments: