-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
+++ /dev/null
-Doug Coleman
+++ /dev/null
-not loaded
+++ /dev/null
-USING: kernel namespaces editors.gvim system ;
-IN: editors.gvim.unix
-
-M: unix gvim-path
- \ gvim-path get-global [
- "gvim"
- ] unless* ;
-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 ;
-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 ;
-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