Hm, the documentation for 'cul' talks about screenlines, but in my
experience, 'cul' has always been highlighting complete lines. Looks like
a documentation error.
I guess, there is nothing you can do about, except, maybe implement it
yourself:
fu! CursorLine()
if !exists("CL")
hi CL gui=underline term=underline cterm=underline
endif
if !exists("b:matches")
let b:matches = 0
endif
let col = virtcol('.')
let width = winwidth(0)
let screenline = col/width
let start = screenline * width
let end = (screenline+1) * width + 1
if b:matches > 0
sil! call matchdelete(b:matches)
endif
let pat = '\%'. line('.'). 'l\%>'. start. 'v.*\%<'. end. 'v'
let b:matches = matchadd('CL', pat)
endfu
au CursorHold,CursorHoldI * :call CursorLine()
regards,
Christian
that should have been if !hlexists("CL")
regards,
Christian
regards,
Christian
--
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
On Do, 29 M�r 2012, Abu Yoav wrote:
> First, thank you very much for the reply!
>
> On the one hand, your solution does indeed work. On the other hand, the
> time it takes for the underline to update itself to the correct line is
> really slow. On my machine, about 5 seconds (with the !hlexists("CL")
> correction, on a very small file). Do you know if there is a parameter I
> can tune to get this working faster, or is this due to the fact that a
> script is inherently slow?
That is because it waits until the CursorHold/CursorHoldI triggers,
which by default triggers after 'updatetime' seconds (e.g. 4 seconds, if
you haven't tuned it yourself). So try decreasing the 'updatetime'
setting.
See also the help at
:h 'updatetime'
:h 'CursorHold'
regards,
Christian
On Mi, 28 M�r 2012, Abu Yoav wrote:
[...]
> I am editing a text file (latex). I prefer that each paragraph be a
> long line, and that vim wrap the text. That's the usual behaviour, and
> that works fine. An option that seems very helpful is cursorline, so I
> set it (":set cul"). However, this does not do what I want. Namely,
> instead of highlighting the *visual* line I am on, it highlights the
> whole paragraph. Is there any way to highlight only the current visual
> line I am on? Again, a workaround would be to instruct vim to have
> lines of at most 80 characters (say), but I don't want that.
The help for 'cursorline' says:
,----
| Highlight the screen line of the cursor with CursorLine
`----
While 'cul' has always been highlighting complete lines. Do you think,
this would warrant a new option, that changes 'cul' to only highlight
screen lines or change the option 'cul' to a string option, that can be
set to 'screen' or 'line'?
This might be helpful for long lines (e.g. when editing csv files and
wrap is set).
If not, the documentation should be updated.
regards,
Christian
--
Der Furchtsame erschrickt vor der Gefahr, der Feige in ihr, der Mutige
nach ihr.
-- Jean Paul (eig. Johann Paul Friedrich Richter)
Hi Abu!
regards,
Christian
Or declare it a bug and fix the behavior to match the documentation.
Regards,
Gary
Well, here is a patch, that fixes it. I am not sure, whether this
is a bug and this patch certainly makes 'cul' behave unexpectedly.
Would be good, if some people try it out,
because the screen drawing code looks frightening to me ;)
regards,
Christian
I don't think we should change the current meaning of 'cursorline'.
What the original poster asked for is something else.
Since 'cursorline' is a boolean option we can't change it to be more
than an on/off switch.
That leaves adding Yet Another Option...
- Bram
--
A KNIGHT rides into shot and hacks him to the ground. He rides off.
We stay for a moment on the glade. A MIDDLE-AGED LADY in a C. & A.
twin-set emerges from the trees and looks in horror at the body of her
HUSBAND.
MRS HISTORIAN: FRANK!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
On Fr, 30 M�r 2012, Bram Moolenaar wrote:
> That leaves adding Yet Another Option...
have you ever thought about providing some kind of a generic option
setting, that could be easily extendible for such small settings.
Something similar to the 'fo' and 'cpo' settings
e.g. set generic=cursorline:screenline
or something? And then when another new minor setting is needed, one
could extend it to something like this:
set generic=cursorline:screenline,foo:foobar
Does that sound reasonable?
Mit freundlichen Gr��en
Christian
How is this better than adding an option?
--
He was not in the least bit scared to be mashed into a pulp
Or to have his eyes gouged out and his elbows broken;
To have his kneecaps split and his body burned away
And his limbs all hacked and mangled, brave Sir Robin.