Vim Tips Wiki
Register
(mention characterize plugin)
(mention plugins that can be helpful.)
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
You can learn the ASCII or Unicode 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 "'''g'''et '''a'''scii.") The {{script|id=4410|text=characterize plugin}} overrides this command to provide even more useful information for Unicode characters, such as any {{help|prefix=no|digraphs}} Vim has defined to enter the character.
+
You can learn the ASCII or Unicode 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 "'''g'''et '''a'''scii.")
   
 
===Seeing ASCII/Unicode values in the status line===
 
===Seeing ASCII/Unicode values in the status line===
Line 20: Line 20:
   
 
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.
 
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.
  +
  +
==Related Scripts==
  +
* The {{script|id=4410|text=characterize plugin}} overrides the '''ga''' command to provide even more useful information for Unicode characters, such as any {{help|prefix=no|digraphs}} Vim has defined to enter the character.
  +
* The {{script|id=2822|text=unicode plugin}} also provides additional information for any character without overriding the '''ga''' normal command. It provides the ''':UnicodeName''' command, that displays the official Unicode name for any character as well as defined digraphs. This also works correctly for combined chars.
   
 
==References==
 
==References==

Revision as of 07:29, 19 March 2013

Tip 67 Printable Monobook Previous Next

created May 7, 2001 · complexity intermediate · author Erhan · version 5.7


You can learn the ASCII or Unicode 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.")

Seeing ASCII/Unicode values in the status line

You can also add options to the statusline option to show the ASCII/Unicode 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.

Related Scripts

  • The characterize plugin overrides the ga command to provide even more useful information for Unicode characters, such as any digraphs Vim has defined to enter the character.
  • The unicode plugin also provides additional information for any character without overriding the ga normal command. It provides the :UnicodeName command, that displays the official Unicode name for any character as well as defined digraphs. This also works correctly for combined chars.

References

Comments