aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-07-15 18:56:45 +0300
committerZyX <kp-pav@yandex.ru>2017-07-15 18:56:45 +0300
commit69719e658c48bb5e95a7b57d5813ed4dc48e68e3 (patch)
treec4f8584a7437ea6127389b26ff6876404cb58ce7 /runtime/autoload
parent7ab152aaa58f493e54d03a15960b8a288196e588 (diff)
parent8898793adeb3a82fe50da4258c30940e10ebcc9d (diff)
downloadrneovim-69719e658c48bb5e95a7b57d5813ed4dc48e68e3.tar.gz
rneovim-69719e658c48bb5e95a7b57d5813ed4dc48e68e3.tar.bz2
rneovim-69719e658c48bb5e95a7b57d5813ed4dc48e68e3.zip
Merge branch 'master' into colored-cmdline
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/health.vim3
-rw-r--r--runtime/autoload/health/provider.vim4
-rw-r--r--runtime/autoload/provider/clipboard.vim19
3 files changed, 18 insertions, 8 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim
index 1d8cae7d19..f875c8b797 100644
--- a/runtime/autoload/health.vim
+++ b/runtime/autoload/health.vim
@@ -33,7 +33,8 @@ function! health#check(plugin_names) abort
setlocal wrap breakindent
setlocal filetype=markdown
setlocal conceallevel=2 concealcursor=nc
- setlocal keywordprg=:help iskeyword=@,48-57,_,192-255,-,#
+ setlocal keywordprg=:help
+ let &l:iskeyword='!-~,^*,^|,^",192-255'
call s:enhance_syntax()
if empty(healthchecks)
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 31a235a397..ec20615f69 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -125,6 +125,10 @@ function! s:check_clipboard() abort
call health#report_warn(
\ 'No clipboard tool found. Clipboard registers will not work.',
\ [':help clipboard'])
+ elseif exists('g:clipboard') && (type({}) != type(g:clipboard)
+ \ || !has_key(g:clipboard, 'copy') || !has_key(g:clipboard, 'paste'))
+ call health#report_error(
+ \ 'g:clipboard exists but is malformed. It must be a dictionary with the keys documented at :help g:clipboard')
else
call health#report_ok('Clipboard tool found: '. clipboard_tool)
endif
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index e15aa1f2bd..a67681d28e 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -8,7 +8,7 @@ let s:paste = {}
" ownership of the selection, so we know how long the cache is valid.
let s:selection = { 'owner': 0, 'data': [] }
-function! s:selection.on_exit(jobid, data, event)
+function! s:selection.on_exit(jobid, data, event) abort
" At this point this nvim instance might already have launched
" a new provider instance. Don't drop ownership in this case.
if self.owner == a:jobid
@@ -18,7 +18,7 @@ endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection)}
-function! s:try_cmd(cmd, ...)
+function! s:try_cmd(cmd, ...) abort
let argv = split(a:cmd, " ")
let out = a:0 ? systemlist(argv, a:1, 1) : systemlist(argv, [''], 1)
if v:shell_error
@@ -34,7 +34,7 @@ function! s:try_cmd(cmd, ...)
endfunction
" Returns TRUE if `cmd` exits with success, else FALSE.
-function! s:cmd_ok(cmd)
+function! s:cmd_ok(cmd) abort
call system(a:cmd)
return v:shell_error == 0
endfunction
@@ -47,7 +47,12 @@ function! provider#clipboard#Error() abort
endfunction
function! provider#clipboard#Executable() abort
- if has('mac') && executable('pbcopy')
+ if exists('g:clipboard')
+ let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null })
+ let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
+ let s:cache_enabled = get(g:clipboard, 'cache_enabled', 1)
+ return get(g:clipboard, 'name', 'g:clipboard')
+ elseif has('mac') && executable('pbcopy')
let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+']
@@ -102,14 +107,14 @@ endif
let s:clipboard = {}
-function! s:clipboard.get(reg)
+function! s:clipboard.get(reg) abort
if s:selections[a:reg].owner > 0
return s:selections[a:reg].data
end
return s:try_cmd(s:paste[a:reg])
endfunction
-function! s:clipboard.set(lines, regtype, reg)
+function! s:clipboard.set(lines, regtype, reg) abort
if a:reg == '"'
call s:clipboard.set(a:lines,a:regtype,'+')
if s:copy['*'] != s:copy['+']
@@ -144,6 +149,6 @@ function! s:clipboard.set(lines, regtype, reg)
let selection.owner = jobid
endfunction
-function! provider#clipboard#Call(method, args)
+function! provider#clipboard#Call(method, args) abort
return call(s:clipboard[a:method],a:args,s:clipboard)
endfunction