1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:40:06 +08:00

Add server client mode

This commit is contained in:
wsdjeg 2017-11-08 21:14:40 +08:00
parent b34e0beda6
commit 8d50f9e229
4 changed files with 20 additions and 9 deletions

View File

@ -11,12 +11,13 @@
function! SpaceVim#server#connect()
if empty($SPACEVIM_SERVER_ADDRESS)
let $SPACEVIM_SERVER_ADDRESS = serverlist()[0]
return 0
else
call sockconnect('pipe', $SPACEVIM_SERVER_ADDRESS, {'rpc' : 1})
return 1
let $SPACEVIM_SERVER_ADDRESS = fnamemodify('~/.cache/SpaceVim/server', ':p')
endif
try
call serverstart($SPACEVIM_SERVER_ADDRESS)
call SpaceVim#logger#info('SpaceVim server startup at:' . $SPACEVIM_SERVER_ADDRESS)
catch /Failed to start server: address already in use/
endtry
endfunction

11
bin/svc Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
#=============================================================================
# SpaceVim client mode
# Copyright (c) 2016-2017 Shidong Wang & Contributors
# Author: Shidong Wang < wsdjeg at 163.com >
# URL: https://spacevim.org
# License: MIT license
#=============================================================================
nvr --servername ~/.cache/SpaceVim/server --remote $@

View File

@ -1,6 +1,4 @@
if SpaceVim#server#connect()
finish
endif
call SpaceVim#server#connect()
let g:Config_Main_Home = fnamemodify(expand('<sfile>'),
\ ':p:h:gs?\\?'.((has('win16') || has('win32')

View File

@ -942,7 +942,8 @@ MAPPINGS
normal gd rust-definition
normal gs rust-definition-split
normal gx rust-definition-vertical
normal <leader>gd rust-doc
normal SPC l d rust-doc
normal SPC l r execute current file
<
==============================================================================