Am 07.11.2011 15:08, schrieb Axel Bender:
@Andy
Thanks for the answer!
The split on '\zs' was new to me. Made some speed tests and found
that for lines with more than 180 chars the first solution is faster,
and for shorter lines the solution below, which is based on the
split() approach.
@Andy
thanks for the input!
However - knowing about escape(cword) - I don't want to use it because
it for the reasons given in one of my previous posts (e.g. ~ always returns
a value and thus hides the info I need).
Thanks again!
--
You received this message from the vim_use maillist.
Do
@Tim
The answer I found (cmp. above) is my replacement for escape(cword),
which I didn't find helpful in all situations. I wanted to include
fewer/more characters in vim's notion of what a cword is, and I wanted to
be able to define a left boundary different from the right one.
Adding to
Am 06.11.2011 20:22, schrieb Axel Bender:
Thanks for the replies!
The problem however isn't solved...
Having obtained the current byte index using col(.), I can't simply add n
to/subtract n from the return value of col(.) to find the beginning of
the next/previous multi-byte character (the -1
@Andy
Thanks for the answer!
The split on '\zs' was new to me. Made some speed tests and found that for
lines with more than 180 chars the first solution is faster, and for
shorter lines the solution below, which is based on the split() approach.
Opted for the new solution as short lines
Thanks for the replies!
The problem however isn't solved...
Having obtained the current byte index using col(.), I can't simply add n
to/subtract n from the return value of col(.) to find the beginning of
the next/previous multi-byte character (the -1 offset is ok because there's
a base
Addendum.
Heureka, I've found it!
The solution is based on a combination of virtcol(.) and byteidx(...):
function! CWord(string, class_start, class_end)
let l:len = len(substitute(a:string, ., x, g))
let l:pos = virtcol(.) - 1
let l:start = l:pos
while l:start = 0
On 11/06/11 13:22, Axel Bender wrote:
Having obtained the current byte index using col(.), I can't
simply add n to/subtract n from the return value of col(.)
to find the beginning of the next/previous multi-byte
character (the -1 offset is ok because there's a base bias). I
could use col(.)
Addendum:
Is there a UTF-8-safe version? The following doesn't work for a UTF-8 file
(both enc and fenc):
:echo getline(.)[col(.) ] =~ '\k'
when over an ü (i.e. an character that - if in Latin-1 - would be in the
default iskeyword option range).
Note: The inspected character is the *second*
Am 04.11.2011 16:43, schrieb Axel Bender:
Addendum:
Is there a UTF-8-safe version? The following doesn't work for a UTF-8 file
(both enc and fenc):
:echo getline(.)[col(.) ] =~ '\k'
when over an ü (i.e. an character that - if in Latin-1 - would be in the
default iskeyword option range).
Sometimes it's necessary to determine whether a given character belongs to
one of the options whose names are reflected by the above (suggested)
function names. Though it's possible to write those functions in vim
itself, one would either have to call such a function manually a) after a
change
Am 03.11.2011 19:07, schrieb Axel Bender:
Sometimes it's necessary to determine whether a given character belongs to
one of the options whose names are reflected by the above (suggested)
function names. Though it's possible to write those functions in vim
itself, one would either have to call
On 11/03/11 13:07, Axel Bender wrote:
Sometimes it's necessary to determine whether a given character belongs to
one of the options whose names are reflected by the above (suggested)
function names. Though it's possible to write those functions in vim
itself, one would either have to call such a
@Andy, Tim
thanks! Sometimes one doesn't see the forrest for the trees.
--
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
14 matches
Mail list logo