]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/vim/vim.factor
editors: allow them to be loaded in the load-all image
[factor.git] / basis / editors / vim / vim.factor
1 USING: editors io.standard-paths kernel make math.parser
2 namespaces sequences strings ;
3 IN: editors.vim
4
5 TUPLE: vim ;
6
7 editor-class [ T{ vim } ] initialize
8
9 SYMBOL: vim-path
10
11 HOOK: find-vim-path editor-class ( -- path )
12
13 HOOK: vim-ui? editor-class ( -- ? )
14
15 SYMBOL: vim-tabs?
16
17 M: vim vim-ui? f ;
18
19 M: vim find-vim-path "vim" ?find-in-path ;
20
21 : actual-vim-path ( -- path )
22     \ vim-path get [ find-vim-path ] unless* ;
23
24 M: vim editor-command
25     [
26         actual-vim-path dup string? [ , ] [ % ] if
27         vim-ui? [ "-g" , ] when
28         vim-tabs? get [ "--remote-tab-silent" , ] when
29         number>string "+" prepend ,
30         ,
31     ] { } make ;
32
33 M: vim editor-detached? f ;