Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #67 - Showing the ASCII value of the current character

Created: May 7, 2001 5:56 Complexity: intermediate Author: Erhan Version: 5.7 Karma: 217/107 Imported from: Tip#67

You can learn the ASCII value of the character under the cursor by pressing ga in command mode or :as / :ascii on the command line . This displays the value of the current character in decimal, hex and octal. (Think "get ascii.")

To get the same for a multibyte character use g8

Seeing ASCII values in the status line

You can also add options to the statusline option to show the ASCII value of the character under the cursor.

:set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P 

It's the %b\ 0x%B that does the trick. Note that you may need to :set laststatus=2 so that the status line is visible in with only one window showing.

References

:help ga
:help g8
:help statusline
:help laststatus
Advertisement