PK!<4S 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.1' EDITOR = 'EDITOR' """Why not include vim or emacs? Because: 1. If you are using it, you know what the EDITOR variable is, and you probably has set it already.it 2. If you aren't using it, finding yourself in their UI for the first time is going to be super confusing, in fact "How to exit vim" is a common Stack Overflow question. Having to google how to set an EDITOR variable is a less scary alternative. """ COMMON_EDITORS = [ 'subl', 'vscode', 'atom', ] 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 + [ '/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', ] WINDOWS_EDITORS = COMMON_EDITORS + [ '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 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'(?W;!ZUbƜxt&\_毓mfR>k+̄{0W "{݊Kuv6.y^v%osrJJQRBYh\]'aMegq>zf~n.bǻL\63 5O$^a7?/w V.3Zsf-؍U_:dly#.;+)T)H-!{1$q}wNTg>+5@jDtaUnO. o[Rj٣HOo+}ƏiO^w;pkn^ufȹF s*5&0E.x{B'%Nnt<<LȎf45.PJv󠕤~?og௣dKw>\Y6>t+׮m5y$c= -vh0[ݲAfqT$)"ȶƱod('G ޖusxLIWq(.bc ـof;|D#oƎtPPm7 >S7#!#%kTtH1m}3&GB>I0CELK%-IՁ'jrY7 0eoC~,b>svk` t@1aE[d{҆RUBb׌U֡|2㉁F dNu4mxw qv/7Kӈm'J< WCq3㨿k̓H?BXxX|~vq}[J+lbzyA&L!{]G6l*w@&T5hMTOe }[T+: =h7e eMWjVt)A +н02&ֺ(wK r[4х4ڀKpV J/I$!oa2C1MA-0-O懗"zz[mz{Ip|,e&!pv=7j_v4E =!i1eϩ)";=ӲӃoR<tD MU|Y*#Y(#A_PK!H<"text_editor-1.0.2.dist-info/RECORD}r0лhYC2e{q\Ђp}cKo&@~T 70=0aS>-)TdAWo97")( r5g'S{Wκs<⃆"hZ0saZcHPM-lxI҅