This plugin allows you to convert between main Numerical Systems:
- binary (
BIN
) - hexadecimal (
HEX
) - decimal (
DEC
)
To work with plugin (being able to convert a numbers) you can use the following:
- Keyboard Shortcut: use
ctrl+shift+c
(for Windows) - Main Menu: go to
Tools -> Numeral -> Convert
- Context Menu: click on
Numeral -> Convert
- Command Pallete: type
Numeral: Convert
Each pressing the convertion rotation is performed: BIN -> DEC -> HEX -> BIN
.
Also there are a several options which influence on convertion behaviour. For details please see section 'Settings'.
Plugin autorecognizes a selected number according to the following rules:
- numbers
0x1500
or1500h
or15FCC
are recognized as hexadecimal (HEX
); - numbers
0b101001
or101001b
are recognized as binary (BIN
) - numbers
59300
or1030
or200100
are recognized either as decimal (DEC
) or hexadecimal (HEX
) according to the option opt_prefer_numeral (see below); - numbers
1000
or101000
or11111
are recognized either as decimal (DEC
) or hexadecimal (HEX
) according to the option opt_prefer_numeral (see below);
Imporant: If the option opt_prefer_numeral is set to 'binary', the number 1 remains unmodified.
The plugin isn't yet accessable via Sublime Control Package, thus can be installed via git
:
- git clone https://github.com/gahcep/SublimeNumeral.git %APPDATA%/Sublime\ Text\ 2/Packages/SublimeNumeral
- git clone https://github.com/gahcep/SublimeNumeral.git ~/.config/sublime-text-2/Packages/SublimeNumeral
- git clone https://github.com/gahcep/SublimeNumeral.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/SublimeNumeral
numeral_convert
: Cyclically convert between BIN
, DEC
and HEX
numerical systems. Bound to ctrl+shift+c
.
All options are located in file %APPDATA%/Sublime\ Text\ 2/Packages/SublimeNumeral/SublimeNumeral.sublime-settings
.
Default value: "binary"
Option is useful when trying to convert under ambiguous situation, e.g. 1000 - could be either
BIN
orDEC
orHEX
.
Available options are: "decimal", "hexadecimal" and "binary"
Default value: false
Set if all letters included in a number will be capitalized.
E.g.
0x100fcc -> 0x100FCC
Default value: true
Set if prefix '0b' will be used for outputting a binary numbers.
Default value: true
Set if prefix '0x' will be used for outputting a hexadecimal numbers.
Default value: false
Fill a binary number with a zeros up to the nearest byte
E.g. if the option is false
0x25 -> 0b100101
E.g. if the option is true0x25 -> 0b00100101
Default value: false
Fill a binary number with a zeros up to the nearest even-counted byte
E.g. if the option is 'false':
0x25 -> 0b100101
E.g. if the option is 'true':0x25 -> 0b0000000000100101
(2^1)
E.g. if the option is 'true':0x2525 -> 0b0010010100100101
(2^1)
E.g. if the option is 'true':0x22525 -> 0b00000000000000100010010100100101
(2^2)
Default value: 0
The same as previous option but count of bytes, the number will be aligned to, can be fixed set. Cancels the option opt_binary_leading_align if not zero.
Settings number is a count of bits! And if the number exceeds that count, nothing happens.
Available range is 0 - disable, 1-256 bits