]> gitweb.factorcode.org Git - factor.git/blob - basis/editors/vim/vim.factor
editors: adding EDITOR: syntax and use classes instead of tuples
[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 SINGLETON: vim
6
7 MIXIN: vim-base
8
9 INSTANCE: vim vim-base
10
11 editor-class [ vim ] initialize
12
13 SYMBOL: vim-path
14
15 HOOK: find-vim-path editor-class ( -- path )
16
17 HOOK: vim-ui? editor-class ( -- ? )
18
19 SYMBOL: vim-tabs?
20
21 M: vim-base vim-ui? f ;
22
23 M: vim-base find-vim-path "vim" ?find-in-path ;
24
25 : actual-vim-path ( -- path )
26     \ vim-path get [ find-vim-path ] unless* ;
27
28 M: vim-base editor-command
29     [
30         actual-vim-path dup string? [ , ] [ % ] if
31         vim-ui? [ "-g" , ] when
32         vim-tabs? get [ "--remote-tab-silent" , ] when
33         number>string "+" prepend ,
34         ,
35     ] { } make ;
36
37 M: vim-base editor-detached? f ;