Is there a way to show the character under the cursor in the statusline?
I already use %b\ (0x%B) to display decimal and hexadecimal value of the character. I would like to display the char itself as well before these two.
Is there a way to show the character under the cursor in the statusline?
I already use %b\ (0x%B) to display decimal and hexadecimal value of the character. I would like to display the char itself as well before these two.
Copyright © 2021 Jogjafile Inc.
There's no predefined item (as listed under
:help 'statusline', but you can implement this with a custom expression (item%{...}):(I'm using
:letinstead of:setto avoid having to escape all spaces; it's more readable this way.)getline('.')obtains the current line, and the character under the cursor is retrieved via the special\%catom that matches at a certain column;col('.')is the current column. The.then matches the character there, andmatchstr()extracts it.