-
Notifications
You must be signed in to change notification settings - Fork 30
/
fvim.vim
100 lines (88 loc) · 6.11 KB
/
fvim.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
let g:clipboard = {
\ 'name': 'FVimClipboard',
\ 'copy': {
\ '+': {lines, regtype -> rpcrequest(g:fvim_channel, 'set-clipboard', lines, regtype)},
\ '*': {lines, regtype -> rpcrequest(g:fvim_channel, 'set-clipboard', lines, regtype)},
\ },
\ 'paste': {
\ '+': {-> rpcrequest(g:fvim_channel, 'get-clipboard')},
\ '*': {-> rpcrequest(g:fvim_channel, 'get-clipboard')},
\ }
\ }
if exists('g:loaded_clipboard_provider')
unlet g:loaded_clipboard_provider
runtime autoload/provider/clipboard.vim
endif
command! -nargs=0 FVimDetach call rpcnotify(g:fvim_channel, 'remote.detach')
command! -nargs=0 FVimToggleFullScreen call rpcnotify(g:fvim_channel, 'ToggleFullScreen')
command! -complete=expression -nargs=1 FVimCursorSmoothMove call rpcnotify(g:fvim_channel, 'cursor.smoothmove', <args>)
command! -complete=expression -nargs=1 FVimCursorSmoothBlink call rpcnotify(g:fvim_channel, 'cursor.smoothblink', <args>)
command! -complete=expression -nargs=1 FVimFontLineHeight call rpcnotify(g:fvim_channel, 'font.lineheight', <args>)
command! -complete=expression -nargs=1 FVimFontAutoSnap call rpcnotify(g:fvim_channel, 'font.autosnap', <args>)
command! -complete=expression -nargs=1 FVimFontAntialias call rpcnotify(g:fvim_channel, 'font.antialias', <args>)
command! -complete=expression -nargs=1 FVimFontLigature call rpcnotify(g:fvim_channel, 'font.ligature', <args>)
command! -complete=expression -nargs=1 FVimFontDrawBounds call rpcnotify(g:fvim_channel, 'font.drawBounds', <args>)
command! -complete=expression -nargs=1 FVimFontAutohint call rpcnotify(g:fvim_channel, 'font.autohint', <args>)
command! -complete=expression -nargs=1 FVimFontSubpixel call rpcnotify(g:fvim_channel, 'font.subpixel', <args>)
command! -complete=expression -nargs=1 FVimFontHintLevel call rpcnotify(g:fvim_channel, 'font.hintLevel', <args>)
command! -complete=expression -nargs=1 FVimFontNormalWeight call rpcnotify(g:fvim_channel, 'font.weight.normal', <args>)
command! -complete=expression -nargs=1 FVimFontBoldWeight call rpcnotify(g:fvim_channel, 'font.weight.bold', <args>)
command! -complete=expression -nargs=1 FVimFontNoBuiltinSymbols call rpcnotify(g:fvim_channel, 'font.nonerd', <args>)
command! -complete=expression -nargs=1 FVimKeyDisableShiftSpace call rpcnotify(g:fvim_channel, 'key.disableShiftSpace', <args>)
command! -complete=expression -nargs=1 FVimKeyAutoIme call rpcnotify(g:fvim_channel, 'key.autoIme', <args>)
command! -complete=expression -nargs=1 FVimKeyAltGr call rpcnotify(g:fvim_channel, 'key.altGr', <args>)
" let! _ = nvim.``command!`` -complete=expression FVimUIMultiGrid 1 call rpcnotify(g:fvim_channel, 'ui.multigrid', <args>)
command! -complete=expression -nargs=1 FVimUIPopupMenu call rpcnotify(g:fvim_channel, 'ui.popupmenu', <args>)
" let! _ = nvim.``command!`` -complete=expression FVimUITabLine 1 call rpcnotify(g:fvim_channel, 'ui.tabline', <args>)
" let! _ = nvim.``command!`` -complete=expression FVimUICmdLine 1 call rpcnotify(g:fvim_channel, 'ui.cmdline', <args>)
command! -complete=expression -nargs=1 FVimUIWildMenu call rpcnotify(g:fvim_channel, 'ui.wildmenu', <args>)
" let! _ = nvim.``command!`` -complete=expression FVimUIMessages 1 call rpcnotify(g:fvim_channel, 'ui.messages', <args>)
" let! _ = nvim.``command!`` -complete=expression FVimUITermColors 1 call rpcnotify(g:fvim_channel, 'ui.termcolors', <args>)
" let! _ = nvim.``command!`` -complete=expression FVimUIHlState 1 call rpcnotify(g:fvim_channel, 'ui.hlstate', <args>)
command! -complete=expression -nargs=1 FVimDrawFPS call rpcnotify(g:fvim_channel, 'DrawFPS', <args>)
command! -complete=expression -nargs=1 FVimCustomTitleBar call rpcnotify(g:fvim_channel, 'CustomTitleBar', <args>)
command! -complete=expression -nargs=1 FVimNoTitleBar call rpcnotify(g:fvim_channel, 'NoTitleBar', <args>)
command! -complete=expression -nargs=1 FVimBackgroundOpacity call rpcnotify(g:fvim_channel, 'background.opacity', <args>)
command! -complete=expression -nargs=1 FVimBackgroundComposition call rpcnotify(g:fvim_channel, 'background.composition', <args>)
command! -complete=expression -nargs=1 FVimBackgroundAltOpacity call rpcnotify(g:fvim_channel, 'background.altopacity', <args>)
command! -complete=expression -nargs=1 FVimBackgroundImage call rpcnotify(g:fvim_channel, 'background.image.file', <args>)
command! -complete=expression -nargs=1 FVimBackgroundImageOpacity call rpcnotify(g:fvim_channel, 'background.image.opacity', <args>)
command! -complete=expression -nargs=1 FVimBackgroundImageStretch call rpcnotify(g:fvim_channel, 'background.image.stretch', <args>)
command! -complete=expression -nargs=1 FVimBackgroundImageHAlign call rpcnotify(g:fvim_channel, 'background.image.halign', <args>)
command! -complete=expression -nargs=1 FVimBackgroundImageVAlign call rpcnotify(g:fvim_channel, 'background.image.valign', <args>)
command! -complete=expression -nargs=1 FVimDefaultWindowWidth call rpcnotify(g:fvim_channel, 'default.width', <args>)
command! -complete=expression -nargs=1 FVimDefaultWindowHeight call rpcnotify(g:fvim_channel, 'default.height', <args>)
function! s:fvim_on_bufwinenter()
let l:bufnr=expand("<abuf>")
let l:wins=win_findbuf(l:bufnr)
call rpcnotify(g:fvim_channel, 'OnBufWinEnter', l:bufnr, l:wins)
endfunction
function! s:fvim_on_winenter()
let l:win=nvim_get_current_win()
let l:bufnr=nvim_win_get_buf(l:win)
let l:wins=win_findbuf(l:bufnr)
call rpcnotify(g:fvim_channel, 'OnBufWinEnter', l:bufnr, l:wins)
endfunction
function! s:fvim_on_cursorhold()
let l:bufnr=nvim_get_current_buf()
let l:signs=sign_getplaced(l:bufnr, {'group': '*'})
call rpcnotify(g:fvim_channel, 'OnSignUpdate', l:bufnr, l:signs)
endfunction
function! s:fvim_on_vim_enter()
runtime! ginit.vim
call rpcnotify(g:fvim_channel, 'OnInitComplete')
endfunction
augroup FVim
autocmd BufWinEnter * call s:fvim_on_bufwinenter()
autocmd WinEnter * call s:fvim_on_winenter()
autocmd WinNew * call s:fvim_on_winenter()
autocmd WinScrolled * call s:fvim_on_winenter()
autocmd CursorHold * call s:fvim_on_cursorhold()
autocmd CursorHoldI * call s:fvim_on_cursorhold()
augroup END
" trigger upon VimEnter
if v:vim_did_enter
call s:fvim_on_vim_enter()
else
autocmd VimEnter * call s:fvim_on_vim_enter()
endif