diff options
author | ckelsel <ckelsel@hotmail.com> | 2017-08-21 09:19:08 +0800 |
---|---|---|
committer | ckelsel <ckelsel@hotmail.com> | 2017-08-21 09:19:08 +0800 |
commit | 0b6fa3a553da3b83419c48fcbb6fb3ec413598e0 (patch) | |
tree | 63cda34cb93df36f64be4beea934ee34d850104c /runtime | |
parent | 673fc748237345914e0ad584bc4cba997c96a37e (diff) | |
parent | 8d1ccb606d3806dcf9c4bcfdb0446d8139c0e765 (diff) | |
download | rneovim-0b6fa3a553da3b83419c48fcbb6fb3ec413598e0.tar.gz rneovim-0b6fa3a553da3b83419c48fcbb6fb3ec413598e0.tar.bz2 rneovim-0b6fa3a553da3b83419c48fcbb6fb3ec413598e0.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/health.vim | 2 | ||||
-rw-r--r-- | runtime/autoload/health/provider.vim | 12 | ||||
-rw-r--r-- | runtime/autoload/provider.vim | 2 | ||||
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 20 | ||||
-rw-r--r-- | runtime/doc/api.txt | 16 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 39 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 32 |
7 files changed, 84 insertions, 39 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index f875c8b797..bd99a0e104 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -90,7 +90,7 @@ endfunction " Changes ':h clipboard' to ':help |clipboard|'. function! s:help_to_link(s) abort - return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n]+)', ':help |\1|', 'g') + return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n ]+)', ':help |\1|', 'g') endfunction " Format a message for a specific report item diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index ec20615f69..26db5b77b7 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -121,14 +121,14 @@ function! s:check_clipboard() abort call health#report_start('Clipboard (optional)') let clipboard_tool = provider#clipboard#Executable() - if empty(clipboard_tool) + if exists('g:clipboard') && empty(clipboard_tool) + call health#report_error( + \ provider#clipboard#Error(), + \ ["Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."]) + elseif empty(clipboard_tool) call health#report_warn( - \ 'No clipboard tool found. Clipboard registers will not work.', + \ 'No clipboard tool found. Clipboard registers (`"+` and `"*`) 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.vim b/runtime/autoload/provider.vim index a4d5241b57..b46ae12b3c 100644 --- a/runtime/autoload/provider.vim +++ b/runtime/autoload/provider.vim @@ -10,7 +10,7 @@ function! provider#stderr_collector(chan_id, data, event) dict endfunction function! provider#clear_stderr(chan_id) - silent! call delete(s:stderr, a:chan_id) + silent! call remove(s:stderr, a:chan_id) endfunction function! provider#get_stderr(chan_id) diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 8eb694e9fa..8fe53c495a 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -3,6 +3,7 @@ " available. let s:copy = {} let s:paste = {} +let s:clipboard = {} " When caching is enabled, store the jobid of the xclip/xsel process keeping " ownership of the selection, so we know how long the cache is valid. @@ -23,7 +24,7 @@ function! s:selection.on_exit(jobid, data, event) abort call provider#clear_stderr(a:jobid) endfunction -let s:selections = { '*': s:selection, '+': copy(s:selection)} +let s:selections = { '*': s:selection, '+': copy(s:selection) } function! s:try_cmd(cmd, ...) abort let argv = split(a:cmd, " ") @@ -55,9 +56,15 @@ endfunction function! provider#clipboard#Executable() abort if exists('g:clipboard') + if type({}) isnot# type(g:clipboard) + \ || type({}) isnot# type(get(g:clipboard, 'copy', v:null)) + \ || type({}) isnot# type(get(g:clipboard, 'paste', v:null)) + let s:err = 'clipboard: invalid g:clipboard' + return '' + endif 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) + let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0) return get(g:clipboard, 'name', 'g:clipboard') elseif has('mac') && executable('pbcopy') let s:copy['+'] = 'pbcopy' @@ -104,16 +111,17 @@ function! provider#clipboard#Executable() abort return 'tmux' endif - let s:err = 'clipboard: No clipboard tool available. :help clipboard' + let s:err = 'clipboard: No clipboard tool. :help clipboard' return '' endfunction if empty(provider#clipboard#Executable()) + " provider#clipboard#Call() *must not* be defined if the provider is broken. + " Otherwise eval_has_provider() thinks the clipboard provider is + " functioning, and eval_call_provider() will happily call it. finish endif -let s:clipboard = {} - function! s:clipboard.get(reg) abort if s:selections[a:reg].owner > 0 return s:selections[a:reg].data @@ -154,7 +162,9 @@ function! s:clipboard.set(lines, regtype, reg) abort echohl WarningMsg echomsg 'clipboard: failed to execute: '.(s:copy[a:reg]) echohl None + return 0 endif + return 1 endfunction function! provider#clipboard#Call(method, args) abort diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 7c6b8a3c1a..e12cd1cfa9 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -171,8 +171,8 @@ nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special}) Parameters:~ {str} String to be converted. {from_part} Legacy Vim parameter. Usually true. - {do_lt} Also translate <lt>. Does nothing if - `special` is false. + {do_lt} Also translate <lt>. Ignored if `special` is + false. {special} Replace |keycodes|, e.g. <CR> becomes a "\n" char. @@ -309,20 +309,24 @@ nvim_set_option({name}, {value}) *nvim_set_option()* {value} New option value nvim_out_write({str}) *nvim_out_write()* - Writes a message to vim output buffer + Writes a message to the Vim output buffer. Does not append + "\n", the message is buffered (won't display) until a linefeed + is written. Parameters:~ {str} Message nvim_err_write({str}) *nvim_err_write()* - Writes a message to vim error buffer + Writes a message to the Vim error buffer. Does not append + "\n", the message is buffered (won't display) until a linefeed + is written. Parameters:~ {str} Message nvim_err_writeln({str}) *nvim_err_writeln()* - Writes a message to vim error buffer. Appends a linefeed to - ensure all contents are written. + Writes a message to the Vim error buffer. Appends "\n", so the + buffer is flushed (and displayed). Parameters:~ {str} Message diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 29e254b0b3..b37b0e8836 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1522,14 +1522,16 @@ v:errors Errors found by assert functions, such as |assert_true()|. *v:event* *event-variable* v:event Dictionary of event data for the current |autocommand|. Valid - only during the autocommand lifetime: storing or passing - `v:event` is invalid. Copy it instead: > + only during the event lifetime; storing or passing v:event is + invalid! Copy it instead: > au TextYankPost * let g:foo = deepcopy(v:event) < Keys vary by event; see the documentation for the specific - event, e.g. |TextYankPost|. + event, e.g. |DirChanged| or |TextYankPost|. KEY DESCRIPTION ~ - operator The current |operator|. Also set for - Ex commands (unlike |v:operator|). For + cwd Current working directory + scope Event-specific scope name. + operator Current |operator|. Also set for Ex + commands (unlike |v:operator|). For example if |TextYankPost| is triggered by the |:yank| Ex command then `v:event['operator']` is "y". @@ -4726,7 +4728,8 @@ input({opts}) "-complete=" argument. Refer to |:command-completion| for more information. Example: > let fname = input("File: ", "", "file") -< *E5400* *E5402* + +< *input()-highlight* *E5400* *E5402* The optional `highlight` key allows specifying function which will be used for highlighting user input. This function receives user input as its only argument and must return @@ -4744,6 +4747,30 @@ input({opts}) sections must be ordered so that next hl_start_col is greater then or equal to previous hl_end_col. + Example (try some input with parentheses): > + highlight RBP1 guibg=Red ctermbg=red + highlight RBP2 guibg=Yellow ctermbg=yellow + highlight RBP3 guibg=Green ctermbg=green + highlight RBP4 guibg=Blue ctermbg=blue + let g:rainbow_levels = 4 + function! RainbowParens(cmdline) + let ret = [] + let i = 0 + let lvl = 0 + while i < len(a:cmdline) + if a:cmdline[i] is# '(' + call add(ret, [i, i + 1, 'RBP' . ((lvl % g:rainbow_levels) + 1)]) + let lvl += 1 + elseif a:cmdline[i] is# ')' + let lvl -= 1 + call add(ret, [i, i + 1, 'RBP' . ((lvl % g:rainbow_levels) + 1)]) + endif + let i += 1 + endwhile + return ret + endfunction + call input({'prompt':'>','highlight':'RainbowParens'}) +< Highlight function is called at least once for each new displayed input string, before command-line is redrawn. It is expected that function is pure for the duration of one input() diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 2f031c0b1f..eb3c4d50ce 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -6,9 +6,8 @@ Differences between Nvim and Vim *vim-differences* -Throughout the help files, differences between Nvim and Vim are indicated via -the "{Nvim}" tag. This document is a complete and centralized list of all -these differences. +Nvim differs from Vim in many ways, big and small. This document is +a complete and centralized reference of those differences. Type <M-]> to see the table of contents. @@ -72,12 +71,18 @@ Clipboard integration |provider-clipboard| USER EXPERIENCE ~ -Working intuitively and consistently is a major goal of Nvim. Examples: +Working intuitively and consistently is a major goal of Nvim. -- Nvim does not have `-X`, a platform-specific option "sometimes" available in - Vim (with potential surprises: http://stackoverflow.com/q/14635295). Nvim - avoids features that cannot be provided on all platforms--instead that is - delegated to external plugins/extensions. + *feature-compile* +- Nvim always includes ALL features, in contrast to Vim (which ships with + various combinations of 100+ optional features). Think of it as a leaner + version of Vim's "HUGE" build. This reduces surface area for bugs, and + removes a common source of confusion and friction for users. + +- Nvim avoids features that cannot be provided on all platforms; instead that + is delegated to external plugins/extensions. E.g. the `-X` platform-specific + option is "sometimes" available in Vim (with potential surprises: + http://stackoverflow.com/q/14635295). - Vim's internal test functions (test_autochdir(), test_settime(), etc.) are not exposed (nor implemented); instead Nvim has a robust API. @@ -268,13 +273,12 @@ Lua interface (|if_lua.txt|): - Lua has direct access to Nvim |API| via `vim.api`. - Lua package.path and package.cpath are automatically updated according to 'runtimepath': |lua-require|. -- Currently, most legacy Vim features are missing. -|input()| and |inputdialog()| gained support for each other’s features (return -on cancel and completion respectively) via dictionary argument (replaces all +|input()| and |inputdialog()| support for each other’s features (return on +cancel and completion respectively) via dictionary argument (replaces all other arguments if used). -|input()| and |inputdialog()| now support user-defined cmdline highlighting. +|input()| and |inputdialog()| support user-defined cmdline highlighting. ============================================================================== 5. Missing legacy features *nvim-features-missing* @@ -282,7 +286,7 @@ other arguments if used). Some legacy Vim features are not implemented: - |if_py|: vim.bindeval() and vim.Function() are not supported -- |if_lua|: the `vim` object currently only supports `vim.api` +- |if_lua|: the `vim` object is missing most legacy methods - *if_perl* - *if_mzscheme* - *if_tcl* @@ -290,7 +294,7 @@ Some legacy Vim features are not implemented: ============================================================================== 6. Removed features *nvim-features-removed* -These features are in Vim, but have been intentionally removed from Nvim. +These Vim features were intentionally removed from Nvim. *'cp'* *'nocompatible'* *'nocp'* *'compatible'* Nvim is always "non-compatible" with Vi. |