]> gitweb.factorcode.org Git - factor.git/commitdiff
Clean up editors.*vim so that it runs detached with gvim and there is less
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 29 Oct 2011 22:10:42 +0000 (15:10 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 29 Oct 2011 22:10:42 +0000 (15:10 -0700)
code duplication. Use mvim on mac. Remove gvim.unix vocabulary since it
doesn't do anything besides return "gvim" as the path.

basis/editors/gvim/gvim.factor
basis/editors/gvim/unix/authors.txt [deleted file]
basis/editors/gvim/unix/tags.txt [deleted file]
basis/editors/gvim/unix/unix.factor [deleted file]
basis/editors/gvim/windows/windows.factor
basis/editors/macvim/macvim.factor
basis/editors/vim/vim.factor

index 277cd734cc5f9871246669c0c26a7fd0cc67e796..2c911c3381897c253c9dbc2f949f255e52a2e460 100644 (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
+gvim vim-editor set-global
 
-HOOK: gvim-path io-backend ( -- path )
-
-M: gvim vim-command ( file line -- string )
-    [
-        gvim-path ,
-        number>string "+" prepend , ,
-    ] { } make ;
+HOOK: find-gvim-path io-backend ( -- path )
+M: object find-gvim-path f ;
 
-gvim vim-editor set-global
+M: gvim find-vim-path find-gvim-path "gvim" or ;
+M: gvim vim-detached? t ;
 
-{
-    { [ os unix? ] [ "editors.gvim.unix" ] }
-    { [ os windows? ] [ "editors.gvim.windows" ] }
-} cond require
+os windows? [ "editors.gvim.windows" require ] when
\ No newline at end of file
diff --git a/basis/editors/gvim/unix/authors.txt b/basis/editors/gvim/unix/authors.txt
deleted file mode 100755 (executable)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/basis/editors/gvim/unix/tags.txt b/basis/editors/gvim/unix/tags.txt
deleted file mode 100644 (file)
index ebb74b4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-not loaded
diff --git a/basis/editors/gvim/unix/unix.factor b/basis/editors/gvim/unix/unix.factor
deleted file mode 100644 (file)
index 3e2a42e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-USING: kernel namespaces editors.gvim system ;
-IN: editors.gvim.unix
-
-M: unix gvim-path
-    \ gvim-path get-global [
-        "gvim"
-    ] unless* ;
index 3fe228a403322ac25913d0aa0985223ee3515291..380e6bb54fdc80dd7663d4fb5a2d2a11ce7a6e56 100644 (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 ;
index 6dcf724e8ee9840065f74d9319d357bff7e220c7..f67bf141a71991b58e3c7f376e0135a7640c7b72 100644 (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 ;
index 55c3889e009149b562550e70a073dd19c2548835..33e596e1ad33cfb0a22377f4861e5459f47a4fef 100644 (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
+
+SYMBOL: vim-path
+
+HOOK: find-vim-path vim-editor ( -- path )
+HOOK: vim-detached? vim-editor ( -- detached? )
 
-M: vim vim-command
+
+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