This commit is contained in:
Justin M. Keyes 2017-08-16 00:58:06 +02:00
parent f465bf0cfa
commit d7bc55c72d
2 changed files with 50 additions and 16 deletions

View File

@ -48,17 +48,24 @@ and [more](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
Project layout Project layout
-------------- --------------
├─ ci/ Build server scripts ├─ ci/ build automation
├─ cmake/ Build scripts ├─ cmake/ build scripts
├─ runtime/ User plugins/docs ├─ runtime/ user plugins/docs
├─ src/ Source code ├─ src/ application source code (see src/nvim/README.md)
├─ third-party/ CMake subproject to build dependencies │ ├─ api/ API subsystem
└─ test/ Test code │ ├─ eval/ VimL subsystem
│ ├─ event/ event-loop subsystem
│ ├─ generators/ code generation (pre-compilation)
│ ├─ lib/ generic data structures
│ ├─ lua/ lua subsystem
│ ├─ msgpack_rpc/ RPC subsystem
│ ├─ os/ low-level platform code
│ └─ tui/ built-in UI
├─ third-party/ cmake subproject to build dependencies
└─ test/ tests (see test/README.md)
- `third-party/` is activated if `USE_BUNDLED_DEPS` is undefined or the - To disable `third-party/` specify `USE_BUNDLED_DEPS=NO` or `USE_BUNDLED=NO`
`USE_BUNDLED` CMake option is true. (CMake option).
- [Source README](src/nvim/README.md)
- [Test README](test/README.md)
Features Features
-------- --------

View File

@ -1522,14 +1522,16 @@ v:errors Errors found by assert functions, such as |assert_true()|.
*v:event* *event-variable* *v:event* *event-variable*
v:event Dictionary of event data for the current |autocommand|. Valid v:event Dictionary of event data for the current |autocommand|. Valid
only during the autocommand lifetime: storing or passing only during the event lifetime; storing or passing v:event is
`v:event` is invalid. Copy it instead: > invalid! Copy it instead: >
au TextYankPost * let g:foo = deepcopy(v:event) au TextYankPost * let g:foo = deepcopy(v:event)
< Keys vary by event; see the documentation for the specific < Keys vary by event; see the documentation for the specific
event, e.g. |TextYankPost|. event, e.g. |DirChanged| or |TextYankPost|.
KEY DESCRIPTION ~ KEY DESCRIPTION ~
operator The current |operator|. Also set for cwd Current working directory
Ex commands (unlike |v:operator|). For scope Event-specific scope name.
operator Current |operator|. Also set for Ex
commands (unlike |v:operator|). For
example if |TextYankPost| is triggered example if |TextYankPost| is triggered
by the |:yank| Ex command then by the |:yank| Ex command then
`v:event['operator']` is "y". `v:event['operator']` is "y".
@ -4726,7 +4728,8 @@ input({opts})
"-complete=" argument. Refer to |:command-completion| for "-complete=" argument. Refer to |:command-completion| for
more information. Example: > more information. Example: >
let fname = input("File: ", "", "file") let fname = input("File: ", "", "file")
< *E5400* *E5402*
< *input()-highlight* *E5400* *E5402*
The optional `highlight` key allows specifying function which The optional `highlight` key allows specifying function which
will be used for highlighting user input. This function will be used for highlighting user input. This function
receives user input as its only argument and must return 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 sections must be ordered so that next hl_start_col is greater
then or equal to previous hl_end_col. 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 Highlight function is called at least once for each new
displayed input string, before command-line is redrawn. It is displayed input string, before command-line is redrawn. It is
expected that function is pure for the duration of one input() expected that function is pure for the duration of one input()