diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/health/provider.vim | 70 | ||||
-rw-r--r-- | runtime/autoload/remote/host.vim | 1 | ||||
-rw-r--r-- | runtime/doc/deprecated.txt | 1 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 53 | ||||
-rw-r--r-- | runtime/optwin.vim | 8 | ||||
-rw-r--r-- | runtime/vimrc_example.vim | 6 |
6 files changed, 83 insertions, 56 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index b1cfa8bf2b..d4b2f07a17 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -1,13 +1,5 @@ -let s:bad_responses = [ - \ 'unable to parse python response', - \ 'unable to parse', - \ 'unable to get pypi response', - \ 'unable to get neovim executable', - \ 'unable to find neovim version' - \ ] - function! s:is_bad_response(s) abort - return index(s:bad_responses, a:s) >= 0 + return a:s =~? '\v(^unable)|(^error)' endfunction function! s:trim(s) abort @@ -32,44 +24,41 @@ endfunction " Fetch the contents of a URL. function! s:download(url) abort - let content = '' if executable('curl') - let content = system(['curl', '-sL', "'", a:url, "'"]) - endif - - if empty(content) && executable('python') + let rv = system(['curl', '-sL', a:url]) + return v:shell_error ? 'curl error: '.v:shell_error : rv + elseif executable('python') let script = " \try:\n \ from urllib.request import urlopen\n \except ImportError:\n \ from urllib2 import urlopen\n \\n - \try:\n - \ response = urlopen('".a:url."')\n - \ print(response.read().decode('utf8'))\n - \except Exception:\n - \ pass\n + \response = urlopen('".a:url."')\n + \print(response.read().decode('utf8'))\n \" - let content = system(['python', '-c', "'", script, "'", '2>/dev/null']) + let rv = system(['python', '-c', script]) + return empty(rv) && v:shell_error + \ ? 'python urllib.request error: '.v:shell_error + \ : rv endif - - return content + return 'missing `curl` and `python`, cannot make pypi request' endfunction -" Get the latest Neovim Python client version from PyPI. Result is cached. +" Get the latest Neovim Python client version from PyPI. function! s:latest_pypi_version() abort - if exists('s:pypi_version') - return s:pypi_version - endif - - let s:pypi_version = 'unable to get pypi response' - let pypi_info = s:download('https://pypi.python.org/pypi/neovim/json') - if !empty(pypi_info) - let pypi_data = json_decode(pypi_info) - let s:pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse') - return s:pypi_version + let pypi_version = 'unable to get pypi response' + let pypi_response = s:download('https://pypi.python.org/pypi/neovim/json') + if !empty(pypi_response) + try + let pypi_data = json_decode(pypi_response) + catch /E474/ + return 'error: '.pypi_response + endtry + let pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse') endif + return pypi_version endfunction " Get version information using the specified interpreter. The interpreter is @@ -97,11 +86,11 @@ function! s:version_info(python) abort let nvim_path = s:trim(system([ \ a:python, \ '-c', - \ 'import neovim; print(neovim.__file__)', - \ '2>/dev/null'])) + \ 'import neovim; print(neovim.__file__)'])) + let nvim_path = v:shell_error ? '' : nvim_path if empty(nvim_path) - return [python_version, 'unable to find neovim executable', pypi_version, 'unable to get neovim executable'] + return [python_version, 'unable to find nvim executable', pypi_version, 'unable to get nvim executable'] endif " Assuming that multiple versions of a package are installed, sort them @@ -112,7 +101,7 @@ function! s:version_info(python) abort return a == b ? 0 : a > b ? 1 : -1 endfunction - let nvim_version = 'unable to find neovim version' + let nvim_version = 'unable to find nvim version' let base = fnamemodify(nvim_path, ':h') let metas = glob(base.'-*/METADATA', 1, 1) + glob(base.'-*/PKG-INFO', 1, 1) let metas = sort(metas, 's:compare') @@ -334,12 +323,13 @@ function! s:check_python(version) abort endif if s:is_bad_response(latest) - call health#report_warn('Unable to fetch latest Neovim Python client version.') + call health#report_warn('Unable to contact PyPI.') + call health#report_error('HTTP request failed: '.latest) endif if s:is_bad_response(status) - call health#report_warn('Latest Neovim Python client versions: ('.latest.')') - else + call health#report_warn('Latest Neovim Python client version: ('.latest.')') + elseif !s:is_bad_response(latest) call health#report_ok('Latest Neovim Python client is installed: ('.status.')') endif endif diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index d4e8e98bc0..1f30b91ab8 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -191,6 +191,7 @@ function! s:RegistrationCommands(host) abort let pattern = s:plugin_patterns[a:host] let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 0, 1) let paths = map(paths, 'tr(v:val,"\\","/")') " Normalize slashes #4795 + let paths = uniq(sort(paths)) if empty(paths) return [] endif diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index d108aca62f..2b69929cfe 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -41,3 +41,4 @@ Options ~ *'vi'* *'viminfo'* Deprecated alias to 'shada' option. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index df5713c63d..dedbe49605 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1813,6 +1813,7 @@ buflisted({expr}) Number TRUE if buffer {expr} is listed bufloaded({expr}) Number TRUE if buffer {expr} is loaded bufname({expr}) String Name of the buffer {expr} bufnr({expr} [, {create}]) Number Number of the buffer {expr} +bufwinid({expr}) Number window ID of buffer {expr} bufwinnr({expr}) Number window number of buffer {expr} byte2line({byte}) Number line number at byte count {byte} byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr} @@ -1897,7 +1898,8 @@ getcmdline() String return the current command-line getcmdpos() Number return cursor position in command-line getcmdtype() String return current command-line type getcmdwintype() String return current command-line window type -getcompletion({pat}, {type}) List list of cmdline completion matches +getcompletion({pat}, {type} [, {filtered}]) + List list of cmdline completion matches getcurpos() List position of the cursor getcwd([{winnr} [, {tabnr}]]) String the current working directory getfontname([{name}]) String name of font being used @@ -2243,6 +2245,7 @@ arglistid([{winnr} [, {tabnr}]]) With {winnr} only use this window in the current tab page. With {winnr} and {tabnr} use the window in the specified tab page. + {winnr} can be the window number or the window ID. *argv()* argv([{nr}]) The result is the {nr}th file in the argument list of the @@ -2468,6 +2471,16 @@ bufnr({expr} [, {create}]) number necessarily exist, because ":bwipeout" may have removed them. Use bufexists() to test for the existence of a buffer. +bufwinid({expr}) *bufwinid()* + The result is a Number, which is the window ID of the first + window associated with buffer {expr}. For the use of {expr}, + see |bufname()| above. If buffer {expr} doesn't exist or + there is no such window, -1 is returned. Example: > + + echo "A window containing buffer 1 is " . (bufwinid(1)) +< + Only deals with the current tab page. + bufwinnr({expr}) *bufwinnr()* The result is a Number, which is the number of the first window associated with buffer {expr}. For the use of {expr}, @@ -3651,7 +3664,7 @@ getcmdwintype() *getcmdwintype()* values are the same as |getcmdtype()|. Returns an empty string when not in the command-line window. -getcompletion({pat}, {type}) *getcompletion()* +getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* Return a list of command-line completion matches. {type} specifies what for. The following completion types are supported: @@ -3691,6 +3704,10 @@ getcompletion({pat}, {type}) *getcompletion()* Otherwise only items matching {pat} are returned. See |wildcards| for the use of special characters in {pat}. + If the optional {filtered} flag is set to 1, then 'wildignore' + is applied to filter the results. Otherwise all the matches + are returned. The 'wildignorecase' option always applies. + If there are no matches, an empty list is returned. An invalid value for {type} produces an error. @@ -3716,6 +3733,7 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()* getcwd(0) getcwd(0, 0) < If {winnr} is -1 it is ignored, only the tab is resolved. + {winnr} can be the window number or the window ID. getfsize({fname}) *getfsize()* @@ -3810,7 +3828,9 @@ getline({lnum} [, {end}]) getloclist({nr}) *getloclist()* Returns a list with all the entries in the location list for - window {nr}. When {nr} is zero the current window is used. + window {nr}. {nr} can be the window number or the window ID. + When {nr} is zero the current window is used. + For a location list window, the displayed location list is returned. For an invalid window number {nr}, an empty list is returned. Otherwise, same as |getqflist()|. @@ -3938,6 +3958,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Note that {varname} must be the name without "w:". Tabs are numbered starting with one. For the current tabpage use |getwinvar()|. + {winnr} can be the window number or the window ID. When {winnr} is zero the current window is used. This also works for a global option, buffer-local option and window-local option, but it doesn't work for a global variable @@ -4065,7 +4086,8 @@ haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()* haslocaldir() haslocaldir(0) haslocaldir(0, 0) -< If {winnr} is -1 it is ignored, only the tab is resolved. +< {winnr} can be the window number or the window ID. + If {winnr} is -1 it is ignored, only the tab is resolved. hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* The result is a Number, which is 1 if there is a mapping that @@ -6054,11 +6076,13 @@ setline({lnum}, {text}) *setline()* setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()* Create or replace or add to the location list for window {nr}. - When {nr} is zero the current window is used. For a location - list window, the displayed location list is modified. For an - invalid window number {nr}, -1 is returned. If {title} is - given, it will be used to set |w:quickfix_title| after opening - the location window. + {nr} can be the window number or the window ID. + When {nr} is zero the current window is used. + + For a location list window, the displayed location list is + modified. For an invalid window number {nr}, -1 is returned. If + {title} is given, it will be used to set |w:quickfix_title| + after opening the location window. Otherwise, same as |setqflist()|. Also see |location-list|. @@ -6222,6 +6246,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* {val}. Tabs are numbered starting with one. For the current tabpage use |setwinvar()|. + {winnr} can be the window number or the window ID. When {winnr} is zero the current window is used. This also works for a global or local buffer option, but it doesn't work for a global or local buffer variable. @@ -7250,9 +7275,11 @@ win_id2win({expr}) *win_id2win()* *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer - associated with window {nr}. When {nr} is zero, the number of - the buffer in the current window is returned. When window - {nr} doesn't exist, -1 is returned. + associated with window {nr}. {nr} can be the window number or + the window ID. + When {nr} is zero, the number of the buffer in the current + window is returned. + When window {nr} doesn't exist, -1 is returned. Example: > :echo "The file in the current window is " . bufname(winbufnr(0)) < @@ -7263,6 +7290,7 @@ wincol() The result is a Number, which is the virtual column of the winheight({nr}) *winheight()* The result is a Number, which is the height of window {nr}. + {nr} can be the window number or the window ID. When {nr} is zero, the height of the current window is returned. When window {nr} doesn't exist, -1 is returned. An existing window always has a height of zero or more. @@ -7342,6 +7370,7 @@ winsaveview() Returns a |Dictionary| that contains information to restore winwidth({nr}) *winwidth()* The result is a Number, which is the width of window {nr}. + {nr} can be the window number or the window ID. When {nr} is zero, the width of the current window is returned. When window {nr} doesn't exist, -1 is returned. An existing window always has a width of zero or more. diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 5fcfad04a3..3d585267d7 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -710,6 +710,10 @@ call <SID>Header("editing text") call append("$", "undolevels\tmaximum number of changes that can be undone") call append("$", "\t(global or local to buffer)") call append("$", " \tset ul=" . &ul) +call append("$", "undofile\tautomatically save and restore undo history") +call <SID>BinOptionG("udf", &udf) +call append("$", "undodir\tlist of directories for undo files") +call <SID>OptionG("udir", &udir) call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload") call append("$", " \tset ur=" . &ur) call append("$", "modified\tchanges have been made and not written to a file") @@ -1032,10 +1036,6 @@ if has("vertsplit") call append("$", "cmdwinheight\theight of the command-line window") call <SID>OptionG("cwh", &cwh) endif -call append("$", "undofile\tautomatically save and restore undo history") -call <SID>BinOptionG("udf", &udf) -call append("$", "undodir\tlist of directories for undo files") -call <SID>OptionG("udir", &udir) call <SID>Header("executing external commands") diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index c53dde8ceb..17cba123a8 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -19,6 +19,12 @@ inoremap <C-U> <C-G>u<C-U> " Switch syntax highlighting on syntax on +" Also switch on highlighting the last used search pattern. +set hlsearch + +" I like highlighting strings inside C comments. +let c_comment_strings=1 + " Enable file type detection. " Use the default filetype settings, so that mail gets 'textwidth' set to 72, " 'cindent' is on in C files, etc. |