Monday, October 25, 2010

Re: Statusline with %b, %B and %O matching ga

Reply to message «Re: Statusline with %b, %B and %O matching ga»,
sent 00:24:59 26 October 2010, Tuesday
by Benjamin R. Haskell:

> Improved to handle multibyte chars:
>
> %{printf("Oct=%03o",char2nr(get(split(strpart(getline("."),col(".")-1),"\\z
> s"),0,"")))}
>
> (The 'get()' might be a bit inelegant, but it prevents errors on empty
> lines.)
You are doing something strange: it should be `matchstr' here:
%{printf("Oct=%03o", char2nr(matchstr(getline("."), '.', col(".")-1))}
This does not invoke lots of ineffective computations.

No comments: