Wikia

Vim Tips Wiki

Changes: Showing the ASCII value of the current character

Edit

Back to page

(Related Scripts: note that characterize.vim plugin contains a bug regarding combining characters)
(Seeing ASCII/Unicode values in the status line)
Line 13: Line 13:
 
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.")
 
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===
+
472^?9291^?0^?A:_LockDate:D::_LockTime:T::_LockNode:A::_LockPort:A::dsdl:A::prd:A::rle:B:0:mt:A:6 - Outage Notification:bl:A::cn:A:MCRCHCo:sc:A:TECHSUPPORT:ra:A:8035:rg:A:PC0A:mb:I:0:mc:I:0:auth:A:UkNITUNDb0ZyOjk1ZjU5OTMwLWIzNTMtMzFlMy04MDAwLWI0NmUzOWY4ZDdkZQ==:dest:A:S^?^?^?:url:A::cbd:A::edfa:T::cst:I:0:cstp:I:0:cvx:A::etacm:S:0:etamba:S:0:etammb:S:0:etama:S:0:etamb:S:0:etamm:S:0:etamh:S:0:etaac:S:0:cajds:A::ipds:A::dda:A::ipti:A::ipm:A::najds:A::cjds:A::najrr:A::orc:A::ddr:A::ddx:A::phjds:A::pcjds:A::ddph:A::ddpc:A::ovol:A:4||||:ovods:A:4||||:ovoti:A:4||||:ovorc:A:4||||:ovom:A:4||||:sathf:B:0:ri:A::tn1:A:4024909972:tn2:A:4024317701:tn3:A:4024909972:tn4:A::tn5:A::tn6:A::ddt:A::ddi:A::pdx:A::pda:A::sdx:A::sda:A::sds:A:10||||||||||:sos:A:10||||||||||:sjs:A:10||||||||||:iacs:A:30||||||||||||||||||||||||||||||:iajs:A:30||||||||||||||||||||||||||||||:iass:A:30||||||||||||||||||||||||||||||:tcid:A:36||||||||||||||||||||||||||||||||||||:tct:T:36||||||||||||||||||||||||||||||||||||:tcp:A:36||||||||||||||||||||||||||||||||||||:tce:T:36||||||||||||||||||||||||||||||||||||:tcal:A:36||||||||||||||||||||||||||||||||||||:andD:A:andh dir:andDL:A:andl dir:ancdD:A:ancdceqph dir:ancdDL:A:ancdceqph dir:outD:A:anocdh dir:outDL:A:anocdl dir:xmtDL:A::scf:B:0:ocfu:A::tcf:B:0:tcfu:A::wotf:B:0:otfu:A::holf:B:0:holu:A::wosf:B:0:osfu:A::rcff:B:0:rcfu:A::tidf:B:0:tifu:A::maff:B:0:mafu:A::pnf:B:0:pnfu:A::rlff:B:0:rlfu:A::dsf:B:0:dsfu:A::phl:A::pcsf:B:0:pcsd:A::scca:B:0:srsf:B:0:srsd:A::dqtf:B:0:dqtd:A::tbtd:B:0:
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==
 
==Related Scripts==

Revision as of 20:58, March 26, 2014

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.")

472^?9291^?0^?A:_LockDate:D::_LockTime:T::_LockNode:A::_LockPort:A::dsdl:A::prd:A::rle:B:0:mt:A:6 - Outage Notification:bl:A::cn:A:MCRCHCo:sc:A:TECHSUPPORT:ra:A:8035:rg:A:PC0A:mb:I:0:mc:I:0:auth:A:UkNITUNDb0ZyOjk1ZjU5OTMwLWIzNTMtMzFlMy04MDAwLWI0NmUzOWY4ZDdkZQ==:dest:A:S^?^?^?:url:A::cbd:A::edfa:T::cst:I:0:cstp:I:0:cvx:A::etacm:S:0:etamba:S:0:etammb:S:0:etama:S:0:etamb:S:0:etamm:S:0:etamh:S:0:etaac:S:0:cajds:A::ipds:A::dda:A::ipti:A::ipm:A::najds:A::cjds:A::najrr:A::orc:A::ddr:A::ddx:A::phjds:A::pcjds:A::ddph:A::ddpc:A::ovol:A:4||||:ovods:A:4||||:ovoti:A:4||||:ovorc:A:4||||:ovom:A:4||||:sathf:B:0:ri:A::tn1:A:4024909972:tn2:A:4024317701:tn3:A:4024909972:tn4:A::tn5:A::tn6:A::ddt:A::ddi:A::pdx:A::pda:A::sdx:A::sda:A::sds:A:10||||||||||:sos:A:10||||||||||:sjs:A:10||||||||||:iacs:A:30||||||||||||||||||||||||||||||:iajs:A:30||||||||||||||||||||||||||||||:iass:A:30||||||||||||||||||||||||||||||:tcid:A:36||||||||||||||||||||||||||||||||||||:tct:T:36||||||||||||||||||||||||||||||||||||:tcp:A:36||||||||||||||||||||||||||||||||||||:tce:T:36||||||||||||||||||||||||||||||||||||:tcal:A:36||||||||||||||||||||||||||||||||||||:andD:A:andh dir:andDL:A:andl dir:ancdD:A:ancdceqph dir:ancdDL:A:ancdceqph dir:outD:A:anocdh dir:outDL:A:anocdl dir:xmtDL:A::scf:B:0:ocfu:A::tcf:B:0:tcfu:A::wotf:B:0:otfu:A::holf:B:0:holu:A::wosf:B:0:osfu:A::rcff:B:0:rcfu:A::tidf:B:0:tifu:A::maff:B:0:mafu:A::pnf:B:0:pnfu:A::rlff:B:0:rlfu:A::dsf:B:0:dsfu:A::phl:A::pcsf:B:0:pcsd:A::scca:B:0:srsf:B:0:srsd:A::dqtf:B:0:dqtd:A::tbtd:B:0:

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. But note that it contains a bug so it will not identify any combining characters for UTF-8 characters.
  • 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 or html entity name. This also works correctly for combined chars.

References

Comments

Around Wikia's network

Random Wiki