Created
November 23, 2012 20:11
-
-
Save andersonfreitas/4137085 to your computer and use it in GitHub Desktop.
Sublime plugin to convert multibyte strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import sublime, sublime_plugin | |
import re | |
from unicodedata import normalize | |
class NormalizeSelectionCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
sels = self.view.sel() | |
for sel in sels: | |
selected = self.view.substr(sel) | |
norm = normalize('NFC', selected) | |
self.view.replace(edit, sel, norm) |
{ "keys": ["super+shift+m"], "command": "normalize_selection" },
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{ "keys": ["\\", "m"], "command": "normalize_selection", "context": [{ "key": "setting.command_mode", "operand": true }, { "key": "setting.is_widget", "operand": false } ]},