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
-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 ;
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* ;
: 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 -- )