diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 1ad9f62227..cc497fa5e4 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -899,18 +899,24 @@ nvim_get_color_map() *nvim_get_color_map()* (`table`) Map of color names and RGB values. nvim_get_context({opts}) *nvim_get_context()* - Gets a map of the current editor state. + Gets a map (msgpack encoding) of the current editor state: + • "bufs" |buffer-list| + • "funcs" Vimscript global and |script-local| functions + • "gvars" |global-variable|s + • "jumps" |jumplist| + • "regs" |registers| + • "sfuncs" Vimscript |script-local| functions Attributes: ~ Since: 0.4.0 Parameters: ~ • {opts} (`vim.api.keyset.context?`) Optional parameters. - • types: List of |context-types| ("regs", "jumps", "bufs", - "gvars", …) to gather, or empty for "all". + • types: List of context types (see above) to gather, or empty + for "all". Return: ~ - (`table`) map of global |context|. + (`table`) Editor state as a msgpack-encoded map. nvim_get_current_buf() *nvim_get_current_buf()* Gets the current buffer. @@ -1260,13 +1266,14 @@ nvim_list_wins() *nvim_list_wins()* (`integer[]`) List of |window-ID|s nvim_load_context({dict}) *nvim_load_context()* - Sets the current editor state from the given |context| map. + Sets the current editor state from the given map. Attributes: ~ Since: 0.4.0 Parameters: ~ - • {dict} (`table`) |Context| map. + • {dict} (`table`) Msgpack-encoded editor state, in the + form returned by |nvim_get_context()|. Return: ~ (`any`) diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 45890af1b9..68a79bce01 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -388,19 +388,21 @@ CTRL-\ CTRL-G works the same as |CTRL-\_CTRL-N| for backward compatibility. *:exm* *:exmode* *gQ* *mode-Ex* *Ex-mode* *Ex* *EX* *E501* :exm[ode] -[count]q: Switch to Ex mode. This is like typing ":" commands - one after another, except you don't have to keep - pressing ":". Use |:visual| to exit this mode. +[count]q: Switch to Ex mode. This is like the |cmdwin| except + it stays open, in Insert-mode, so can you keep + entering ":" commands (REPL style). Use |:visual| to + exit this mode. + + If a command moves the cursor or changes the buffer, + the current line is printed. An empty line moves to + (and prints) the next line. + Without [count], "q:" opens the regular |cmdwin|. - Implementation details: a persistent |cmdwin| where - executes the current line as a command - (against the window from which Ex mode was entered) - and stays open, in insert-mode. Command output is - presented as comment (") lines. After a command that - moves the cursor or changes the buffer, the current - line is printed. An empty line moves to (and prints) - the next line. + Implementation: a persistent |cmdwin| where + executes the current line as a command (against the + window from which Ex mode was entered). Command output + is presented as comment (") lines. ============================================================================== Window contents *window-contents* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index ce252108ea..87dc10076f 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -781,13 +781,18 @@ A jump table for the options with a short description can be found at |Q_op|. *'autochdir'* *'acd'* *'noautochdir'* *'noacd'* 'autochdir' 'acd' boolean (default off) global - When on, Vim will change the current working directory whenever you - open a file, switch buffers, delete a buffer or open/close a window. - It will change to the directory containing the file which was opened - or selected. When a buffer has no name it also has no directory, thus - the current directory won't change when navigating to it. + When on, Nvim will change its global |current-directory| to the parent + of the current file, whenever you open a file, switch buffers, delete + a buffer or open/close a window. + + When a buffer has no name it also has no directory, thus the current + directory won't change when navigating to it. + Note: When this option is on some plugins may not work. + Alternatively, consider using |:bcd|, |:lcd|, or |:tcd| in an autocmd, + to selectively set a local (not global) directory. See |project-dir|. + *'autocomplete'* *'ac'* *'noautocomplete'* *'noac'* 'autocomplete' 'ac' boolean (default off) global or local to buffer |global-local| diff --git a/runtime/doc/plugins.txt b/runtime/doc/plugins.txt index a3adf3e3bd..315ebf279b 100644 --- a/runtime/doc/plugins.txt +++ b/runtime/doc/plugins.txt @@ -138,6 +138,7 @@ This clears the built-in directory-opening autocommands. >lua end, }) < + *netrw* To enable the legacy "netrw" plugin: >vim :packadd netrw diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 10f1813873..9660af5c1c 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -4,7 +4,7 @@ NVIM REFERENCE MANUAL -Repeating commands, Vim scripts and debugging *repeating* +Repeating commands *repeating* Chapter 26 of the user manual introduces repeating |usr_26.txt|. @@ -213,736 +213,5 @@ Multiple cursors *mcursor* *multicursor* todo -============================================================================== -Using Vim scripts *using-scripts* - -For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. - - *:so* *:source* -:so[urce] {file} Runs |Ex-command|s or Lua code (".lua" files) from - {file}. Triggers the |SourcePre| autocommand. - -:[range]so[urce] Read Ex commands or Lua code from the [range] of lines - in the current buffer. When [range] is omitted read - all lines. The buffer is treated as Lua code if its - 'filetype' is "lua" or its filename ends with ".lua". - - When sourcing commands or Lua code from the current - buffer, the same script-ID || is used even if the - buffer is sourced multiple times. If a buffer is - sourced more than once, then the functions in the - buffer are defined again. - - Implementation detail: When sourcing a [range] of - lines that falls inside a folded region, the range - will be adjusted to the start and end of the fold, - but only if a two line specifiers range was used. - - *:source!* -:so[urce]! {file} Runs |Normal-mode| commands from {file}. When used - after |:global|, |:argdo|, |:windo|, |:bufdo|, in - a loop or when another command follows the display - won't be updated while executing the commands. - - *:ru* *:runtime* -:ru[ntime][!] [where] {file} .. - Sources |Ex| commands or Lua code (".lua" files) read - from {file} (a relative path) in each directory given - by 'runtimepath' and/or 'packpath'. - Ignores non-existing files. - - Example: > - :runtime syntax/c.vim - :runtime syntax/c.lua - -< There can be multiple space-separated {file} - arguments. Each {file} is searched for in the first - directory from 'runtimepath', then in the second - directory, etc. - - When [!] is included, all found files are sourced. - Else only the first found file is sourced. - - When [where] is omitted only 'runtimepath' is used. - Other values: - START search only under "start" in 'packpath' - OPT search only under "opt" in 'packpath' - PACK search under "start" and "opt" in - 'packpath' - ALL first use 'runtimepath', then search - under "start" and "opt" in 'packpath' - - When {file} contains wildcards it is expanded to all - matching files. Example: > - :runtime! plugin/**/*.{vim,lua} -< This is what Nvim uses to load the plugin files when - starting up. This similar command: > - :runtime plugin/**/*.{vim,lua} -< would source the first file only. - - For each {file} pattern, if two `.vim` and `.lua` file - names match and differ only in extension, the `.vim` - file is sourced first. - - When 'verbose' is one or higher, there is a message - when no file could be found. - When 'verbose' is two or higher, there is a message - about each searched file. - - *:pa* *:packadd* *E919* -:pa[ckadd][!] {name} |pack-add| Search for an optional plugin directory in - 'packpath', source any plugin files found, and add it - to 'runtimepath'. The directory must match: > - pack/*/opt/{name} -< If the directory pack/*/opt/{name}/after exists it is - added at the end of 'runtimepath'. - - Note: Use |vim.pack.add()| to install from a URL. - - If loading packages from "pack/*/start" was skipped, - then this directory is searched first: > - pack/*/start/{name} -< - Note that {name} is the directory name, not the name - of the .vim file. All files matching the patterns > - pack/*/opt/{name}/plugin/**/*.vim - pack/*/opt/{name}/plugin/**/*.lua -< will be sourced. This allows for using subdirectories - below "plugin", just like with plugins in - 'runtimepath'. - - If the filetype detection was already enabled (this - is usually done with a `syntax enable` or `filetype on` - command in your |vimrc|, or automatically during - |initialization|), and the package was found in - "pack/*/opt/{name}", this command will also look - for "{name}/ftdetect/*.vim" files. - - When the optional "!" is given, no plugin/ files or - ftdetect/ scripts are loaded, only the matching - directories are added to 'runtimepath'. This is - useful in your |init.vim|. The plugins will then be - loaded during the |load-plugins| |initialization| step - (note that the loading order will be reversed because - each directory is inserted before others), after - loading the ftdetect scripts. - - To programmatically decide if `!` is needed during - startup, check |v:vim_did_init|: use `!` if 0 (to not - duplicate |load-plugins| step), no `!` otherwise (to - force load plugin files as otherwise they won't be - loaded automatically). - - *:packl* *:packloadall* -:packl[oadall][!] Load all packages in the "start" directory under each - entry in 'packpath'. - - First all the directories found are added to - 'runtimepath', then the plugins found in the - directories are sourced. This allows for a plugin to - depend on something of another plugin, e.g. an - "autoload" directory. See |packload-two-steps| for - how this can be useful. - - This is normally done automatically during startup, - after loading your |vimrc| file. With this command it - can be done earlier. - - Packages will be loaded only once. Using - `:packloadall` a second time will have no effect. - When the optional ! is added this command will load - packages even when done before. - - Note that when using `:packloadall` in the |vimrc| - file, the 'runtimepath' option is updated, and later - all plugins in 'runtimepath' will be loaded, which - means they are loaded again. Plugins are expected to - handle that. - - An error only causes sourcing the script where it - happens to be aborted, further plugins will be loaded. - See |packages|. - -:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167* - Specify the character encoding used in the script. - The following lines will be converted from [encoding] - to the value of the 'encoding' option, if they are - different. Examples: > - scriptencoding iso-8859-5 - scriptencoding cp932 -< - When [encoding] is empty, no conversion is done. This - can be used to restrict conversion to a sequence of - lines: > - scriptencoding euc-jp - ... lines to be converted ... - scriptencoding - ... not converted ... - -< When conversion isn't supported by the system, there - is no error message and no conversion is done. When a - line can't be converted there is no error and the - original line is kept. - - Don't use "ucs-2" or "ucs-4", scripts cannot be in - these encodings (they would contain NUL bytes). - When a sourced script starts with a BOM (Byte Order - Mark) in utf-8 format Vim will recognize it, no need - to use ":scriptencoding utf-8" then. - - *:scr* *:scriptnames* -:scr[iptnames] List all sourced script names, in the order they were - first sourced. The number is used for the script ID - ||. - Also see `getscriptinfo()`. - -:scr[iptnames][!] {scriptId} *:script* - Edit script {scriptId}. Although ":scriptnames name" - works, using ":script name" is recommended. - When the current buffer can't be |abandon|ed and the ! - is not present, the command fails. - - *:fini* *:finish* *E168* -:fini[sh] Stop sourcing a script. Can only be used in a Vim - script file. This is a quick way to skip the rest of - the file. If it is used after a |:try| but before the - matching |:finally| (if present), the commands - following the ":finally" up to the matching |:endtry| - are executed first. This process applies to all - nested ":try"s in the script. The outermost ":endtry" - then stops sourcing the script. - -All commands and command sequences can be repeated by putting them in a named -register and then executing it. There are two ways to get the commands in the -register: -- Use the record command "q". You type the commands once, and while they are - being executed they are stored in a register. Easy, because you can see - what you are doing. If you make a mistake, "p"ut the register into the - file, edit the command sequence, and then delete it into the register - again. You can continue recording by appending to the register (use an - uppercase letter). -- Delete or yank the command sequence into the register. - -Often used command sequences can be put under a function key with the ':map' -command. - -An alternative is to put the commands in a file, and execute them with the -':source!' command. Useful for long command sequences. Can be combined with -the ':map' command to put complicated commands under a function key. - -The ':source' command reads Ex commands from a file or a buffer line by line. -You will have to type any needed keyboard input. The ':source!' command reads -from a script file character by character, interpreting each character as if -you typed it. - -Example: When you give the ":!ls" command you get the |hit-enter| prompt. If -you ':source' a file with the line "!ls" in it, you will have to type the - yourself. But if you ':source!' a file with the line ":!ls" in it, -the next characters from that file are read until a is found. You will -not have to type yourself, unless ":!ls" was the last line in the file. - -It is possible to put ':source[!]' commands in the script file, so you can -make a top-down hierarchy of script files. The ':source' command can be -nested as deep as the number of files that can be opened at one time (about -15). The ':source!' command can be nested up to 15 levels deep. - -You can use the "