aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/health/nvim.vim2
-rw-r--r--runtime/autoload/health/provider.vim17
-rw-r--r--runtime/autoload/provider.vim20
-rw-r--r--runtime/autoload/provider/clipboard.vim13
-rw-r--r--runtime/autoload/provider/node.vim11
-rw-r--r--runtime/autoload/provider/pythonx.vim9
6 files changed, 25 insertions, 47 deletions
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 58033f0405..017c047ef4 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -174,7 +174,7 @@ function! s:check_terminal() abort
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
endif
for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY']
- if !exists('$'.env_var)
+ if exists('$'.env_var)
call health#report_info(printf("$%s='%s'", env_var, eval('$'.env_var)))
endif
endfor
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 39e592c471..83dee043a0 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -370,10 +370,11 @@ function! s:check_python(version) abort
let python_bin = ''
endif
- " Check if $VIRTUAL_ENV is active
- let virtualenv_inactive = 0
+ " Check if $VIRTUAL_ENV is active.
if exists('$VIRTUAL_ENV')
+ let virtualenv_inactive = 0
+
if !empty(pyenv)
let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix'])))
if $VIRTUAL_ENV != pyenv_prefix
@@ -382,13 +383,13 @@ function! s:check_python(version) abort
elseif !empty(pyname) && exepath(pyname) !~# '^'.$VIRTUAL_ENV.'/'
let virtualenv_inactive = 1
endif
- endif
- if virtualenv_inactive
- call health#report_warn(
- \ '$VIRTUAL_ENV exists but appears to be inactive. '
- \ . 'This could lead to unexpected results.',
- \ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229' ])
+ if virtualenv_inactive
+ call health#report_warn(
+ \ '$VIRTUAL_ENV exists but appears to be inactive. '
+ \ . 'This could lead to unexpected results.',
+ \ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654' ])
+ endif
endif
" Diagnostic output
diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim
deleted file mode 100644
index e6514f5ba8..0000000000
--- a/runtime/autoload/provider.vim
+++ /dev/null
@@ -1,20 +0,0 @@
-" Common functionality for providers
-
-let s:stderr = {}
-
-function! provider#stderr_collector(chan_id, data, event)
- let stderr = get(s:stderr, a:chan_id, [''])
- let stderr[-1] .= a:data[0]
- call extend(stderr, a:data[1:])
- let s:stderr[a:chan_id] = stderr
-endfunction
-
-function! provider#clear_stderr(chan_id)
- if has_key(s:stderr, a:chan_id)
- call remove(s:stderr, a:chan_id)
- endif
-endfunction
-
-function! provider#get_stderr(chan_id)
- return get(s:stderr, a:chan_id, [])
-endfunction
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 6454a01c2a..e5a6e4748a 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -7,7 +7,7 @@ let s:clipboard = {}
" When caching is enabled, store the jobid of the xclip/xsel process keeping
" ownership of the selection, so we know how long the cache is valid.
-let s:selection = { 'owner': 0, 'data': [], 'on_stderr': function('provider#stderr_collector') }
+let s:selection = { 'owner': 0, 'data': [], 'stderr_buffered': v:true }
function! s:selection.on_exit(jobid, data, event) abort
" At this point this nvim instance might already have launched
@@ -16,12 +16,10 @@ function! s:selection.on_exit(jobid, data, event) abort
let self.owner = 0
endif
if a:data != 0
- let stderr = provider#get_stderr(a:jobid)
echohl WarningMsg
- echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(stderr)
+ echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr)
echohl None
endif
- call provider#clear_stderr(a:jobid)
endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection) }
@@ -142,12 +140,13 @@ function! s:clipboard.set(lines, regtype, reg) abort
return 0
end
- let selection = s:selections[a:reg]
- if selection.owner > 0
+ if s:selections[a:reg].owner > 0
" The previous provider instance should exit when the new one takes
" ownership, but kill it to be sure we don't fill up the job table.
- call jobstop(selection.owner)
+ call jobstop(s:selections[a:reg].owner)
end
+ let s:selections[a:reg] = copy(s:selection)
+ let selection = s:selections[a:reg]
let selection.data = [a:lines, a:regtype]
let argv = split(s:copy[a:reg], " ")
let selection.argv = argv
diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim
index 4e737fb51c..3dde18022e 100644
--- a/runtime/autoload/provider/node.vim
+++ b/runtime/autoload/provider/node.vim
@@ -3,7 +3,7 @@ if exists('g:loaded_node_provider')
endif
let g:loaded_node_provider = 1
-let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')}
+let s:job_opts = {'rpc': v:true, 'stderr_buffered': v:true}
function! s:is_minimum_version(version, min_major, min_minor) abort
if empty(a:version)
@@ -73,19 +73,18 @@ function! provider#node#Require(host) abort
call add(args, provider#node#Prog())
try
- let channel_id = jobstart(args, s:job_opts)
+ let job = copy(s:job_opts)
+ let channel_id = jobstart(args, job)
if rpcrequest(channel_id, 'poll') ==# 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
- for row in provider#get_stderr(channel_id)
+ for row in job.stderr
echomsg row
endfor
endtry
- finally
- call provider#clear_stderr(channel_id)
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_NODE_LOG_FILE')
endfunction
@@ -115,7 +114,7 @@ let s:err = ''
let s:prog = provider#node#Detect()
if empty(s:prog)
- let s:err = 'Cannot find the "neovim" node package. Try :CheckHealth'
+ let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'
endif
call remote#host#RegisterPlugin('node-provider', 'node', [])
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 7285ed43ea..1c77eabe23 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -5,7 +5,7 @@ endif
let s:loaded_pythonx_provider = 1
-let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')}
+let s:job_opts = {'rpc': v:true, 'stderr_buffered': v:true}
function! provider#pythonx#Require(host) abort
let ver = (a:host.orig_name ==# 'python') ? 2 : 3
@@ -21,18 +21,17 @@ function! provider#pythonx#Require(host) abort
endfor
try
- let channel_id = jobstart(args, s:job_opts)
+ let job = copy(s:job_opts)
+ let channel_id = jobstart(args, job)
if rpcrequest(channel_id, 'poll') ==# 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
- for row in provider#get_stderr(channel_id)
+ for row in job.stderr
echomsg row
endfor
- finally
- call provider#clear_stderr(channel_id)
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name,
\ '$NVIM_PYTHON_LOG_FILE')