Find the macvim bundle or use mvim. Add a flag for -g option to vim.

db4
Doug Coleman 2011-10-30 16:10:27 -07:00
parent ada631c202
commit 0774944b8d
3 changed files with 18 additions and 11 deletions

View 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
os windows? [ "editors.gvim.windows" require ] when

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

View 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 -- )