]> gitweb.factorcode.org Git - factor.git/commitdiff
Find the macvim bundle or use mvim. Add a flag for -g option to vim.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 30 Oct 2011 23:10:27 +0000 (16:10 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 30 Oct 2011 23:11:18 +0000 (16:11 -0700)
basis/editors/gvim/gvim.factor
basis/editors/macvim/macvim.factor
basis/editors/vim/vim.factor

index 2c911c3381897c253c9dbc2f949f255e52a2e460..b0d3399f23b17a0a23368ea5c2302fb09fa6235f 100644 (file)
@@ -13,5 +13,6 @@ M: object find-gvim-path f ;
 
 M: gvim find-vim-path find-gvim-path "gvim" or ;
 M: gvim vim-detached? t ;
+M: gvim vim-ui? t ;
 
-os windows? [ "editors.gvim.windows" require ] when
\ No newline at end of file
+os windows? [ "editors.gvim.windows" require ] when
index 46f346828e68102db50cbfa7706194fe02e34ecc..72a89a0efcbbb2719aaab752f5ec58f7ec9f0322 100644 (file)
@@ -1,13 +1,19 @@
-USING: editors.vim environment fry io.files io.pathnames kernel
-namespaces sequences splitting ;
+USING: core-foundation.launch-services editors.vim io.pathnames
+io.standard-paths kernel namespaces ;
 IN: editors.macvim
 
 SINGLETON: macvim
 macvim \ vim-editor set-global
 
-: find-binary-path ( string -- path/f )
-    [ "PATH" os-env ":" split ] dip '[ _ append-path exists? ] find nip ;
+: find-macvim-bundle-path ( -- path/f )
+    "org.vim.MacVim" find-native-bundle [
+        "Contents/MacOS/Vim" append-path
+    ] [
+        f
+    ] if* ;
+    
+M: macvim find-vim-path
+    find-macvim-bundle-path "mvim" or ;
 
-M: macvim find-vim-path "mvim" find-binary-path { "open" "-a" "MacVim" } or ;
 M: macvim vim-detached? t ;
-M: macvim vim-open-line? f ;
+M: macvim vim-ui? t ;
index 855e2ad1586101da3fc988a961c05d00f3c6f4c1..03e843501512dcc7f5cbaa0ea64d29917dfb8197 100644 (file)
@@ -11,12 +11,11 @@ SYMBOL: vim-path
 
 HOOK: find-vim-path vim-editor ( -- path )
 HOOK: vim-detached? vim-editor ( -- detached? )
-HOOK: vim-open-line? vim-editor ( -- ? )
-
-M: object vim-open-line? t ;
+HOOK: vim-ui? vim-editor ( -- ui? )
 
 M: vim find-vim-path "vim" ;
 M: vim vim-detached? f ;
+M: vim vim-ui? f ;
 
 : actual-vim-path ( -- path )
     \ vim-path get-global [ find-vim-path ] unless* ;
@@ -24,7 +23,8 @@ M: vim vim-detached? f ;
 : vim-command ( file line -- command )
     [
         actual-vim-path dup string? [ , ] [ % ] if
-        [ , ] [ vim-open-line? [ number>string "+" prepend , ] [ drop ] if ] bi*
+        vim-ui? [ "-g" , ] when
+        [ , ] [ number>string "+" prepend , ] bi*
     ] { } make ;
 
 : vim ( file line -- )