diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
commit | 21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch) | |
tree | 84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /runtime/autoload/provider | |
parent | d9c904f85a23a496df4eb6be42aa43f007b22d50 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-colorcolchar.tar.gz rneovim-colorcolchar.tar.bz2 rneovim-colorcolchar.zip |
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'runtime/autoload/provider')
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 11 | ||||
-rw-r--r-- | runtime/autoload/provider/node.vim | 18 | ||||
-rw-r--r-- | runtime/autoload/provider/pythonx.vim | 9 |
3 files changed, 17 insertions, 21 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 98c80f1843..05f6bdb871 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -25,7 +25,8 @@ function! s:selection.on_exit(jobid, data, event) abort if self.owner == a:jobid let self.owner = 0 endif - if a:data != 0 + " Don't print if exit code is >= 128 ( exit is 128+SIGNUM if by signal (e.g. 143 on SIGTERM)) + if a:data > 0 && a:data < 128 echohl WarningMsg echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr) echohl None @@ -92,9 +93,9 @@ function! provider#clipboard#Executable() abort let s:cache_enabled = 0 return 'pbcopy' elseif !empty($WAYLAND_DISPLAY) && executable('wl-copy') && executable('wl-paste') - let s:copy['+'] = ['wl-copy', '--foreground', '--type', 'text/plain'] + let s:copy['+'] = ['wl-copy', '--type', 'text/plain'] let s:paste['+'] = ['wl-paste', '--no-newline'] - let s:copy['*'] = ['wl-copy', '--foreground', '--primary', '--type', 'text/plain'] + let s:copy['*'] = ['wl-copy', '--primary', '--type', 'text/plain'] let s:paste['*'] = ['wl-paste', '--no-newline', '--primary'] return 'wl-copy' elseif !empty($WAYLAND_DISPLAY) && executable('waycopy') && executable('waypaste') @@ -145,8 +146,8 @@ function! provider#clipboard#Executable() abort let s:paste['*'] = s:paste['+'] return 'termux-clipboard' elseif !empty($TMUX) && executable('tmux') - let ver = matchlist(systemlist(['tmux', '-V'])[0], '\vtmux %(next-)?(\d+)\.(\d+)') - if len(ver) >= 3 && (ver[1] > 3 || (ver[1] == 3 && ver[2] >= 2)) + let tmux_v = v:lua.vim.version.parse(system(['tmux', '-V'])) + if !empty(tmux_v) && !v:lua.vim.version.lt(tmux_v, [3,2,0]) let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-'] else let s:copy['+'] = ['tmux', 'load-buffer', '-'] diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index 87af0094fe..3e7b8b4ef9 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 -function! s:is_minimum_version(version, min_major, min_minor) abort +function! s:is_minimum_version(version, min_version) abort if empty(a:version) let nodejs_version = get(split(system(['node', '-v']), "\n"), 0, '') if v:shell_error || nodejs_version[0] !=# 'v' @@ -15,11 +15,7 @@ function! s:is_minimum_version(version, min_major, min_minor) abort " Remove surrounding junk. Example: 'v4.12.0' => '4.12.0' let nodejs_version = matchstr(nodejs_version, '\(\d\.\?\)\+') " [major, minor, patch] - let v_list = split(nodejs_version, '\.') - return len(v_list) == 3 - \ && ((str2nr(v_list[0]) > str2nr(a:min_major)) - \ || (str2nr(v_list[0]) == str2nr(a:min_major) - \ && str2nr(v_list[1]) >= str2nr(a:min_minor))) + return !v:lua.vim.version.lt(nodejs_version, a:min_version) endfunction let s:NodeHandler = { @@ -43,20 +39,20 @@ function! provider#node#can_inspect() abort if v:shell_error || ver[0] !=# 'v' return 0 endif - return (ver[1] ==# '6' && s:is_minimum_version(ver, 6, 12)) - \ || s:is_minimum_version(ver, 7, 6) + return (ver[1] ==# '6' && s:is_minimum_version(ver, '6.12.0')) + \ || s:is_minimum_version(ver, '7.6.0') endfunction function! provider#node#Detect() abort - let minver = [6, 0] + let minver = '6.0.0' if exists('g:node_host_prog') return [expand(g:node_host_prog, v:true), ''] endif if !executable('node') return ['', 'node not found (or not executable)'] endif - if !s:is_minimum_version(v:null, minver[0], minver[1]) - return ['', printf('node version %s.%s not found', minver[0], minver[1])] + if !s:is_minimum_version(v:null, minver) + return ['', printf('node version %s not found', minver)] endif let npm_opts = {} diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim index 6211b457d6..48b96c699a 100644 --- a/runtime/autoload/provider/pythonx.vim +++ b/runtime/autoload/provider/pythonx.vim @@ -26,7 +26,7 @@ endfunction function! s:get_python_candidates(major_version) abort return { - \ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7', 'python'] + \ 3: ['python3', 'python3.12', 'python3.11', 'python3.10', 'python3.9', 'python3.8', 'python3.7', 'python'] \ }[a:major_version] endfunction @@ -61,12 +61,11 @@ endfunction " Returns array: [prog_exitcode, prog_version] function! s:import_module(prog, module) abort - let prog_version = system([a:prog, '-c' , printf( - \ 'import sys; ' . + let prog_version = system([a:prog, '-W', 'ignore', '-c', printf( + \ 'import sys, importlib.util; ' . \ 'sys.path = [p for p in sys.path if p != ""]; ' . \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' . - \ 'import pkgutil; ' . - \ 'exit(2*int(pkgutil.get_loader("%s") is None))', + \ 'sys.exit(2 * int(importlib.util.find_spec("%s") is None))', \ a:module)]) return [v:shell_error, prog_version] endfunction |