mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
feat(vimchat): display user count on statusline
This commit is contained in:
parent
48dfd5d179
commit
c338f45186
@ -453,6 +453,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
|
||||
\ . '%{chat#windows#status().protocol}' . ' %#SpaceVim_statusline_c_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# '
|
||||
\ . '%{chat#windows#status().channel}' . ' %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_c# '
|
||||
\ . '%{chat#windows#status().usercount}'
|
||||
elseif &filetype ==# 'git-status'
|
||||
return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep
|
||||
\ . '%#SpaceVim_statusline_b# Git status %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' '
|
||||
|
@ -224,3 +224,13 @@ function! chat#gitter#send(room, msg) abort
|
||||
\ ]
|
||||
call s:JOB.start(cmd)
|
||||
endfunction
|
||||
|
||||
function! chat#gitter#get_user_count(room) abort
|
||||
let room = filter(deepcopy(s:channels), 'has_key(v:val, "uri") && v:val.uri ==# a:room')
|
||||
if !empty(room)
|
||||
return room[0].userCount . ' PEOPLE'
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
@ -456,10 +456,16 @@ function! s:send(msg) abort
|
||||
endfunction
|
||||
|
||||
function! chat#windows#status() abort
|
||||
let c = ''
|
||||
try
|
||||
let c = chat#{s:protocol}#get_user_count(s:current_channel)
|
||||
catch
|
||||
endtry
|
||||
|
||||
return {
|
||||
\ 'channel' : s:current_channel,
|
||||
\ 'protocol' : s:protocol,
|
||||
\ 'usercount' : c,
|
||||
\ }
|
||||
|
||||
endfunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user