diff --git a/autoload/SpaceVim/server.vim b/autoload/SpaceVim/server.vim index 7b15b0a73..e886fa64d 100644 --- a/autoload/SpaceVim/server.vim +++ b/autoload/SpaceVim/server.vim @@ -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 diff --git a/bin/svc b/bin/svc new file mode 100755 index 000000000..1ca909b7e --- /dev/null +++ b/bin/svc @@ -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 $@ diff --git a/config/main.vim b/config/main.vim index ad14c4f6c..af955266f 100644 --- a/config/main.vim +++ b/config/main.vim @@ -1,6 +1,4 @@ -if SpaceVim#server#connect() - finish -endif +call SpaceVim#server#connect() let g:Config_Main_Home = fnamemodify(expand(''), \ ':p:h:gs?\\?'.((has('win16') || has('win32') diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 43bdaf481..ae766cc7a 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -942,7 +942,8 @@ MAPPINGS normal gd rust-definition normal gs rust-definition-split normal gx rust-definition-vertical - normal gd rust-doc + normal SPC l d rust-doc + normal SPC l r execute current file < ==============================================================================