diff --git a/Context.sublime-menu b/Context.sublime-menu index 92f617b..adb80f3 100644 --- a/Context.sublime-menu +++ b/Context.sublime-menu @@ -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"} - - -] \ No newline at end of file +] \ No newline at end of file diff --git a/Main.sublime-menu b/Main.sublime-menu index 7bacc28..e8eea4a 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -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"} + ] + } ] \ No newline at end of file diff --git a/README.md b/README.md index 561163a..1b6700a 100644 --- a/README.md +++ b/README.md @@ -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 ## diff --git a/dec_to_hex.py b/dec_to_hex.py new file mode 100644 index 0000000..f4f6983 --- /dev/null +++ b/dec_to_hex.py @@ -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)