PK!Xk1 texteditor.py#!/usr/bin/env python """ """ import io import os import re import sys import subprocess import tempfile from distutils.spawn import find_executable __version__ = '1.0.0' EDITOR = 'EDITOR' COMMON_EDITORS = [ 'subl', 'vscode', 'atom', ] THE_GREY_ONES = [ 'vim', 'emacs', ] MACOS_EDITORS = [ # Only in MacOS, the "shell commands" are not installed by default '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl', '/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code', '/Applications/Atom.app/Contents/Resources/app/atom.sh', '/Applications/TextMate.app/Contents/Resources/mate', '/Applications/Brackets.app/Contents/Resources/brackets.sh', ] + COMMON_EDITORS + THE_GREY_ONES + [ '/Applications/TextEdit.app/Contents/MacOS/TextEdit', ] # In some linuxes `vim` and/or `emacs` come preinstalled, but we don't want # to throw you to their unfamiliar UI unless there are other options. # If you are using them you probably have set your $EDITOR variable anyway. LINUX_EDITORS = COMMON_EDITORS + [ 'kate', 'geany', 'gedit', 'nano', ] + THE_GREY_ONES WINDOWS_EDITORS = COMMON_EDITORS + THE_GREY_ONES + [ r'C:\Program Files (x86)\Notepad++\notepad++.exe', 'notepad.exe', ] EDITORS = { 'darwin': MACOS_EDITORS, 'linux': LINUX_EDITORS, 'win': WINDOWS_EDITORS, } def get_possible_editors(): sys_platform = sys.platform for platform in EDITORS: if sys_platform.startswith(platform): return EDITORS[platform] return COMMON_EDITORS + THE_GREY_ONES def split_editor_cmd(cmd): """Split by spaces unless escaped. >>> split_editor_cmd('my\\ editor --wait') ['my\\ editor', '--wait'] """ return re.split(r'(?lǽdI­{ݙQ!) gQ%˞8ouVt 3aK#;4$.SlC*I=΃W%݁Ɛ.my6)6m|!>]ku4I~&ȻUyCGFc0eX.IREH%mc;d(G },Ǎ20,p&\pc @Pof;=sڧ9a\UXoֵP ( +mE0yF^ACOoOϮBh7dײi܇T(/^< {*bY=+b7h3(Orv ΕҎSfZm.ʐ@TД$,! ʸX/XC{7O5}.Fq\YͩuX44`>"mq/klUK!@ Pt6\!T蠜DVKBސtfA~4TOva7` { P;\E"-YaQ74x9֡)hrRt3sȥ'T^2>KCAh}: pPK!Hڰ"text_editor-1.0.0.dist-info/RECORD}лn0@= ,lgiB%*:81N |}*gy]NtKэmdf6%p;5Q"4Wn i(FToK-ޏ/H0׃ aHy_y&>s`|?fȼ[!ۥW1z i?uCBSs C[AgnE}З(hZ)c; lPK!Xk1 texteditor.pyPK!