]> gitweb.factorcode.org Git - factor.git/commitdiff
autofind the path for gvim on unix and windows
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 10 Dec 2007 00:16:24 +0000 (18:16 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 10 Dec 2007 00:16:24 +0000 (18:16 -0600)
extra/editors/gvim/gvim.factor
extra/editors/gvim/unix/unix.factor [new file with mode: 0644]
extra/editors/gvim/windows/windows.factor [new file with mode: 0644]

index 024f5cfffaa92e4717823847c0e6f3b0a88d6a1a..802ab51c7acea47ef0783cb66808e56f923cc7cb 100644 (file)
@@ -1,10 +1,18 @@
-USING: kernel math math.parser namespaces editors.vim ;
+USING: io.backend io.files kernel math math.parser
+namespaces editors.vim sequences system windows.shell32 ;
 IN: editors.gvim
 
 TUPLE: gvim ;
 
+HOOK: gvim-path io-backend ( -- path )
+
+
 M: gvim vim-command ( file line -- string )
-    [ "\"" % vim-path get % "\" \"" % swap % "\" +" % # ] "" make ;
+    [ "\"" % gvim-path % "\" \"" % swap % "\" +" % # ] "" make ;
+
+t vim-detach set-global ! don't block the ui
 
 T{ gvim } vim-editor set-global
-"gvim" vim-path set-global
+
+USE-IF: unix? editors.gvim.unix
+USE-IF: windows? editors.gvim.windows
diff --git a/extra/editors/gvim/unix/unix.factor b/extra/editors/gvim/unix/unix.factor
new file mode 100644 (file)
index 0000000..fd295cc
--- /dev/null
@@ -0,0 +1,7 @@
+USING: editors.gvim io.unix.backend kernel namespaces ;
+IN: editors.gvim.unix
+
+M: unix-io gvim-path
+    \ gvim-path get-global [
+        "gvim"
+    ] unless* ;
diff --git a/extra/editors/gvim/windows/windows.factor b/extra/editors/gvim/windows/windows.factor
new file mode 100644 (file)
index 0000000..5a3ea6b
--- /dev/null
@@ -0,0 +1,8 @@
+USING: editors.gvim io.files io.windows kernel namespaces
+sequences windows.shell32 ;
+IN: editors.gvim.windows
+
+M: windows-io gvim-path
+    \ gvim-path get-global [
+        program-files walk-dir [ "gvim.exe" tail? ] find nip
+    ] unless* ;