PK!eN% texteditor.py#!/usr/bin/env python """ """ import io import os import pkg_resources import re import sys import subprocess import tempfile from distutils.spawn import find_executable __version__ = '1.0.1' 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 + [ '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): r"""Split by spaces unless escaped. >>> split_editor_cmd(r'my\ editor --wait') ['my\\ editor', '--wait'] """ return re.split(r'(?lƽdIwz܈(sÍv UjM`(]eOJ7ݺr+:mxx™jj])&k$A+I~GJ6|6)6m|"V>]kt4Iz 'UyA[Fa0e͘.IREp%mc;'QN&ki~-Ǎ2$0 ,P&\-!̂wFyws¸7* +k:V6ڊ  ^y=9=?=: lߐ eӰ7_1^^1./&);iKƆ6zW g\)>y&*+΍ѦH! HEi?+Irɮ K%8@zoxWڡjB9rlWVs*qm!M4 wIj4OS"MVb'i+I+m'@BxbTCdP|o2LD%oܶ]2}Jg Fތ,n|%<6r)oFY(䩮Wuz nF-ZRB?(ڽ!dV%:0'N#)l{Uaw7dL"u#Q,0ilWf Vi@}^H.Bœe UqScZp!aO7Z83l /E.8A XN܉MB$ zojhćz1#C,bS%S2=E*ve7=ze#qqxV‰@ӫUF@;Q8GPK!H\h"text_editor-1.0.1.dist-info/RECORD}rC@|R֥<պuxʈTZ*tʕEzw0}ePQ8A5xjw:[VT GF Hz`D^E']տx?C̳mѹA-2.3SXW87Pm&9M}cI՝>u &s)#Չc/,M.&-pLYj$vpH.6I8<PK!eN% texteditor.pyPK!