1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-22 05:43:44 +08:00
SpaceVim/autoload/SpaceVim/layers/chat.vim

70 lines
2.1 KiB
VimL
Raw Normal View History

"=============================================================================
" chat.vim --- SpaceVim chat layer
2022-02-03 17:24:51 +08:00
" Copyright (c) 2016-2022 Wang Shidong & Contributors
2022-03-27 13:38:54 +08:00
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
""
" @section chat, layers-chat
" @parentsection layers
" The `chat` layer provides basic function to connected to chat server.
"
" @subsection layer options
"
" 1. `chat_port`: set the port of chat server
" 2. `chat_address`: set the ip of chat server
" 3. `chat_client_jar`: set the path of client jar
"
" @subsection key bindings
" >
" Key Bingding Description
" SPC a h open chat window
" <
if exists('s:chat_address')
finish
endif
2021-10-24 21:07:19 +08:00
let s:chat_address = '127.0.0.1'
let s:chat_port = 8080
2021-10-24 21:33:03 +08:00
let s:chat_client_jar = fnamemodify(expand('<sfile>:p:h:h:h:h') . '/bundle/Chatting-server/target/Chatting-1.0-SNAPSHOT.jar', ':gs?[\\/]?/?')
let s:gitter_token = ''
2017-01-14 14:36:36 +08:00
function! SpaceVim#layers#chat#plugins() abort
return [
\ [g:_spacevim_root_dir . 'bundle/vim-chat', {'merged' : 0, 'loadconf' : 1}],
\ ]
2017-01-14 14:36:36 +08:00
endfunction
2017-09-10 00:37:54 +08:00
2021-10-24 21:07:19 +08:00
function! SpaceVim#layers#chat#set_variable(opt) abort
let s:chat_address = get(a:opt, 'chat_address', s:chat_address)
let s:chat_port = get(a:opt, 'chat_port', s:chat_port)
let s:chat_client_jar = get(a:opt, 'chat_client_jar', s:chat_client_jar)
let s:gitter_token = get(a:opt, 'gitter_token', s:gitter_token)
2021-10-24 21:07:19 +08:00
endfunction
function! SpaceVim#layers#chat#get_options() abort
return ['chat_address', 'chat_port', 'chat_client_jar']
endfunction
2019-01-28 22:12:37 +08:00
function! SpaceVim#layers#chat#config() abort
let g:chatting_server_ip = s:chat_address
let g:chatting_server_port = s:chat_port
let g:chatting_server_lib = s:chat_client_jar
let g:chat_gitter_token = s:gitter_token
2022-04-30 02:03:01 +08:00
call SpaceVim#mapping#space#def('nnoremap', ['a', 'h'], 'call chat#windows#open()', 'open-chat-window', 1)
2017-09-10 00:37:54 +08:00
endfunction
2021-08-10 19:59:42 +08:00
function! SpaceVim#layers#chat#health() abort
call SpaceVim#layers#chat#plugins()
call SpaceVim#layers#chat#config()
return 1
endfunction