]> gitweb.factorcode.org Git - factor.git/commitdiff
editors.sublime: Add support for Sublime Editor 2 for MacOSX. Need to add support...
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 6 Apr 2013 21:23:06 +0000 (14:23 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 6 Apr 2013 21:24:03 +0000 (14:24 -0700)
basis/editors/sublime/authors.txt [new file with mode: 0644]
basis/editors/sublime/sublime.factor [new file with mode: 0644]

diff --git a/basis/editors/sublime/authors.txt b/basis/editors/sublime/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/editors/sublime/sublime.factor b/basis/editors/sublime/sublime.factor
new file mode 100644 (file)
index 0000000..11ac974
--- /dev/null
@@ -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 ;