3 ms·
Personally, my vim status line has an indicator which shows the hex code for the rune currently under the cursor. After fighting against word processor quotes,
by falcolas 11y ago
Personally, my vim status line has an indicator which shows the hex code for the rune currently under the cursor.
After fighting against word processor quotes, it's become second nature to double check it periodically.
- coldpie 11y agoCool! How do you do that?
- leephillips 11y agoI'd like to know, too. Until then, you can type "ga" in normal mode to get a display of the decimal, hex, and octal value of the character under the cursor.
- iamcurious 11y agoThat seems useful. Can you share it?
- falcolas 11y agoHere you go: :set statusline=%F%m%r%h%w\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] :set laststatus=2 Produces a status line when inserting and recording a macro like (the character under the cursor is 'm': ~/.vimrc [TYPE=VIM] [ASCII=109] [HEX=6D] [POS=0123,0020][67%] [LEN=182] -- INSERT --recording And, of course... `:help statusline`
- rspeer 11y agoThis doesn't seem Unicode-aware at all. I put my cursor on the character 每 and it says: [ASCII=2>4] [HEX=0>4] It's not ASCII, and its hex code is 6BCF. It also says "ASCII=252" when I put the cursor over "ü". Claiming that values over 127 are ASCII is just a malapropism.
- Procrastes 11y agovi can be so elegant. For us emacsen you can do a (what-cursor-position &optional DETAIL) which is usually bound to Ctl-x = I don't think it will be nearly this clean to add it to the modeline, but I'll take a look.
- iamcurious 11y agoVery nice! Thanks.
- kps 11y agoHow about, :syn match Error "[^ -~]"
- brunosutic 11y agoI just created a vim plugin "vim-troll-stopper" https://github.com/vim-utils/vim-troll-stopper https://github.com/vim-utils/vim-troll-stopper It protects you from these tricks by highlighting "troll" unicode characters in red.