call vim with run-detached instead of try-process. clean up vim code.

Doug Coleman 2009-05-15 16:06:48 -05:00
parent 67164321a6
commit 829e7c41d9
4 changed files with 14 additions and 13 deletions

View File

@ -11,7 +11,10 @@ SINGLETON: gvim
HOOK: gvim-path io-backend ( -- path )
M: gvim vim-command ( file line -- string )
[ gvim-path , "+" swap number>string append , , ] { } make ;
[
gvim-path ,
number>string "+" prepend , ,
] { } make ;
gvim vim-editor set-global

View File

@ -3,11 +3,9 @@ namespaces prettyprint editors make ;
IN: editors.macvim
: macvim-location ( file line -- )
: macvim ( file line -- )
drop
[ "open" , "-a" , "MacVim", , ] { } make
try-process ;
[ macvim-location ] edit-hook set-global
run-detached drop ;
[ macvim ] edit-hook set-global

View File

@ -3,7 +3,7 @@ USING: definitions editors help help.markup help.syntax io io.files
IN: editors.vim
ARTICLE: { "vim" "vim" } "Vim support"
"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim-location } ". The " { $link vim-path } " variable contains the name of the vim executable. The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "."
"This module makes the " { $link edit } " word work with Vim by setting the " { $link edit-hook } " global variable to call " { $link vim } ". The " { $link vim-path } " variable contains the name of the vim executable. The default " { $link vim-path } " is " { $snippet "\"gvim\"" } "."
$nl
"If you intend to use this module regularly, it helps to have it load during stage 2 bootstrap. On Windows, place the following example " { $snippet ".factor-boot-rc" } " in the directory returned by " { $link home } ":"
{ $code

View File

@ -4,7 +4,6 @@ make ;
IN: editors.vim
SYMBOL: vim-path
SYMBOL: vim-editor
HOOK: vim-command vim-editor ( file line -- array )
@ -12,12 +11,13 @@ SINGLETON: vim
M: vim vim-command
[
vim-path get , swap , "+" swap number>string append ,
vim-path get ,
[ , ] [ number>string "+" prepend , ] bi*
] { } make ;
: vim-location ( file line -- )
vim-command try-process ;
: vim ( file line -- )
vim-command run-detached drop ;
"vim" vim-path set-global
[ vim-location ] edit-hook set-global
vim vim-editor set-global
[ vim ] edit-hook set-global
\ vim vim-editor set-global