factor/basis/editors/vim/vim.factor

33 lines
697 B
Factor
Raw Normal View History

2015-06-01 17:39:30 -04:00
USING: editors io.standard-paths kernel make math.parser
namespaces sequences strings ;
2007-09-20 18:09:08 -04:00
IN: editors.vim
TUPLE: vim ;
T{ vim } editor-class set-global
SYMBOL: vim-path
HOOK: find-vim-path editor-class ( -- path )
2015-06-01 17:39:30 -04:00
HOOK: vim-ui? editor-class ( -- ? )
2015-06-01 17:39:30 -04:00
2015-06-27 22:18:22 -04:00
SYMBOL: vim-tabs?
M: vim vim-ui? f ;
2015-06-01 17:39:30 -04:00
M: vim find-vim-path "vim" ?find-in-path ;
: actual-vim-path ( -- path )
2015-06-01 17:39:30 -04:00
\ vim-path get [ find-vim-path ] unless* ;
M: vim editor-command ( file line -- command )
2008-01-24 02:50:40 -05:00
[
actual-vim-path dup string? [ , ] [ % ] if
vim-ui? [ "-g" , ] when
2015-06-27 22:18:22 -04:00
vim-tabs? get [ "--remote-tab-silent" , ] when
number>string "+" prepend ,
,
2008-01-24 02:50:40 -05:00
] { } make ;
2007-09-20 18:09:08 -04:00
M: vim editor-detached? f ;