Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dec to Hex #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Context.sublime-menu
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
[
[
{"command": "dec_to_hex"},
{"command": "dec_to_bin"},
{"command": "bin_to_dec"},
{"command": "hex_to_dec"},
{"command": "ascii_to_hex"},
{"command": "hex_to_ascii"}


]
]
19 changes: 10 additions & 9 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[
{
"id": "selection",
"children":
[
{"command": "ascii_to_hex"},
{"command": "hex_to_ascii"}
]
}
[
{
"id": "selection",
"children":
[
{"command": "dec_to_hex"},
{"command": "ascii_to_hex"},
{"command": "hex_to_ascii"}
]
}
]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sublime Text 2 ASCII<->Hex converter Plugin #
# Sublime Text 2/3 ASCII<->Hex DEC->HEX converter Plugin #

Sublime Text 2 plugin to convert ASCII->Hex and Hex->ASCII
Sublime Text 2/3 plugin to convert ASCII<->Hex and DEC->HEX (Thanks By Carghaez)

## Usage ##

Expand Down
13 changes: 13 additions & 0 deletions dec_to_hex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sublime
import sublime_plugin


class DecToHexCommand(sublime_plugin.TextCommand):

def run(self, edit):
v = self.view
reglist = list(v.sel())
for j in range(0, len(reglist)):
hx = v.substr(v.sel()[j])
hx = hex(int(hx, 10))
v.replace(edit, v.sel()[j], hx)