Skip to content

Commit 8a31de6

Browse files
authored
compiler(rime_deployer): include new compiler, use it for '*.custom.yaml' files (#14460)
Signed-off-by: Wu, Zhenyu <wuzhenyu@ustc.edu> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 799dede commit 8a31de6

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

runtime/compiler/rime_deployer.vim

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
" Vim Compiler File
2+
" Language: rime_deployer
3+
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
4+
" URL: https://rime.im
5+
" Latest Revision: 2024-04-09
6+
7+
if exists('b:current_compiler')
8+
finish
9+
endif
10+
let b:current_compiler = 'rime_deployer'
11+
12+
let s:save_cpoptions = &cpoptions
13+
set cpoptions&vim
14+
15+
" Android Termux
16+
let s:prefix = getenv('PREFIX')
17+
if s:prefix == v:null
18+
let s:prefix = '/usr'
19+
endif
20+
" Android, NixOS, GNU/Linux, BSD
21+
for s:shared_data_dir in ['/sdcard/rime-data', '/run/current-system/sw/share/rime-data', '/usr/local/share/rime-data', s:prefix . '/share/rime-data']
22+
if isdirectory(s:shared_data_dir)
23+
break
24+
endif
25+
endfor
26+
execute 'CompilerSet makeprg=rime_deployer\ --build\ %:p:h:S\' s:shared_data_dir
27+
unlet s:prefix s:shared_data_dir
28+
29+
let &cpoptions = s:save_cpoptions
30+
unlet s:save_cpoptions

runtime/ftplugin/yaml.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ let b:undo_ftplugin = "setl com< cms< et< fo<"
1616
setlocal comments=:# commentstring=#\ %s expandtab
1717
setlocal formatoptions-=t formatoptions+=croql
1818

19+
" rime input method engine uses `*.custom.yaml` as its config files
20+
if expand('%:r:e') ==# 'custom'
21+
compiler rime_deployer
22+
setlocal include=__include:\\s*
23+
let b:undo_ftplugin ..= " inc<"
24+
endif
25+
1926
if !exists("g:yaml_recommended_style") || g:yaml_recommended_style != 0
2027
let b:undo_ftplugin ..= " sw< sts<"
2128
setlocal shiftwidth=2 softtabstop=2

0 commit comments

Comments
 (0)