diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-08-16 00:58:06 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-08-18 21:29:01 +0200 |
commit | d7bc55c72d2efa99fc80ae2e0d421acfb798d968 (patch) | |
tree | 89a6dda8c9ffcbc677a423fddb5f9b14cacf5192 /runtime | |
parent | f465bf0cfa3c20152de2d3ca2ddede9fbcde086e (diff) | |
download | rneovim-d7bc55c72d2efa99fc80ae2e0d421acfb798d968.tar.gz rneovim-d7bc55c72d2efa99fc80ae2e0d421acfb798d968.tar.bz2 rneovim-d7bc55c72d2efa99fc80ae2e0d421acfb798d968.zip |
doc
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 39 |
1 files changed, 33 insertions, 6 deletions
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() |