Vim Tips Wiki
No edit summary
 
m (Convert numbers, hex to decimal and vice versa via menu moved to Convert numbers hex/decimal via menu: Page moved by JohnBot to improve title)

Revision as of 09:53, 18 October 2007

Previous TipNext Tip

Tip: #772 - Convert numbers hex/decimal via menu

Created: August 18, 2004 0:38 Complexity: basic Author: Thomas Ramming Version: 6.0 Karma: 3/4 Imported from: Tip#772

A quick way to transform hex numbers to decimal or vice versa.

Visual select the number (no leading '0x' allowed, sorry) and select the menu to transform the number.

You need the calculator 'bc' (standard unix, or cygwin).


UNIX:

vmenu 1.220 PopUp.&nr2hex <ESC>:exec("!echo \\"obase=16;".@*."\\" \

Comments

Use [/scripts/script.php?script_id=54 vimscript #54] to have a more general solution without using an external program like bc.

o.fobel_AT_gmx_DOT_de , August 18, 2004 6:01


Do you feel better now? For what is this good for? Is your life really so boring that you want other people to get even more spam than they already had before?

Anonymous , August 19, 2004 0:58


vimscript 54 is just a transformation of numbers, bc can really calculate, work with variables, functions etc., so what is FAB1DF4 * FF ? Just visual mark 'FAB1DF4 * FF' and select 'hex2nr' to see the result.

FAB1DF4 * FF = 67032503820 262872564 * 255 = 67032503820

Thomas

Anonymous , August 19, 2004 23:26


I see, that is an additional (hidden?) feature I was not aware of.

Anonymous , August 19, 2004 23:54


Also see Tip #448

Anon , August 21, 2004 8:29