From 46bd3c0f77f282b93ca1307c011562243c394306 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 2 Feb 2016 22:14:59 +0900 Subject: [PATCH] clipboard: Check $DISPLAY. Prefer xsel. #4150 --- runtime/autoload/provider/clipboard.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 3728eb9367..5ea9df92fe 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -37,16 +37,16 @@ if executable('pbcopy') let s:copy['*'] = s:copy['+'] let s:paste['*'] = s:paste['+'] let s:cache_enabled = 0 -elseif executable('xclip') - let s:copy['+'] = 'xclip -quiet -i -selection clipboard' - let s:paste['+'] = 'xclip -o -selection clipboard' - let s:copy['*'] = 'xclip -quiet -i -selection primary' - let s:paste['*'] = 'xclip -o -selection primary' -elseif executable('xsel') +elseif exists('$DISPLAY') && executable('xsel') let s:copy['+'] = 'xsel --nodetach -i -b' let s:paste['+'] = 'xsel -o -b' let s:copy['*'] = 'xsel --nodetach -i -p' let s:paste['*'] = 'xsel -o -p' +elseif exists('$DISPLAY') && executable('xclip') + let s:copy['+'] = 'xclip -quiet -i -selection clipboard' + let s:paste['+'] = 'xclip -o -selection clipboard' + let s:copy['*'] = 'xclip -quiet -i -selection primary' + let s:paste['*'] = 'xclip -o -selection primary' else echom 'clipboard: No clipboard tool available. See :help nvim-clipboard' finish