]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/vim/vim.factor
79618ac08b0a577899d12f8e36be67d4daba0c30
[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 T{ vim } editor-class set-global
7
8 SYMBOL: vim-path
9
10 HOOK: find-vim-path editor-class ( -- path )
11
12 HOOK: vim-ui? editor-class ( -- ? )
13
14 SYMBOL: vim-tabs?
15
16 M: vim vim-ui? f ;
17
18 M: vim find-vim-path "vim" ?find-in-path ;
19
20 : actual-vim-path ( -- path )
21     \ vim-path get [ find-vim-path ] unless* ;
22
23 M: vim editor-command
24     [
25         actual-vim-path dup string? [ , ] [ % ] if
26         vim-ui? [ "-g" , ] when
27         vim-tabs? get [ "--remote-tab-silent" , ] when
28         number>string "+" prepend ,
29         ,
30     ] { } make ;
31
32 M: vim editor-detached? f ;