mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:20:05 +08:00
feat(chat): support push multiple messages
This commit is contained in:
parent
bb9d83beb4
commit
99b5771285
5
bundle/vim-chat/addon-info.json
Normal file
5
bundle/vim-chat/addon-info.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "vim-chat",
|
||||||
|
"description": "chat client for neovim and vim",
|
||||||
|
"author": "Wang Shidong"
|
||||||
|
}
|
@ -6,6 +6,13 @@
|
|||||||
" License: GPLv3
|
" License: GPLv3
|
||||||
"=============================================================================
|
"=============================================================================
|
||||||
|
|
||||||
|
""
|
||||||
|
" @section Introduction, intro
|
||||||
|
" @library
|
||||||
|
" @order intro options config layers api faq changelog
|
||||||
|
" vim-chat is a simple plugin for chatting in vim and neovim.
|
||||||
|
" This plugin requires SpaceVim API and |job| support.
|
||||||
|
|
||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
let s:server_lib = get(g:, 'chatting_server_lib', '~/jars/Chatting-1.0-SNAPSHOT.jar')
|
let s:server_lib = get(g:, 'chatting_server_lib', '~/jars/Chatting-1.0-SNAPSHOT.jar')
|
||||||
|
@ -140,14 +140,16 @@ function! s:gitter_fetch_exit(id, data, event) abort
|
|||||||
for room in keys(s:fetch_response)
|
for room in keys(s:fetch_response)
|
||||||
if s:fetch_response[room].jobid ==# a:id
|
if s:fetch_response[room].jobid ==# a:id
|
||||||
let messages = s:JSON.json_decode(join(s:fetch_response[room].response, ''))
|
let messages = s:JSON.json_decode(join(s:fetch_response[room].response, ''))
|
||||||
|
let msgs = []
|
||||||
for msg in messages
|
for msg in messages
|
||||||
call chat#windows#push({
|
call add(msgs, {
|
||||||
\ 'user' : msg.fromUser.displayName,
|
\ 'user' : msg.fromUser.displayName,
|
||||||
\ 'room' : room,
|
\ 'room' : room,
|
||||||
\ 'msg' : msg.text,
|
\ 'msg' : msg.text,
|
||||||
\ 'time': s:format_time(msg.sent),
|
\ 'time': s:format_time(msg.sent),
|
||||||
\ })
|
\ })
|
||||||
endfor
|
endfor
|
||||||
|
call chat#windows#push(msgs)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
@ -22,7 +22,11 @@ endfunction
|
|||||||
" time: 2022-02-02 24:00
|
" time: 2022-02-02 24:00
|
||||||
|
|
||||||
function! chat#windows#push(msg) abort
|
function! chat#windows#push(msg) abort
|
||||||
call add(s:messages, a:msg)
|
if type(a:msg) == type([])
|
||||||
|
let s:messages = s:messages + a:msg
|
||||||
|
elseif type(a:msg) ==# type({})
|
||||||
|
call add(s:messages, a:msg)
|
||||||
|
endif
|
||||||
call s:update_msg_screen()
|
call s:update_msg_screen()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
15
bundle/vim-chat/doc/vim-chat.txt
Normal file
15
bundle/vim-chat/doc/vim-chat.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
*vim-chat.txt* chat client for neovim and vim
|
||||||
|
Wang Shidong *vim-chat*
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CONTENTS *vim-chat-contents*
|
||||||
|
1. Introduction.............................................|vim-chat-intro|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INTRODUCTION *vim-chat-intro*
|
||||||
|
|
||||||
|
vim-chat is a simple plugin for chatting in vim and neovim. This plugin
|
||||||
|
requires SpaceVim API and |job| support.
|
||||||
|
|
||||||
|
|
||||||
|
vim:tw=78:ts=8:ft=help:norl:
|
@ -36,12 +36,12 @@ To use this configuration layer, add the following snippet to your custom config
|
|||||||
|
|
||||||
## Key Mappings
|
## Key Mappings
|
||||||
|
|
||||||
`Alt + w` : open chatting buffer for weixin.
|
The default key binding to open chat windows is `SPC a h`.
|
||||||
Note: The web-qq has stopped providing service.
|
|
||||||
|
|
||||||
within chatting buffer:
|
Whith the chat windows. The following key binding can be use:
|
||||||
|
|
||||||
`Alt + Left/Right` : switch between buffers.
|
- `Alt + Left/H`: switch to previous channel
|
||||||
`Alt + 1-9` : jump to the specified channel.
|
- `Alt + Right/L`: switch to next channel
|
||||||
|
- `Ctrl-w`: delete word before cursor
|
||||||
|
|
||||||
for more mappings in chatting buffer, please read <kbd>:h vim-chat</kbd>.
|
for more mappings in chatting buffer, please read <kbd>:h vim-chat</kbd>.
|
||||||
|
Loading…
Reference in New Issue
Block a user