Monday, December 12, 2011

Re: How to put a character the statusline?

On Sun, 11 Dec 2011, S. Cowles wrote:
> On Sun, 11 Dec 2011, Bee wrote:
>> I know how to put the decimal and hex equivalent of the character
>> under the cursor in the statusline:
>>
>> set statusline+=%b " decimal byte '98'
>> set statusline+=\x%02B " hex byte 'x62'
>>
>> How to put the character itself in the statusline?
>
> here is another method to accomplish the task. keep in mind that %b is a
> format operator, not a variable.
>
> set statusline=
> \\ %F
> \%<
> \%=
> \\ %-12(charnum:%03b%)
> \\ %-12(charstr:%{CurCharStr()}%)
>
> function! CurCharStr()
> normal yl
> return @"
> endfunction

this does a good job of causing incorrect behaviour in insert mode.
apologies for the incomplete testing.

--
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

No comments: