diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2022-08-07 16:01:34 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2022-08-07 16:01:34 -0600 |
commit | a5f27a311fb28797a72b8aa16ec7122c5a1b15e4 (patch) | |
tree | 3732f7339e29431f31310aef6ffc802cf4f6255d /runtime/doc | |
parent | 6c909fedc924d9f4257aa204b0168c6177cc5d28 (diff) | |
parent | 629169462a82f0fbb7a8911a4554894537d6776c (diff) | |
download | rneovim-a5f27a311fb28797a72b8aa16ec7122c5a1b15e4.tar.gz rneovim-a5f27a311fb28797a72b8aa16ec7122c5a1b15e4.tar.bz2 rneovim-a5f27a311fb28797a72b8aa16ec7122c5a1b15e4.zip |
Merge branch 'master' of https://github.com/neovim/neovim into rahm
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/builtin.txt | 105 | ||||
-rw-r--r-- | runtime/doc/gui.txt | 4 | ||||
-rw-r--r-- | runtime/doc/map.txt | 101 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 17 |
4 files changed, 163 insertions, 64 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index f0f47cddf4..c56ab70774 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -132,12 +132,12 @@ executable({expr}) Number 1 if executable {expr} exists execute({command}) String execute and capture output of {command} exepath({expr}) String full path of the command {expr} exists({expr}) Number |TRUE| if {expr} exists -extend({expr1}, {expr2} [, {expr3}]) - List/Dict insert items of {expr2} into {expr1} exp({expr}) Float exponential of {expr} expand({expr} [, {nosuf} [, {list}]]) any expand special keywords in {expr} expandcmd({expr}) String expand {expr} like with `:edit` +extend({expr1}, {expr2} [, {expr3}]) + List/Dict insert items of {expr2} into {expr1} feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer filereadable({file}) Number |TRUE| if {file} is a readable file filewritable({file}) Number |TRUE| if {file} is a writable file @@ -243,8 +243,8 @@ histadd({history}, {item}) String add an item to a history histdel({history} [, {item}]) String remove an item from a history histget({history} [, {index}]) String get the item {index} from a history histnr({history}) Number highest index of a history -hlexists({name}) Number |TRUE| if highlight group {name} exists hlID({name}) Number syntax ID of highlight group {name} +hlexists({name}) Number |TRUE| if highlight group {name} exists hostname() String name of the machine Vim is running on iconv({expr}, {from}, {to}) String convert encoding of {expr} indent({lnum}) Number indent of line {lnum} @@ -319,6 +319,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) List {count}'th match of {pat} in {expr} max({expr}) Number maximum value of items in {expr} menu_get({path} [, {modes}]) List description of |menus| matched by {path} +menu_info({name} [, {mode}]) Dict get menu item information min({expr}) Number minimum value of items in {expr} mkdir({name} [, {path} [, {prot}]]) Number create directory {name} @@ -340,8 +341,8 @@ prompt_setinterrupt({buf}, {text}) none set prompt interrupt function prompt_setprompt({buf}, {text}) none set prompt text pum_getpos() Dict position and size of pum if visible pumvisible() Number whether popup menu is visible -pyeval({expr}) any evaluate |Python| expression py3eval({expr}) any evaluate |python3| expression +pyeval({expr}) any evaluate |Python| expression pyxeval({expr}) any evaluate |python_x| expression rand([{expr}]) Number get pseudo-random number range({expr} [, {max} [, {stride}]]) @@ -460,10 +461,10 @@ str2list({expr} [, {utf8}]) List convert each character of {expr} to ASCII/UTF-8 value str2nr({expr} [, {base} [, {quoted}]]) Number convert String to Number -strchars({expr} [, {skipcc}]) Number character length of the String {expr} strcharpart({str}, {start} [, {len}]) String {len} characters of {str} at character {start} +strchars({expr} [, {skipcc}]) Number character length of the String {expr} strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} strftime({format} [, {time}]) String format time with a specified format strgetchar({str}, {index}) Number get char {index} from {str} @@ -498,8 +499,8 @@ tabpagebuflist([{arg}]) List list of buffer numbers in tab page tabpagenr([{arg}]) Number number of current or last tab page tabpagewinnr({tabarg} [, {arg}]) Number number of current window in tab page -taglist({expr} [, {filename}]) List list of tags matching {expr} tagfiles() List tags files used +taglist({expr} [, {filename}]) List list of tags matching {expr} tan({expr}) Float tangent of {expr} tanh({expr}) Float hyperbolic tangent of {expr} tempname() String name for a temporary file @@ -2140,7 +2141,7 @@ feedkeys({string} [, {mode}]) *feedkeys()* script continues. Note that if you manage to call feedkeys() while executing commands, thus calling it recursively, then - all typehead will be consumed by the last call. + all typeahead will be consumed by the last call. '!' When used with 'x' will not end Insert mode. Can be used in a test when a timer is set to exit Insert mode a little later. Useful for testing CursorHoldI. @@ -2173,7 +2174,7 @@ filewritable({file}) *filewritable()* directory, and we can write to it, the result is 2. Can also be used as a |method|: > - GetName()->filewriteable() + GetName()->filewritable() filter({expr1}, {expr2}) *filter()* {expr1} must be a |List|, |Blob|, or a |Dictionary|. @@ -3256,7 +3257,7 @@ getmousepos() *getmousepos()* "screenrow" and "screencol" are valid, the others are zero. When on the status line below a window or the vertical - separater right of a window, the "line" and "column" values + separator right of a window, the "line" and "column" values are zero. When the position is after the text then "column" is the @@ -4835,7 +4836,7 @@ mapset({mode}, {abbr}, {dict}) *mapset()* call mapset('n', 0, save_map) < Note that if you are going to replace a map in several modes, e.g. with `:map!`, you need to save the mapping for all of - them, since they can differe. + them, since they can differ. match({expr}, {pat} [, {start} [, {count}]]) *match()* @@ -5194,6 +5195,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()* Can also be used as a |method|: > GetText()->matchstrpos('word') < + *max()* max({expr}) Return the maximum value of all items in {expr}. Example: > echo max([apples, pears, oranges]) @@ -5207,6 +5209,7 @@ max({expr}) Return the maximum value of all items in {expr}. Example: > Can also be used as a |method|: > mylist->max() + menu_get({path} [, {modes}]) *menu_get()* Returns a |List| of |Dictionaries| describing |menus| (defined by |:menu|, |:amenu|, …), including |hidden-menus|. @@ -5253,7 +5256,81 @@ menu_get({path} [, {modes}]) *menu_get()* } ] < - *min()* +menu_info({name} [, {mode}]) *menu_info()* + Return information about the specified menu {name} in + mode {mode}. The menu name should be specified without the + shortcut character ('&'). If {name} is "", then the top-level + menu names are returned. + + {mode} can be one of these strings: + "n" Normal + "v" Visual (including Select) + "o" Operator-pending + "i" Insert + "c" Cmd-line + "s" Select + "x" Visual + "t" Terminal-Job + "" Normal, Visual and Operator-pending + "!" Insert and Cmd-line + When {mode} is omitted, the modes for "" are used. + + Returns a |Dictionary| containing the following items: + accel menu item accelerator text |menu-text| + display display name (name without '&') + enabled v:true if this menu item is enabled + Refer to |:menu-enable| + icon name of the icon file (for toolbar) + |toolbar-icon| + iconidx index of a built-in icon + modes modes for which the menu is defined. In + addition to the modes mentioned above, these + characters will be used: + " " Normal, Visual and Operator-pending + name menu item name. + noremenu v:true if the {rhs} of the menu item is not + remappable else v:false. + priority menu order priority |menu-priority| + rhs right-hand-side of the menu item. The returned + string has special characters translated like + in the output of the ":menu" command listing. + When the {rhs} of a menu item is empty, then + "<Nop>" is returned. + script v:true if script-local remapping of {rhs} is + allowed else v:false. See |:menu-script|. + shortcut shortcut key (character after '&' in + the menu name) |menu-shortcut| + silent v:true if the menu item is created + with <silent> argument |:menu-silent| + submenus |List| containing the names of + all the submenus. Present only if the menu + item has submenus. + + Returns an empty dictionary if the menu item is not found. + + Examples: > + :echo menu_info('Edit.Cut') + :echo menu_info('File.Save', 'n') + + " Display the entire menu hierarchy in a buffer + func ShowMenu(name, pfx) + let m = menu_info(a:name) + call append(line('$'), a:pfx .. m.display) + for child in m->get('submenus', []) + call ShowMenu(a:name .. '.' .. escape(child, '.'), + \ a:pfx .. ' ') + endfor + endfunc + new + for topmenu in menu_info('').submenus + call ShowMenu(topmenu, '') + endfor +< + Can also be used as a |method|: > + GetMenuName()->menu_info('v') + + +< *min()* min({expr}) Return the minimum value of all items in {expr}. Example: > echo min([apples, pears, oranges]) @@ -6485,8 +6562,10 @@ searchcount([{options}]) *searchcount()* recompute |Boolean| if |TRUE|, recompute the count like |n| or |N| was executed. otherwise returns the last - result by |n|, |N|, or this - function is returned. + computed result (when |n| or + |N| was used when "S" is not + in 'shortmess', or this + function was called). (default: |TRUE|) pattern |String| recompute if this was given and different with |@/|. diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 776ff228d6..8f09e5225f 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -201,9 +201,11 @@ tooltips for menus. See |terminal-input|. Special characters in a menu name: + *menu-shortcut* & The next character is the shortcut key. Make sure each shortcut key is only used once in a (sub)menu. If you want to insert a literal "&" in the menu name use "&&". + *menu-text* <Tab> Separates the menu name from right-aligned text. This can be used to show the equivalent typed command. The text "<Tab>" can be used here for convenience. If you are using a real @@ -561,7 +563,7 @@ item for the keyword under the cursor. The register "z" is used. > mappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" is the <CR> key. |<>|) - + *tooltips* *menu-tips* Tooltips & Menu tips See section |42.4| in the user manual. diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 1e1f4e46af..b0ce2d4164 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1483,74 +1483,79 @@ in the preview namespace. Here's an example of a command to trim trailing whitespace from lines that supports incremental command preview: > - -- Trims trailing whitespace in the current buffer. - -- Also performs 'inccommand' preview if invoked as a preview callback - -- (preview_ns is non-nil). - local function trim_space(opts, preview_ns, preview_buf) + -- If invoked as a preview callback, performs 'inccommand' preview by + -- highlighting trailing whitespace in the current buffer. + local function trim_space_preview(opts, preview_ns, preview_buf) local line1 = opts.line1 local line2 = opts.line2 local buf = vim.api.nvim_get_current_buf() - local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, 0) - local new_lines = {} + local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, false) local preview_buf_line = 0 for i, line in ipairs(lines) do - local startidx, endidx = string.find(line, '%s+$') - - if startidx ~= nil then - -- Highlight the match if in command preview mode - if preview_ns ~= nil then - vim.api.nvim_buf_add_highlight( - buf, preview_ns, 'Substitute', line1 + i - 2, startidx - 1, - endidx - ) - - -- Add lines and highlight to the preview buffer - -- if inccommand=split - if preview_buf ~= nil then - local prefix = string.format('|%d| ', line1 + i - 1) - - vim.api.nvim_buf_set_lines( - preview_buf, preview_buf_line, preview_buf_line, 0, - { prefix .. line } - ) - vim.api.nvim_buf_add_highlight( - preview_buf, preview_ns, 'Substitute', preview_buf_line, - #prefix + startidx - 1, #prefix + endidx - ) - - preview_buf_line = preview_buf_line + 1 - end + local start_idx, end_idx = string.find(line, '%s+$') + + if start_idx then + -- Highlight the match + vim.api.nvim_buf_add_highlight( + buf, + preview_ns, + 'Substitute', + line1 + i - 2, + start_idx - 1, + end_idx + ) + + -- Add lines and set highlights in the preview buffer + -- if inccommand=split + if preview_buf then + local prefix = string.format('|%d| ', line1 + i - 1) + + vim.api.nvim_buf_set_lines( + preview_buf, + preview_buf_line, + preview_buf_line, + false, + { prefix .. line } + ) + vim.api.nvim_buf_add_highlight( + preview_buf, + preview_ns, + 'Substitute', + preview_buf_line, + #prefix + start_idx - 1, + #prefix + end_idx + ) + preview_buf_line = preview_buf_line + 1 end end - - if not preview_ns then - new_lines[#new_lines+1] = string.gsub(line, '%s+$', '') - end end - -- Don't make any changes to the buffer if previewing - if not preview_ns then - vim.api.nvim_buf_set_lines(buf, line1 - 1, line2, 0, new_lines) - end + -- Return the value of the preview type + return 2 + end - -- When called as a preview callback, return the value of the - -- preview type - if preview_ns ~= nil then - return 2 + -- Trims all trailing whitespace in the current buffer. + local function trim_space(opts) + local line1 = opts.line1 + local line2 = opts.line2 + local buf = vim.api.nvim_get_current_buf() + local lines = vim.api.nvim_buf_get_lines(buf, line1 - 1, line2, false) + + local new_lines = {} + for i, line in ipairs(lines) do + new_lines[i] = string.gsub(line, '%s+$', '') end + vim.api.nvim_buf_set_lines(buf, line1 - 1, line2, false, new_lines) end -- Create the user command vim.api.nvim_create_user_command( 'TrimTrailingWhitespace', trim_space, - { nargs = '?', range = '%', addr = 'lines', preview = trim_space } + { nargs = '?', range = '%', addr = 'lines', preview = trim_space_preview } ) < -Note that in the above example, the same function is used as both the command -callback and the preview callback, but you could instead use separate -functions. Special cases ~ diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 5acef2f352..008b9b4e58 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -648,6 +648,7 @@ List manipulation: *list-functions* deepcopy() make a full copy of a List filter() remove selected items from a List map() change each List item + reduce() reduce a List to a value sort() sort a List reverse() reverse the order of a List uniq() remove copies of repeated adjacent items @@ -705,6 +706,8 @@ Floating point computation: *float-functions* sinh() hyperbolic sine cosh() hyperbolic cosine tanh() hyperbolic tangent + isinf() check for infinity + isnan() check for not a number Other computation: *bitwise-function* and() bitwise AND @@ -712,6 +715,8 @@ Other computation: *bitwise-function* or() bitwise OR xor() bitwise XOR sha256() SHA-256 hash + rand() get a pseudo-random number + srand() initialize seed used by rand() Variables: *var-functions* type() type of a variable @@ -765,6 +770,7 @@ Working with text in the current buffer: *text-functions* prevnonblank() find previous non-blank line search() find a match for a pattern searchpos() find a match for a pattern + searchcount() get number of matches before/after the cursor searchpair() find the other end of a start/skip/end searchpairpos() find the other end of a start/skip/end searchdecl() search for the declaration of a name @@ -841,9 +847,11 @@ Buffers, windows and the argument list: deletebufline() delete lines from a specified buffer win_findbuf() find windows containing a buffer win_getid() get window ID of a window + win_gettype() get type of window win_gotoid() go to window with ID win_id2tabwin() get tab and window nr from window ID win_id2win() get window nr from window ID + win_splitmove() move window to a split of another window win_move_separator() move window vertical separator win_move_statusline() move window status line getbufinfo() get a list with buffer information @@ -926,6 +934,7 @@ Interactive: *interactive-functions* confirm() let the user make a choice getchar() get a character from the user getcharmod() get modifiers for the last typed character + getmousepos() get last known mouse position feedkeys() put characters in the typeahead queue input() get a line from the user inputlist() let the user pick an entry from a list @@ -963,7 +972,7 @@ Window size and position: *window-size-functions* winsaveview() get view of current window winrestview() restore saved view of current window -Mappings: *mapping-functions* +Mappings and Menus: *mapping-functions* digraph_get() get |digraph| digraph_getlist() get all |digraph|s digraph_set() register |digraph| @@ -971,6 +980,8 @@ Mappings: *mapping-functions* hasmapto() check if a mapping exists mapcheck() check if a matching mapping exists maparg() get rhs of a mapping + mapset() restore a mapping + menu_info() get information about a menu item wildmenumode() check if the wildmode is active Signs: *sign-functions* @@ -1054,10 +1065,12 @@ Various: *various-functions* wordcount() get byte/word/char count of buffer - luaeval() evaluate Lua expression + luaeval() evaluate |Lua| expression py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) pyxeval() evaluate |python_x| expression + rubyeval() evaluate |Ruby| expression + debugbreak() interrupt a program being debugged ============================================================================== |