From b129623080dbd3843a3c94ff82f7cd38b74887bd Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 6 Apr 2013 14:23:06 -0700 Subject: [PATCH] editors.sublime: Add support for Sublime Editor 2 for MacOSX. Need to add support for Windows. --- basis/editors/sublime/authors.txt | 1 + basis/editors/sublime/sublime.factor | 31 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 basis/editors/sublime/authors.txt create mode 100644 basis/editors/sublime/sublime.factor diff --git a/basis/editors/sublime/authors.txt b/basis/editors/sublime/authors.txt new file mode 100644 index 0000000000..7c1b2f2279 --- /dev/null +++ b/basis/editors/sublime/authors.txt @@ -0,0 +1 @@ +Doug Coleman diff --git a/basis/editors/sublime/sublime.factor b/basis/editors/sublime/sublime.factor new file mode 100644 index 0000000000..11ac974402 --- /dev/null +++ b/basis/editors/sublime/sublime.factor @@ -0,0 +1,31 @@ +! Copyright (C) 2013 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: editors io.pathnames io.standard-paths kernel make +math.parser namespaces sequences system ; +IN: editors.sublime + +SINGLETON: sublime +sublime editor-class set-global + +HOOK: find-sublime-path os ( -- path ) + +M: object find-sublime-path "sublime" ; + +M: macosx find-sublime-path + "com.sublimetext.2" find-native-bundle [ + "Contents/SharedSupport/bin/subl" append-path + ] [ + f + ] if* ; + +ERROR: editor-not-found editor ; + +: sublime-path ( -- path ) + \ sublime-path get-global [ + find-sublime-path [ "sublime" editor-not-found ] unless* + ] unless* ; + +M: sublime editor-command ( file line -- command ) + [ + sublime-path , "-a" , number>string ":" glue , + ] { } make ;