Clean up editors.*vim so that it runs detached with gvim and there is less

code duplication. Use mvim on mac. Remove gvim.unix vocabulary since it
doesn't do anything besides return "gvim" as the path.
db4
Doug Coleman 2011-10-29 15:10:42 -07:00
parent 8205caa5ca
commit 5594e82492
7 changed files with 36 additions and 50 deletions

View File

@ -1,24 +1,17 @@
USING: io.backend io.files kernel math math.parser
namespaces sequences system combinators
editors.vim vocabs.loader make ;
USING: editors.vim io.backend kernel namespaces system
vocabs.loader ;
IN: editors.gvim
! This code builds on the code in editors.vim; see there for
! more information.
SINGLETON: gvim
HOOK: gvim-path io-backend ( -- path )
M: gvim vim-command ( file line -- string )
[
gvim-path ,
number>string "+" prepend , ,
] { } make ;
gvim vim-editor set-global
{
{ [ os unix? ] [ "editors.gvim.unix" ] }
{ [ os windows? ] [ "editors.gvim.windows" ] }
} cond require
HOOK: find-gvim-path io-backend ( -- path )
M: object find-gvim-path f ;
M: gvim find-vim-path find-gvim-path "gvim" or ;
M: gvim vim-detached? t ;
os windows? [ "editors.gvim.windows" require ] when

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1 +0,0 @@
not loaded

View File

@ -1,7 +0,0 @@
USING: kernel namespaces editors.gvim system ;
IN: editors.gvim.unix
M: unix gvim-path
\ gvim-path get-global [
"gvim"
] unless* ;

View File

@ -1,10 +1,6 @@
USING: editors.gvim io.files kernel namespaces sequences
windows.shell32 io.directories.search.windows system
io.pathnames ;
USING: editors.gvim io.directories.search.windows sequences
system ;
IN: editors.gvim.windows
M: windows gvim-path
\ gvim-path get-global [
"vim" [ "gvim.exe" tail? ] find-in-program-files
[ "gvim.exe" ] unless*
] unless* ;
M: windows find-gvim-path
"vim" [ "gvim.exe" tail? ] find-in-program-files ;

View File

@ -1,10 +1,8 @@
USING: definitions io.launcher kernel math math.parser parser
namespaces prettyprint editors make ;
USING: editors.vim kernel namespaces ;
IN: editors.macvim
: macvim ( file line -- )
drop
[ "open" , "-a" , "MacVim", , ] { } make
run-detached drop ;
SINGLETON: macvim
macvim \ vim-editor set-global
[ macvim ] edit-hook set-global
M: macvim vim-path \ vim-path get-global "mvim" or ;
M: macvim vim-detached? t ;

View File

@ -1,23 +1,31 @@
USING: definitions io io.launcher kernel math math.parser
namespaces parser prettyprint sequences editors accessors
make strings ;
USING: editors io.backend io.launcher kernel make math.parser
namespaces sequences strings system vocabs.loader ;
IN: editors.vim
SYMBOL: vim-path
SYMBOL: vim-editor
HOOK: vim-command vim-editor ( file line -- array )
SINGLETON: vim
\ vim vim-editor set-global
M: vim vim-command
SYMBOL: vim-path
HOOK: find-vim-path vim-editor ( -- path )
HOOK: vim-detached? vim-editor ( -- detached? )
M: vim find-vim-path "vim" ;
M: vim vim-detached? f ;
: actual-vim-path ( -- path )
\ vim-path get-global [ find-vim-path ] unless* ;
: vim-command ( file line -- command )
[
vim-path get dup string? [ , ] [ % ] if
actual-vim-path dup string? [ , ] [ % ] if
[ , ] [ number>string "+" prepend , ] bi*
] { } make ;
: vim ( file line -- )
vim-command run-process drop ;
vim-command vim-detached? [ run-detached ] [ run-process ] if drop ;
"vim" vim-path set-global
[ vim ] edit-hook set-global
\ vim vim-editor set-global