An open API service indexing awesome lists of open source software.

https://github.com/deathaxe/sublime-hexbindec

Hexadecimal-Binary-Decimal converter for SublimeText 3
https://github.com/deathaxe/sublime-hexbindec

sublime-package sublime-text sublime-text-plugin

Last synced: 11 months ago
JSON representation

Hexadecimal-Binary-Decimal converter for SublimeText 3

Awesome Lists containing this project

README

          

# [HexBinDec][home]
[![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?style=flat-square)](http://opensource.org/licenses/MIT)

This package provides ability to inplace change the base of numbers in [SublimeText 3 Editor][1].

## Usage
1. Move the cursor over a number or select one or more numbers.
2. Press one of the following key combinations to convert the numbers.

- Ctrl+shift+b, ctrl+shift+d binary to decimal
- Ctrl+shift+b, ctrl+shift+h binary to hexadecimal
- Ctrl+shift+d, ctrl+shift+b binary to decimal
- Ctrl+shift+d, ctrl+shift+h binary to hexadecimal
- Ctrl+shift+h, ctrl+shift+b hexadecimal to binary
- Ctrl+shift+h, ctrl+shift+d hexadecimal to decimal

The commands are available in
- command pallet under `Convert Number: ...`
- main menu -> edit -> Convert Numbers
- context menu -> Convert Numbers

## Setup
You can setup patterns to identify binary, decimal and hexadecimal numbers for each syntax just by adding the following settings to the syntax specific settings file `.sublime-settings`.

```javascript
// ...

// Define the format of binary numbers for the Hex-Bin-System plugin
// Binaries look like 'B101110'
"convert_src_bin": "'B([01]+)'",
"convert_dst_bin": "'B{0:b}'",

// Define the format of hexadecimal numbers for the Hex-Bin-System plugin
// Hexadecimals look like 'H1AF23'
"convert_src_hex": "'H([0-9A-F]+)'",
"convert_dst_hex": "'H{0:X}'",

// Define the format of exponential numbers for the Hex-Bin-System plugin
// The pattern must match the base as group 1 and exponent as group 2.
// Exponential numbers look like 3.14EX-4
"convert_src_exp": "\\b([1-9]\\.\\d+)EX([-+]?\\d+)\\b",
"convert_dst_exp": "EX",

// ...
```

## Inspired by

[Hex-Bin-System][2] by ALLZ

[home]:
[1]:
[2]: