diff options
author | Shougo <Shougo.Matsu@gmail.com> | 2016-07-01 09:50:07 +0900 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-06-30 20:50:07 -0400 |
commit | 0d5edcef4a34bd0de4cf1eb267b8a40ed12e32fa (patch) | |
tree | cf6ba566c6c4b01ec9228adab9e79d6cc7477454 | |
parent | 8e804c911edbeb171d66f0b3f1dc1ffecd8e4d39 (diff) | |
download | rneovim-0d5edcef4a34bd0de4cf1eb267b8a40ed12e32fa.tar.gz rneovim-0d5edcef4a34bd0de4cf1eb267b8a40ed12e32fa.tar.bz2 rneovim-0d5edcef4a34bd0de4cf1eb267b8a40ed12e32fa.zip |
rplugin: Manifest file name fallback (#4935)
-rw-r--r-- | runtime/autoload/remote/host.vim | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index a63c6a923b..4ec2eeb5b7 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -1,7 +1,5 @@ let s:hosts = {} let s:plugin_patterns = {} -let s:remote_plugins_manifest = fnamemodify(expand($MYVIMRC, 1), ':h') - \.'/.'.fnamemodify($MYVIMRC, ':t').'-rplugin~' let s:plugins_for_host = {} @@ -120,9 +118,18 @@ function! remote#host#RegisterPlugin(host, path, specs) abort endfunction +function! s:GetManifest() abort + let prefix = exists('$MYVIMRC') + \ ? $MYVIMRC + \ : matchstr(get(split(capture('scriptnames'), '\n'), 0, ''), '\f\+$') + return fnamemodify(expand(prefix, 1), ':h') + \.'/.'.fnamemodify(prefix, ':t').'-rplugin~' +endfunction + + function! remote#host#LoadRemotePlugins() abort - if filereadable(s:remote_plugins_manifest) - exe 'source '.s:remote_plugins_manifest + if filereadable(s:GetManifest()) + exe 'source '.s:GetManifest() endif endfunction @@ -194,9 +201,9 @@ function! remote#host#UpdateRemotePlugins() abort endtry endif endfor - call writefile(commands, s:remote_plugins_manifest) + call writefile(commands, s:GetManifest()) echomsg printf('remote/host: generated the manifest file in "%s"', - \ s:remote_plugins_manifest) + \ s:GetManifest()) endfunction @@ -210,12 +217,12 @@ endfunction function! remote#host#LoadErrorForHost(host, log) abort return 'Failed to load '. a:host . ' host. '. - \ 'You can try to see what happened '. - \ 'by starting Neovim with the environment variable '. - \ a:log . ' set to a file and opening the generated '. - \ 'log file. Also, the host stderr will be available '. - \ 'in Neovim log, so it may contain useful information. '. - \ 'See also ~/.nvimlog.' + \ 'You can try to see what happened '. + \ 'by starting Neovim with the environment variable '. + \ a:log . ' set to a file and opening the generated '. + \ 'log file. Also, the host stderr will be available '. + \ 'in Neovim log, so it may contain useful information. '. + \ 'See also ~/.nvimlog.' endfunction |