editors.sublime: Add support for Sublime Editor 2 for MacOSX. Need to add support for Windows.

db4
Doug Coleman 2013-04-06 14:23:06 -07:00
parent 0e425e70d0
commit b129623080
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -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 ;