aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/health/provider.vim69
-rw-r--r--runtime/autoload/man.vim5
-rw-r--r--runtime/autoload/msgpack.vim8
-rw-r--r--runtime/autoload/provider/clipboard.vim8
-rw-r--r--runtime/autoload/provider/pythonx.vim3
-rw-r--r--runtime/autoload/shada.vim13
-rw-r--r--runtime/doc/autocmd.txt9
-rw-r--r--runtime/doc/pi_msgpack.txt5
8 files changed, 77 insertions, 43 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 9cf540ba09..2f98dd076e 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -405,38 +405,49 @@ endfunction
function! s:check_ruby() abort
call health#report_start('Ruby provider')
- let ruby_version = 'not found'
- if executable('ruby')
- let ruby_version = s:systemlist('ruby -v')[0]
+
+ if !executable('ruby') || !executable('gem')
+ call health#report_warn(
+ \ "Both `ruby` and `gem` have to be in $PATH. Ruby code won't work.",
+ \ ["Install Ruby and make sure that `ruby` and `gem` are in $PATH."])
+ return
endif
- let ruby_prog = provider#ruby#Detect()
- let suggestions =
- \ ['Install or upgrade the neovim RubyGem using `gem install neovim`.']
-
- if empty(ruby_prog)
- let ruby_prog = 'not found'
- let prog_vers = 'not found'
- call health#report_error('Missing Neovim RubyGem', suggestions)
- else
- silent let latest_gem = get(split(s:system(['gem', 'list', '-ra', '^neovim$']),
- \ ' (\|, \|)$' ), 1, 'not found')
- let latest_desc = ' (latest: ' . latest_gem . ')'
-
- silent let prog_vers = s:systemlist(ruby_prog . ' --version')[0]
- if s:shell_error
- let prog_vers = 'not found' . latest_desc
- call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
- elseif s:version_cmp(prog_vers, latest_gem) == -1
- let prog_vers .= latest_desc
- call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
- else
- call health#report_ok('Found up-to-date neovim RubyGem')
- endif
+ call health#report_info('Ruby: '. s:system('ruby -v'))
+
+ let host = provider#ruby#Detect()
+ if empty(host)
+ call health#report_warn("Missing \"neovim\" gem. Ruby code won't work.",
+ \ ['Run in shell: gem install neovim'])
+ return
+ endif
+ call health#report_info('Host: '. host)
+
+ let latest_gem_cmd = 'gem list -rae neovim'
+ let latest_gem = s:system(split(latest_gem_cmd))
+ if s:shell_error || empty(latest_gem)
+ call health#report_error('Failed to run: '. latest_gem_cmd,
+ \ ["Make sure you're connected to the internet.",
+ \ "Are you behind a firewall or proxy?"])
+ return
+ endif
+ let latest_gem = get(split(latest_gem, ' (\|, \|)$' ), 1, 'not found')
+
+ let current_gem_cmd = host .' --version'
+ let current_gem = s:system(current_gem_cmd)
+ if s:shell_error
+ call health#report_error('Failed to run: '. current_gem_cmd,
+ \ ["Report this issue with the output of: ", current_gem_cmd])
+ return
endif
- call health#report_info('Ruby Version: ' . ruby_version)
- call health#report_info('Host Executable: ' . ruby_prog)
- call health#report_info('Host Version: ' . prog_vers)
+ if s:version_cmp(current_gem, latest_gem) == -1
+ call health#report_warn(
+ \ printf('Gem "neovim" is out-of-date. Installed: %s, latest: %s',
+ \ current_gem, latest_gem),
+ \ ['Run in shell: gem update neovim'])
+ else
+ call health#report_ok('Gem "neovim" is up-to-date: '. current_gem)
+ endif
endfunction
function! health#provider#check() abort
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index 6fed4a54e3..251e6eee41 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -113,10 +113,11 @@ function! s:system(cmd, ...) abort
endfunction
function! s:get_page(path) abort
+ " Respect $MANWIDTH or default to window width.
+ let manwidth = empty($MANWIDTH) ? winwidth(0) : $MANWIDTH
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085
- " Respect $MANWIDTH, or default to window width.
- return s:system(['env', 'MANPAGER=cat', (empty($MANWIDTH) ? 'MANWIDTH='.winwidth(0) : ''), 'man', a:path])
+ return s:system(['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'man', a:path])
endfunction
function! s:put_page(page) abort
diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim
index 2e2697c57f..a10ac32469 100644
--- a/runtime/autoload/msgpack.vim
+++ b/runtime/autoload/msgpack.vim
@@ -665,11 +665,15 @@ function msgpack#eval(s, special_objs) abort
call add(expr, ']}')
let s = s[1:]
elseif s[0] is# ''''
- let char = matchstr(s, '\m\C^''\zs.\ze''')
+ let char = matchstr(s, '\v\C^\''\zs%(\\\d+|.)\ze\''')
if empty(char)
throw 'char-invalid:Invalid integer character literal format: ' . s
endif
- call add(expr, char2nr(char))
+ if char[0] is# '\'
+ call add(expr, +char[1:])
+ else
+ call add(expr, char2nr(char))
+ endif
let s = s[len(char) + 2:]
else
throw 'unknown:Invalid non-space character: ' . s
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 581cec036e..b8baaa8c64 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -33,6 +33,12 @@ function! s:try_cmd(cmd, ...)
return out
endfunction
+" Returns TRUE if `cmd` exits with success, else FALSE.
+function! s:cmd_ok(cmd)
+ call system(a:cmd)
+ return v:shell_error == 0
+endfunction
+
let s:cache_enabled = 1
let s:err = ''
@@ -48,7 +54,7 @@ function! provider#clipboard#Executable() abort
let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0
return 'pbcopy'
- elseif exists('$DISPLAY') && executable('xsel')
+ elseif exists('$DISPLAY') && executable('xsel') && s:cmd_ok('xsel -o -b')
let s:copy['+'] = 'xsel --nodetach -i -b'
let s:paste['+'] = 'xsel -o -b'
let s:copy['*'] = 'xsel --nodetach -i -p'
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index f46c260fa3..08a0f39b01 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -57,7 +57,8 @@ function! provider#pythonx#Detect(major_ver) abort
if exists('g:python3_host_prog')
return [g:python3_host_prog, '']
else
- let progs = ['python3', 'python3.5', 'python3.4', 'python3.3', 'python']
+ let progs = ['python3', 'python3.7', 'python3.6', 'python3.5',
+ \ 'python3.4', 'python3.3', 'python']
endif
endif
diff --git a/runtime/autoload/shada.vim b/runtime/autoload/shada.vim
index 9be85b6f2e..cf27ee608a 100644
--- a/runtime/autoload/shada.vim
+++ b/runtime/autoload/shada.vim
@@ -241,8 +241,6 @@ function s:shada_check_type(type, val) abort
if msg isnot# 0
return msg
endif
- if a:val > 0 || a:val < 1
- endif
return 0
elseif a:type is# 'binarray'
if type isnot# 'array'
@@ -359,9 +357,14 @@ function s:shada_string(type, v) abort
if (has_key(s:SHADA_ENUMS, a:type) && type(a:v) == type(0)
\&& has_key(s:SHADA_REV_ENUMS[a:type], a:v))
return s:SHADA_REV_ENUMS[a:type][a:v]
- elseif (a:type is# 'intchar' && type(a:v) == type(0)
- \&& strtrans(nr2char(a:v)) is# nr2char(a:v))
- return "'" . nr2char(a:v) . "'"
+ " Restricting a:v to be <= 127 is not necessary, but intchar constants are
+ " normally expected to be either ASCII printable characters or NUL.
+ elseif a:type is# 'intchar' && type(a:v) == type(0) && a:v >= 0 && a:v <= 127
+ if a:v > 0 && strtrans(nr2char(a:v)) is# nr2char(a:v)
+ return "'" . nr2char(a:v) . "'"
+ else
+ return "'\\" . a:v . "'"
+ endif
else
return msgpack#string(a:v)
endif
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 4f23aee83d..65e091edf5 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -49,9 +49,6 @@ effects. Be careful not to destroy your text.
==============================================================================
2. Defining autocommands *autocmd-define*
-Note: The ":autocmd" command cannot be followed by another command, since any
-'|' is considered part of the command.
-
*:au* *:autocmd*
:au[tocmd] [group] {event} {pat} [nested] {cmd}
Add {cmd} to the list of commands that Vim will
@@ -64,6 +61,12 @@ Note: The ":autocmd" command cannot be followed by another command, since any
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
See |autocmd-buflocal|.
+Note: The ":autocmd" command can only be followed by another command when the
+'|' appears before {cmd}. This works: >
+ :augroup mine | au! BufRead | augroup END
+But this sees "augroup" as part of the defined command: >
+ :augroup mine | au BufRead * set tw=70 | augroup END
+
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be
expanded when the Event is recognized, and the {cmd} is executed. The only
diff --git a/runtime/doc/pi_msgpack.txt b/runtime/doc/pi_msgpack.txt
index 95d6ff7467..d695ac42cb 100644
--- a/runtime/doc/pi_msgpack.txt
+++ b/runtime/doc/pi_msgpack.txt
@@ -128,6 +128,11 @@ msgpack#eval({string}, {dict}) *msgpack#eval()*
always evaluated to |msgpack-special-dict| values, as well as
hexadecimal digits. When evaluating maps order of keys is preserved.
+ Note that in addition to regular integer representations that may be
+ obtained using |msgpack#string()| msgpack#eval() also supports C-style
+ “character” integer constants like `'/'` (equivalent to
+ `char2nr('/')`: `47`). This also allows `'\0'` (number is decimal).
+
*msgpack#equal*
msgpack#equal({msgpack-value}, {msgpack-value}) *msgpack#equal()*
Returns 1 if given values are equal, 0 otherwise. When comparing