diff options
Diffstat (limited to 'runtime/doc/usr_41.txt')
-rw-r--r-- | runtime/doc/usr_41.txt | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 910aebae70..e206a804f4 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -588,7 +588,7 @@ after the substitute() call. FUNCTIONS *function-list* There are many functions. We will mention them here, grouped by what they are -used for. You can find an alphabetical list here: |builtin-function-list|. +used for. You can find an alphabetical list here: |builtin-function-details|. Use CTRL-] on the function name to jump to detailed help on it. String manipulation: *string-functions* @@ -621,14 +621,18 @@ String manipulation: *string-functions* strlen() length of a string in bytes strcharlen() length of a string in characters strchars() number of characters in a string + strutf16len() number of UTF-16 code units in a string strwidth() size of string when displayed strdisplaywidth() size of string when displayed, deals with tabs setcellwidths() set character cell width overrides getcellwidths() get character cell width overrides + reverse() reverse the order of characters in a string substitute() substitute a pattern match with a string submatch() get a specific match in ":s" and substitute() strpart() get part of a string using byte index strcharpart() get part of a string using char index + slice() take a slice of a string, using char index in + Vim9 script strgetchar() get character from a string using char index expand() expand special keywords expandcmd() expand a command like done for `:edit` @@ -636,6 +640,7 @@ String manipulation: *string-functions* byteidx() byte index of a character in a string byteidxcomp() like byteidx() but count composing characters charidx() character index of a byte in a string + utf16idx() UTF-16 index of a byte in a string repeat() repeat a string multiple times eval() evaluate a string expression execute() execute an Ex command and get the output @@ -650,26 +655,32 @@ List manipulation: *list-functions* insert() insert an item somewhere in a List add() append an item to a List extend() append a List to a List + extendnew() make a new List and append items remove() remove one or more items from a List copy() make a shallow copy of a List deepcopy() make a full copy of a List filter() remove selected items from a List map() change each List item + mapnew() make a new List with changed items reduce() reduce a List to a value + slice() take a slice of a List sort() sort a List - reverse() reverse the order of a List + reverse() reverse the order of items in a List uniq() remove copies of repeated adjacent items split() split a String into a List join() join List items into a String range() return a List with a sequence of numbers string() String representation of a List call() call a function with List as arguments - index() index of a value in a List + index() index of a value in a List or Blob + indexof() index in a List or Blob where an expression + evaluates to true max() maximum value in a List min() minimum value in a List count() count number of times a value appears in a List repeat() repeat a List multiple times flatten() flatten a List + flattennew() flatten a copy of a List Dictionary manipulation: *dict-functions* get() get an entry without an error for a wrong key @@ -678,8 +689,10 @@ Dictionary manipulation: *dict-functions* empty() check if Dictionary is empty remove() remove an entry from a Dictionary extend() add entries from one Dictionary to another + extendnew() make a new Dictionary and append items filter() remove selected entries from a Dictionary map() change each Dictionary entry + mapnew() make a new Dictionary with changed items keys() get List of Dictionary keys values() get List of Dictionary values items() get List of Dictionary key-value pairs @@ -716,6 +729,11 @@ Floating point computation: *float-functions* isinf() check for infinity isnan() check for not a number +Blob manipulation: *blob-functions* + blob2list() get a list of numbers from a blob + list2blob() get a blob from a list of numbers + reverse() reverse the order of numbers in a blob + Other computation: *bitwise-function* and() bitwise AND invert() bitwise invert @@ -874,6 +892,7 @@ Buffers, windows and the argument list: getwininfo() get a list with window information getchangelist() get a list of change list entries getjumplist() get a list of jump list entries + swapfilelist() list of existing swap files in 'directory' swapinfo() information about a swap file swapname() get the swap file path of a buffer @@ -996,6 +1015,7 @@ Mappings and Menus: *mapping-functions* hasmapto() check if a mapping exists mapcheck() check if a matching mapping exists maparg() get rhs of a mapping + maplist() get list of all mappings mapset() restore a mapping menu_info() get information about a menu item wildmenumode() check if the wildmode is active @@ -1047,6 +1067,14 @@ Prompt Buffer: *promptbuffer-functions* prompt_setinterrupt() set interrupt callback for a buffer prompt_setprompt() set the prompt text for a buffer +Registers: *register-functions* + getreg() get contents of a register + getreginfo() get information about a register + getregtype() get type of a register + setreg() set contents and type of a register + reg_executing() return the name of the register being executed + reg_recording() return the name of the register being recorded + Context Stack: *ctx-functions* ctxget() return context at given index from top ctxpop() pop and restore top context @@ -1063,19 +1091,13 @@ Various: *various-functions* did_filetype() check if a FileType autocommand was used eventhandler() check if invoked by an event handler getpid() get process ID of Vim + getscriptinfo() get list of sourced vim scripts libcall() call a function in an external library libcallnr() idem, returning a number undofile() get the name of the undo file - undotree() return the state of the undo tree - - getreg() get contents of a register - getreginfo() get information about a register - getregtype() get type of a register - setreg() set contents and type of a register - reg_executing() return the name of the register being executed - reg_recording() return the name of the register being recorded + undotree() return the state of the undo tree for a buffer shiftwidth() effective value of 'shiftwidth' @@ -1316,6 +1338,8 @@ is a List with arguments. Function references are most useful in combination with a Dictionary, as is explained in the next section. +More information about defining your own functions here: |user-function|. + ============================================================================== *41.8* Lists and Dictionaries @@ -1763,7 +1787,7 @@ PITFALLS Even bigger problem arises in the following example: > :map ,ab o#include - :unmap ,ab + :unmap ,ab Here the unmap command will not work, because it tries to unmap ",ab ". This does not exist as a mapped sequence. An error will be issued, which is very @@ -2225,7 +2249,7 @@ Example: > Write this single-line file as "ftdetect/foofoo.vim" in the first directory that appears in 'runtimepath'. For Unix that would be -"~/.config/nvim/ftdetect/foofoo.vim". The convention is to use the name of +"~/.config/nvim/ftdetect/foofoo.vim". The convention is to use the name of the filetype for the script name. You can make more complicated checks if you like, for example to inspect the @@ -2296,7 +2320,7 @@ you can write the different setting in a script: > Now write this in the "after" directory, so that it gets sourced after the distributed "vim.vim" ftplugin |after-directory|. For Unix this would be -"~/.config/nvim/after/ftplugin/vim.vim". Note that the default plugin will +"~/.config/nvim/after/ftplugin/vim.vim". Note that the default plugin will have set "b:did_ftplugin", but it is ignored here. @@ -2466,7 +2490,7 @@ a user to overrule or add to the default file. The default files start with: > :let current_compiler = "mine" When you write a compiler file and put it in your personal runtime directory -(e.g., ~/.config/nvim/compiler for Unix), you set the "current_compiler" +(e.g., ~/.config/nvim/compiler for Unix), you set the "current_compiler" variable to make the default file skip the settings. *:CompilerSet* The second mechanism is to use ":set" for ":compiler!" and ":setlocal" for |