mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-22 17:05:42 +08:00
feat(chat): complete channels
This commit is contained in:
parent
ac44f30ec4
commit
f0912bb7dd
@ -119,6 +119,11 @@ function! s:gitter_fetch_exit(id, data, event) abort
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:channels = ['SpaceVim']
|
||||||
|
function! chat#gitter#get_channels() abort
|
||||||
|
return s:channels
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! chat#gitter#send(msg) abort
|
function! chat#gitter#send(msg) abort
|
||||||
call s:JOB.start(printf(g:gitter_send_command, substitute(a:msg, '"', '\\\"', 'g')))
|
call s:JOB.start(printf(g:gitter_send_command, substitute(a:msg, '"', '\\\"', 'g')))
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -253,6 +253,16 @@ function! s:complete(base,num) abort
|
|||||||
if len(rsl) > 0
|
if len(rsl) > 0
|
||||||
return matchstr(a:base, '^/set_protocol\s*') . rsl[a:num % len(rsl)]
|
return matchstr(a:base, '^/set_protocol\s*') . rsl[a:num % len(rsl)]
|
||||||
endif
|
endif
|
||||||
|
elseif a:base =~# '^/set_channel\s*\w*$' && !empty(s:protocol)
|
||||||
|
let channels = []
|
||||||
|
try
|
||||||
|
let channels = chat#{s:protocol}#get_channels()
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
let rsl = filter(copy(channels), "v:val =~# matchstr(a:base, '\w*$') .'[^\ .]*'")
|
||||||
|
if len(rsl) > 0
|
||||||
|
return matchstr(a:base, '^/set_channel\s*') . rsl[a:num % len(rsl)]
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return a:base
|
return a:base
|
||||||
|
Loading…
x
Reference in New Issue
Block a user