Browse Source

docs, remove 'guifontset' #11708

- remove redundant autocmd list
  This "grouped" list is useless, it only gets in the way when searching
  for event names.
- intro.txt: cleanup
- starting.txt: update, revisit
- doc: `:help bisect`
- mbyte.txt: update aliases 1656367b90. closes #11960
- options: remove 'guifontset'. Why:
  - It is complicated and is used by almost no one.
  - It is unlikely to be implemented by Nvim GUIs (complicated to parse,
    specific to Xorg...).
pull/12818/head
Justin M. Keyes 4 months ago
committed by GitHub
parent
commit
c2662210b5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 329 additions and 720 deletions
  1. +9
    -12
      .gitignore
  2. +1
    -1
      runtime/doc/api.txt
  3. +7
    -167
      runtime/doc/autocmd.txt
  4. +22
    -27
      runtime/doc/eval.txt
  5. +1
    -1
      runtime/doc/help.txt
  6. +31
    -62
      runtime/doc/intro.txt
  7. +3
    -3
      runtime/doc/lsp.txt
  8. +93
    -70
      runtime/doc/lua.txt
  9. +23
    -185
      runtime/doc/mbyte.txt
  10. +1
    -1
      runtime/doc/message.txt
  11. +1
    -2
      runtime/doc/mlang.txt
  12. +1
    -1
      runtime/doc/nvim_terminal_emulator.txt
  13. +5
    -38
      runtime/doc/options.txt
  14. +0
    -2
      runtime/doc/quickref.txt
  15. +71
    -104
      runtime/doc/starting.txt
  16. +1
    -2
      runtime/doc/ui.txt
  17. +1
    -1
      runtime/doc/usr_02.txt
  18. +10
    -8
      runtime/doc/vim_diff.txt
  19. +1
    -1
      runtime/lua/vim/lsp.lua
  20. +8
    -10
      runtime/lua/vim/shared.lua
  21. +32
    -8
      scripts/gen_vimdoc.py
  22. +3
    -3
      src/nvim/api/vim.c
  23. +0
    -1
      src/nvim/option_defs.h
  24. +0
    -9
      src/nvim/options.lua
  25. +4
    -0
      src/nvim/os/time.c
  26. +0
    -1
      test/functional/ui/options_spec.lua

+ 9
- 12
.gitignore View File

@ -1,13 +1,14 @@
# Tools
.ropeproject/
/venv/
compile_commands.json
# Visual Studio
# IDEs
/.vs/
/.vscode/
/.idea/
# Build/deps dir
/build/
/cmake-build-debug/
/dist/
/.deps/
/tmp/
/.clangd/
@ -20,8 +21,6 @@ compile_commands.json
*.o
*.so
tags
/src/nvim/po/vim.pot
/src/nvim/po/*.ck
@ -57,14 +56,12 @@ tags
# local make targets
local.mk
# runtime/doc
# Generated from :help docs
tags
/runtime/doc/*.html
/runtime/doc/tags.ref
/runtime/doc/errors.log
# Don't include the mpack files.
# Generated by gen_vimdoc.py:
/runtime/doc/*.mpack
# Also don't include intermediary doc output
/tmp-*-doc
# CLion
/.idea/

+ 1
- 1
runtime/doc/api.txt View File

@ -70,7 +70,7 @@ Nvim instance:
nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS'])
result = nvim.call(:nvim_command, 'echo "hello world!"')
<
A better way is to use the Python REPL with the `neovim` package, where API
A better way is to use the Python REPL with the "pynvim" package, where API
functions can be called interactively:
>
>>> from pynvim import attach

+ 7
- 167
runtime/doc/autocmd.txt View File

@ -206,169 +206,9 @@ autocommands, this doesn't happen.
You can use the 'eventignore' option to ignore a number of events or all
events.
*autocommand-events* *{event}*
Vim recognizes the following events. Vim ignores the case of event names
(e.g., you can use "BUFread" or "bufread" instead of "BufRead").
First an overview by function with a short explanation. Then the list
alphabetically with full explanations |autocmd-events-abc|.
Name triggered by ~
Reading
|BufNewFile| starting to edit a file that doesn't exist
|BufReadPre| starting to edit a new buffer, before reading the file
|BufRead| starting to edit a new buffer, after reading the file
|BufReadPost| starting to edit a new buffer, after reading the file
|BufReadCmd| before starting to edit a new buffer |Cmd-event|
|FileReadPre| before reading a file with a ":read" command
|FileReadPost| after reading a file with a ":read" command
|FileReadCmd| before reading a file with a ":read" command |Cmd-event|
|FilterReadPre| before reading a file from a filter command
|FilterReadPost| after reading a file from a filter command
|StdinReadPre| before reading from stdin into the buffer
|StdinReadPost| After reading from the stdin into the buffer
Writing
|BufWrite| starting to write the whole buffer to a file
|BufWritePre| starting to write the whole buffer to a file
|BufWritePost| after writing the whole buffer to a file
|BufWriteCmd| before writing the whole buffer to a file |Cmd-event|
|FileWritePre| starting to write part of a buffer to a file
|FileWritePost| after writing part of a buffer to a file
|FileWriteCmd| before writing part of a buffer to a file |Cmd-event|
|FileAppendPre| starting to append to a file
|FileAppendPost| after appending to a file
|FileAppendCmd| before appending to a file |Cmd-event|
|FilterWritePre| starting to write a file for a filter command or diff
|FilterWritePost| after writing a file for a filter command or diff
Buffers
|BufAdd| just after adding a buffer to the buffer list
|BufDelete| before deleting a buffer from the buffer list
|BufWipeout| before completely deleting a buffer
|BufFilePre| before changing the name of the current buffer
|BufFilePost| after changing the name of the current buffer
|BufEnter| after entering a buffer
|BufLeave| before leaving to another buffer
|BufWinEnter| after a buffer is displayed in a window
|BufWinLeave| before a buffer is removed from a window
|BufUnload| before unloading a buffer
|BufHidden| just after a buffer has become hidden
|BufNew| just after creating a new buffer
|SwapExists| detected an existing swap file
|TermOpen| starting a terminal job
|TermEnter| entering Terminal-mode
|TermLeave| leaving Terminal-mode
|TermClose| stopping a terminal job
|ChanOpen| after a channel opened
|ChanInfo| after a channel has its state changed
Options
|FileType| when the 'filetype' option has been set
|Syntax| when the 'syntax' option has been set
|OptionSet| after setting any option
Startup and exit
|VimEnter| after doing all the startup stuff
|UIEnter| after a UI attaches
|UILeave| after a UI detaches
|TermResponse| after the terminal response to t_RV is received
|QuitPre| when using `:quit`, before deciding whether to exit
|ExitPre| when using a command that may make Vim exit
|VimLeavePre| before exiting Nvim, before writing the shada file
|VimLeave| before exiting Nvim, after writing the shada file
|VimResume| after Nvim is resumed
|VimSuspend| before Nvim is suspended
Various
|DiffUpdated| after diffs have been updated
|DirChanged| after the |current-directory| was changed
|FileChangedShell| Vim notices that a file changed since editing started
|FileChangedShellPost| after handling a file changed since editing started
|FileChangedRO| before making the first change to a read-only file
|ShellCmdPost| after executing a shell command
|ShellFilterPost| after filtering with a shell command
|CmdUndefined| a user command is used but it isn't defined
|FuncUndefined| a user function is used but it isn't defined
|SpellFileMissing| a spell file is used but it can't be found
|SourcePre| before sourcing a Vim script
|SourcePost| after sourcing a Vim script
|SourceCmd| before sourcing a Vim script |Cmd-event|
|VimResized| after the Vim window size changed
|FocusGained| Nvim got focus
|FocusLost| Nvim lost focus
|CursorHold| the user doesn't press a key for a while
|CursorHoldI| the user doesn't press a key for a while in Insert mode
|CursorMoved| the cursor was moved in Normal mode
|CursorMovedI| the cursor was moved in Insert mode
|WinClosed| after closing a window
|WinNew| after creating a new window
|WinEnter| after entering another window
|WinLeave| before leaving a window
|TabEnter| after entering another tab page
|TabLeave| before leaving a tab page
|TabNew| when creating a new tab page
|TabNewEntered| after entering a new tab page
|TabClosed| after closing a tab page
|CmdlineChanged| after a change was made to the command-line text
|CmdlineEnter| after entering cmdline mode
|CmdlineLeave| before leaving cmdline mode
|CmdwinEnter| after entering the command-line window
|CmdwinLeave| before leaving the command-line window
|InsertEnter| starting Insert mode
|InsertChange| when typing <Insert> while in Insert or Replace mode
|InsertLeave| when leaving Insert mode
|InsertCharPre| when a character was typed in Insert mode, before
inserting it
|TextYankPost| when some text is yanked or deleted
|TextChanged| after a change was made to the text in Normal mode
|TextChangedI| after a change was made to the text in Insert mode
when popup menu is not visible
|TextChangedP| after a change was made to the text in Insert mode
when popup menu visible
|ColorSchemePre| before loading a color scheme
|ColorScheme| after loading a color scheme
|RemoteReply| a reply from a server Vim was received
|QuickFixCmdPre| before a quickfix command is run
|QuickFixCmdPost| after a quickfix command is run
|SessionLoadPost| after loading a session file
|MenuPopup| just before showing the popup menu
|CompleteChanged| after popup menu changed, not fired on popup menu hide
|CompleteDonePre| after Insert mode completion is done, before clearing
info
|CompleteDone| after Insert mode completion is done, after clearing
info
|User| to be used in combination with ":doautocmd"
|Signal| after Nvim receives a signal
The alphabetical list of autocommand events: *autocmd-events-abc*
*events* *{event}*
Nvim recognizes the following events. Names are case-insensitive.
*BufAdd*
BufAdd Just after creating a new buffer which is
@ -642,7 +482,7 @@ CursorHold When the user doesn't press a key for the time
Hint: to force an update of the status lines
use: >
:let &ro = &ro
<
*CursorHoldI*
CursorHoldI Like CursorHold, but in Insert mode. Not
triggered when waiting for another key, e.g.
@ -1111,13 +951,13 @@ VimEnter After doing all the startup stuff, including
if v:vim_did_enter
call s:init()
else
au VimEnter * call s:init()
au VimEnter * call s:init()
endif
< *VimLeave*
VimLeave Before exiting Vim, just after writing the
.shada file. Executed only once, like
VimLeavePre.
< Use |v:dying| to detect an abnormal exit.
Use |v:dying| to detect an abnormal exit.
Use |v:exiting| to get the exit code.
Not triggered if |v:dying| is 2 or more.
*VimLeavePre*
@ -1126,7 +966,7 @@ VimLeavePre Before exiting Vim, just before writing the
if there is a match with the name of what
happens to be the current buffer when exiting.
Mostly useful with a "*" pattern. >
:autocmd VimLeavePre * call CleanupStuff()
:autocmd VimLeavePre * call CleanupStuff()
< Use |v:dying| to detect an abnormal exit.
Use |v:exiting| to get the exit code.
Not triggered if |v:dying| is 2 or more.

+ 22
- 27
runtime/doc/eval.txt View File

@ -7754,26 +7754,23 @@ sha256({string}) *sha256()*
shellescape({string} [, {special}]) *shellescape()*
Escape {string} for use as a shell command argument.
On Windows when 'shellslash' is not set, it
will enclose {string} in double quotes and double all double
quotes within {string}.
Otherwise, it will enclose {string} in single quotes and
replace all "'" with "'\''".
When the {special} argument is present and it's a non-zero
Number or a non-empty String (|non-zero-arg|), then special
items such as "!", "%", "#" and "<cword>" will be preceded by
a backslash. This backslash will be removed again by the |:!|
command.
The "!" character will be escaped (again with a |non-zero-arg|
{special}) when 'shell' contains "csh" in the tail. That is
because for csh and tcsh "!" is used for history replacement
even when inside single quotes.
On Windows when 'shellslash' is not set, encloses {string} in
double-quotes and doubles all double-quotes within {string}.
Otherwise encloses {string} in single-quotes and replaces all
"'" with "'\''".
If {special} is a ||non-zero-arg|:
- Special items such as "!", "%", "#" and "<cword>" will be
preceded by a backslash. The backslash will be removed again
by the |:!| command.
- The <NL> character is escaped.
With a |non-zero-arg| {special} the <NL> character is also
escaped. When 'shell' containing "csh" in the tail it's
escaped a second time.
If 'shell' contains "csh" in the tail:
- The "!" character will be escaped. This is because csh and
tcsh use "!" for history replacement even in single-quotes.
- The <NL> character is escaped (twice if {special} is
a ||non-zero-arg|).
Example of use with a |:!| command: >
:exe '!dir ' . shellescape(expand('<cfile>'), 1)
@ -8246,15 +8243,13 @@ sqrt({expr}) *sqrt()*
stdioopen({opts}) *stdioopen()*
In a nvim launched with the |--headless| option, this opens
stdin and stdout as a |channel|. This function can only be
invoked once per instance. See |channel-stdio| for more
information and examples. Note that stderr is not handled by
this function, see |v:stderr|.
With |--headless| this opens stdin and stdout as a |channel|.
May be called only once. See |channel-stdio|. stderr is not
handled by this function, see |v:stderr|.
Returns a |channel| ID. Close the stdio descriptors with |chanclose()|.
Use |chansend()| to send data to stdout, and
|rpcrequest()| and |rpcnotify()| to communicate over RPC.
Close the stdio handles with |chanclose()|. Use |chansend()|
to send data to stdout, and |rpcrequest()| and |rpcnotify()|
to communicate over RPC.
{opts} is a dictionary with these keys:
|on_stdin| : callback invoked when stdin is written to.
@ -8262,7 +8257,7 @@ stdioopen({opts}) *stdioopen()*
rpc : If set, |msgpack-rpc| will be used to communicate
over stdio
Returns:
- The channel ID on success (this is always 1)
- |channel-id| on success (value is always 1)
- 0 on invalid arguments

+ 1
- 1
runtime/doc/help.txt View File

@ -168,9 +168,9 @@ Versions ~
|vi_diff.txt| Main differences between Vim and Vi
*standard-plugin-list*
Standard plugins ~
|matchit.txt| Extended |%| matching
|pi_gzip.txt| Reading and writing compressed files
|pi_health.txt| Healthcheck framework
|pi_matchit.txt| Extended |%| matching
|pi_msgpack.txt| msgpack utilities
|pi_netrw.txt| Reading and writing files over a network
|pi_paren.txt| Highlight matching parens

+ 31
- 62
runtime/doc/intro.txt View File

@ -4,21 +4,15 @@
NVIM REFERENCE MANUAL
Introduction to Vim *ref* *reference*
Nvim *ref* *reference*
Type |gO| to see the table of contents.
==============================================================================
Introduction *intro*
Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many
improvements that a name change was appropriate. Vim is a text editor which
includes almost all the commands from the Unix program "Vi" and a lot of new
ones. It is very useful for editing programs and other plain text.
All commands are given with the keyboard. This has the advantage that you
can keep your fingers on the keyboard and your eyes on the screen. For those
who want it, there is mouse support and a GUI version with scrollbars and
menus (see |gui.txt|).
Vim is a text editor which includes most commands from the Unix program "Vi"
and many new ones.
An overview of this manual can be found in the file "help.txt", |help.txt|.
It can be accessed from within Vim with the <Help> or <F1> key and with the
@ -28,16 +22,15 @@ is not located in the default place. You can jump to subjects like with tags:
Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
*pronounce*
Vim is pronounced as one word, like Jim. Nvim is pronounced as N-vim, or,
continuing with the Jim simile, N-Jim, which sounds like Ninja.
Vim is pronounced as one word, like Jim. So Nvim is N-Jim, which sounds like
"Ninja". Starting Nvim is like performing a roundhouse kick.
This manual is a reference for all the Vim commands and options. This is not
an introduction to the use of Vi or Vim, it gets a bit complicated here and
there. For beginners, there is a hands-on |tutor|. To learn using Vim, read
the user manual |usr_toc.txt|.
This manual is a reference for all Nvim editor and API features. It is not an
introduction; instead for beginners, there is a hands-on |tutor| and a user
manual |usr_toc.txt|.
*book*
There are many books on Vi and Vim. We recommend these books:
There are many books on Vi and Vim. We recommend:
"Practical Vim" by Drew Neil
"Modern Vim" by Drew Neil
@ -48,7 +41,7 @@ tasks with Vim. "Modern Vim" explores new features in Nvim and Vim 8.
"Vim - Vi Improved" by Steve Oualline
This is the first book dedicated to Vim. Parts of it were included in the
This was the first book dedicated to Vim. Parts of it were included in the
user manual. |frombook| ISBN: 0735710015
For more information try one of these:
https://iccf-holland.org/click5.html
@ -63,11 +56,9 @@ Nvim on the interwebs *internet*
Nvim FAQ: https://github.com/neovim/neovim/wiki/FAQ
Downloads: https://github.com/neovim/neovim/releases
Vim FAQ: https://vimhelp.appspot.com/vim_faq.txt.html
Vim home page: https://www.vim.org/
*bugs* *bug-report* *bugreport.vim* *feature-request*
*bugs* *bug-report*
Report bugs and request features here:
https://github.com/neovim/neovim/issues
@ -97,7 +88,7 @@ Neovim development is funded separately from Vim:
https://neovim.io/#sponsor
==============================================================================
Credits *credits* *author* *Bram* *Moolenaar*
Credits *credits*
Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
@ -185,25 +176,21 @@ the ideas from all these people: They keep Vim alive!
*love* *peace* *friendship* *gross-national-happiness*
In this documentation there are several references to other versions of Vi:
Documentation may refer to other versions of Vi:
*Vi* *vi*
Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Sometimes other versions are referred
to. Only runs under Unix. Source code only available with a
license.
"Version 3.7, 6/7/85". Source code only available with a license.
*Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.
The version used is 1.79. ":version" returns "Version 1.79
(10/23/96)". There has been no release the last few years, although
there is a development version 1.81.
Source code is freely available.
(10/23/96)". Source code is freely available.
*Elvis*
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
as flexible as Vim.
The version used is 2.1. It is still being developed. Source code is
freely available.
as flexible as Vim. Source code is freely available.
Vim Nvim is based on Vim. https://www.vim.org/
==============================================================================
Notation *notation*
@ -387,37 +374,24 @@ notation meaning equivalent decimal value(s) ~
<D-…> command-key or "super" key *<D-*
-----------------------------------------------------------------------
Note: The shifted cursor keys, the help key, and the undo key are only
available on a few terminals.
Note: There are two codes for the delete key. 127 is the decimal ASCII value
for the delete key, which is always recognized. Some delete keys send another
value, in which case this value is obtained from the |terminfo| entry "key_dc".
Both values have the same effect.
Note:
Note: The keypad keys are used in the same way as the corresponding "normal"
keys. For example, <kHome> has the same effect as <Home>. If a keypad key
sends the same raw key code as its non-keypad equivalent, it will be
recognized as the non-keypad code. For example, when <kHome> sends the same
code as <Home>, when pressing <kHome> Vim will think <Home> was pressed.
Mapping <kHome> will not work then.
Note: If numlock is on, the |TUI| receives plain ASCII values, so
mappings to <k0> - <k9> and <kPoint> will not work.
Note: Nvim supports mapping multibyte chars with modifiers such as `<M-ä>`.
Which combinations actually are usable depends on the terminal emulator or GUI.
- Availability of some keys (<Help>, <S-Right>, …) depends on the UI or host
terminal.
- If numlock is on the |TUI| receives plain ASCII values, so mapping <k0>,
<k1>, ..., <k9> and <kPoint> will not work.
- Nvim supports mapping multibyte chars with modifiers such as `<M-ä>`. Which
combinations actually work depends on the the UI or host terminal.
*<>*
Examples are often given in the <> notation. Sometimes this is just to make
clear what you need to type, but often it can be typed literally, e.g., with
the ":map" command. The rules are:
1. Any printable characters are typed directly, except backslash and '<'
2. A backslash is represented with "\\", double backslash, or "<Bslash>".
3. A real '<' is represented with "\<" or "<lt>". When there is no
confusion possible, a '<' can be used directly.
4. "<key>" means the special key typed. This is the notation explained in
the table above. A few examples:
1. Printable characters are typed directly, except backslash and "<"
2. Backslash is represented with "\\", double backslash, or "<Bslash>".
3. Literal "<" is represented with "\<" or "<lt>". When there is no
confusion possible, "<" can be used directly.
4. "<key>" means the special key typed (see the table above). Examples:
<Esc> Escape key
<C-G> CTRL-G
<Up> cursor up key
@ -437,11 +411,6 @@ one always works.
To get a literal "<lt>" in a mapping: >
:map <C-L> <lt>lt>
For mapping, abbreviation and menu commands you can then copy-paste the
examples and use them directly. Or type them literally, including the '<' and
'>' characters. This does NOT work for other commands, like ":set" and
":autocmd"!
==============================================================================
Modes, introduction *vim-modes-intro* *vim-modes*
@ -599,7 +568,7 @@ Q or gQ Switch to Ex mode. This is like typing ":" commands
Use the ":vi" command |:visual| to exit this mode.
==============================================================================
The window contents *window-contents*
Window contents *window-contents*
In Normal mode and Insert/Replace mode the screen window will show the current
contents of the buffer: What You See Is What You Get. There are two

+ 3
- 3
runtime/doc/lsp.txt View File

@ -4,7 +4,7 @@
NVIM REFERENCE MANUAL
LSP client/framework *lsp*
LSP client/framework *lsp* *LSP*
Nvim supports the Language Server Protocol (LSP), which means it acts as
a client to LSP servers and includes a Lua framework `vim.lsp` for building
@ -647,7 +647,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
object. To stop all clients:
>
vim.lsp.stop_client(lsp.get_active_clients())
vim.lsp.stop_client(vim.lsp.get_active_clients())
<
By default asks the server to shutdown, unless stop was
@ -1435,4 +1435,4 @@ try_trim_markdown_code_blocks({lines})
Return: ~
(string) filetype or 'markdown' if it was unchanged.
vim:tw=78:ts=8:ft=help:norl:
vim:tw=78:ts=8:sw=2:et:ft=help:norl:

+ 93
- 70
runtime/doc/lua.txt View File

@ -9,7 +9,7 @@ Lua engine *lua* *Lua*
Type |gO| to see the table of contents.
==============================================================================
Introduction *lua-intro*
INTRODUCTION *lua-intro*
The Lua 5.1 language is builtin and always available. Try this command to get
an idea of what lurks beneath: >
@ -30,7 +30,7 @@ finds and loads Lua modules. The conventions are similar to VimL plugins,
with some extra features. See |lua-require-example| for a walkthrough.
==============================================================================
Importing Lua modules *lua-require*
IMPORTING LUA MODULES *lua-require*
*lua-package-path*
Nvim automatically adjusts `package.path` and `package.cpath` according to
@ -233,7 +233,7 @@ lua/charblob.lua: >
}
==============================================================================
Commands *lua-commands*
COMMANDS *lua-commands*
These commands execute a Lua chunk from either the command line (:lua, :luado)
or a file (:luafile) on the given line [range]. As always in Lua, each chunk
@ -456,7 +456,7 @@ management. Try this command to see available functions: >
:lua print(vim.inspect(vim.loop))
Reference: http://docs.libuv.org
Reference: https://github.com/luvit/luv/blob/master/docs.md
Examples: https://github.com/luvit/luv/tree/master/examples
*E5560* *lua-loop-callbacks*
@ -891,11 +891,6 @@ vim.api.{func}({...}) *vim.api*
Example: call the "nvim_get_current_line()" API function: >
print(tostring(vim.api.nvim_get_current_line()))
vim.call({func}, {...}) *vim.call()*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
See also |vim.fn|. Equivalent to: >
vim.fn[func]({...})
vim.in_fast_event() *vim.in_fast_event()*
Returns true if the code is executing as part of a "fast" event
handler, where most of the API is disabled. These are low-level events
@ -1055,22 +1050,6 @@ vim.wait({time}, {callback} [, {interval}]) *vim.wait()*
end
<
vim.fn.{func}({...}) *vim.fn*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
To call autoload functions, use the syntax: >
vim.fn['some#function']({...})
<
Unlike vim.api.|nvim_call_function| this converts directly between Vim
objects and Lua objects. If the Vim function returns a float, it will
be represented directly as a Lua number. Empty lists and dictionaries
both are represented by an empty table.
Note: |v:null| values as part of the return value is represented as
|vim.NIL| special value
Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
enumerates functions that were called at least once.
vim.type_idx *vim.type_idx*
Type index for use in |lua-special-tbl|. Specifying one of the
values from |vim.types| allows typing the empty table (it is
@ -1106,64 +1085,103 @@ vim.types *vim.types*
`vim.types.dictionary` will not change or that `vim.types` table will
only contain values for these three types.
==============================================================================
Vim Internal Variables *lua-vim-internal-variables*
Built-in Vim dictionaries can be accessed and set idiomatically in Lua by each
of the following tables.
To set a value: >
vim.g.my_global_variable = 5
<
------------------------------------------------------------------------------
LUA-VIMSCRIPT BRIDGE *lua-vimscript*
To read a value: >
Nvim Lua provides an interface to Vimscript variables and functions, and
editor commands and options.
print(vim.g.my_global_variable)
<
vim.call({func}, {...}) *vim.call()*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
See also |vim.fn|.
Equivalent to: >
vim.fn[func]({...})
To delete a value: >
vim.cmd({cmd}) *vim.cmd()*
Invokes an Ex command (the ":" commands, Vimscript statements).
See also |ex-cmd-index|.
Example: >
vim.cmd('echo 42')
vim.g.my_global_variable = nil
vim.fn.{func}({...}) *vim.fn*
Invokes |vim-function| or |user-function| {func} with arguments {...}.
To call autoload functions, use the syntax: >
vim.fn['some#function']({...})
<
Unlike vim.api.|nvim_call_function| this converts directly between Vim
objects and Lua objects. If the Vim function returns a float, it will
be represented directly as a Lua number. Empty lists and dictionaries
both are represented by an empty table.
vim.g *vim.g*
Table with values from |g:|
Keys with no values set will result in `nil`.
vim.b *vim.b*
Gets a buffer-scoped (b:) variable for the current buffer.
Keys with no values set will result in `nil`.
vim.w *vim.w*
Gets a window-scoped (w:) variable for the current window.
Keys with no values set will result in `nil`.
Note: |v:null| values as part of the return value is represented as
|vim.NIL| special value
vim.t *vim.t*
Gets a tabpage-scoped (t:) variable for the current table.
Keys with no values set will result in `nil`.
Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
enumerates functions that were called at least once.
vim.v *vim.v*
Gets a v: variable.
Keys with no values set will result in `nil`.
*lua-vim-variables*
The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables
described below. In this way you can easily read and modify global Vimscript
variables from Lua.
Vim Internal Options *lua-vim-internal-options*
Example: >
Read, set and clear vim |options| in Lua by each of the following tables.
vim.g.foo = 5 -- Set the g:foo Vimscript variable.
print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
vim.g *vim.g*
Global (|g:|) editor variables.
Key with no value returns `nil`.
vim.b *vim.b*
Buffer-scoped (|b:|) variables for the current buffer.
Invalid or unset key returns `nil`.
vim.w *vim.w*
Window-scoped (|w:|) variables for the current window.
Invalid or unset key returns `nil`.
vim.t *vim.t*
Tabpage-scoped (|t:|) variables for the current tabpage.
Invalid or unset key returns `nil`.
vim.v *vim.v*
|v:| variables.
Invalid or unset key returns `nil`.
vim.env *vim.env*
Environment variables defined in the editor session.
See |expand-env| and |:let-environment| for the Vimscript behavior.
Invalid or unset key returns `nil`.
Example: >
vim.env.FOO = 'bar'
print(vim.env.TERM)
<
*lua-vim-options*
From Lua you can work with editor |options| by reading and setting items in
these Lua tables:
vim.o *vim.o*
Table with values from |options|
Invalid keys will result in an error.
vim.o *vim.o*
Get or set editor options, like |:set|. Invalid key is an error.
Example: >
vim.o.cmdheight = 4
print(vim.o.columns)
vim.bo *vim.bo*
Gets a buffer-scoped option for the current buffer.
Invalid keys will result in an error.
vim.bo *vim.bo*
Get or set buffer-scoped |local-options|. Invalid key is an error.
Example: >
vim.bo.buflisted = true
print(vim.bo.comments)
vim.wo *vim.wo*
Gets a window-scoped option for the current window.
Invalid keys will result in an error.
vim.wo *vim.wo*
Get or set window-scoped |local-options|. Invalid key is an error.
Example: >
vim.wo.cursorcolumn = true
print(vim.wo.foldmarker)
==============================================================================
@ -1419,8 +1437,13 @@ tbl_flatten({t}) *vim.tbl_flatten()*
Fromhttps://github.com/premake/premake-core/blob/master/src/base/table.lua
tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty.
Parameters: ~
{t} Table to check
See also: ~
Fromhttps://github.com/premake/premake-core/blob/master/src/base/table.lua@paramt Table to check
https://github.com/premake/premake-core/blob/master/src/base/table.lua
tbl_islist({t}) *vim.tbl_islist()*
Determine whether a Lua table can be treated as an array.
@ -1530,4 +1553,4 @@ validate({opt}) *vim.validate()*
• msg: (optional) error string if validation
fails
vim:tw=78:ts=8:ft=help:norl:
vim:tw=78:ts=8:sw=2:et:ft=help:norl:

+ 23
- 185
runtime/doc/mbyte.txt View File

@ -71,24 +71,15 @@ If you are working in a terminal (emulator) you must make sure it accepts
UTF-8, the encoding which Vim is working with. Otherwise only ASCII can
be displayed and edited correctly.
For the GUI you must select fonts that work with UTF-8. This
is the difficult part. It depends on the system you are using, the locale and
a few other things.
For X11 you can set the 'guifontset' option to a list of fonts that together
cover the characters that are used. Example for Korean: >
:set guifontset=k12,r12
Alternatively, you can set 'guifont' and 'guifontwide'. 'guifont' is used for
the single-width characters, 'guifontwide' for the double-width characters.
Thus the 'guifontwide' font must be exactly twice as wide as 'guifont'.
Example for UTF-8: >
For the GUI you must select fonts that work with UTF-8. You can set 'guifont'
and 'guifontwide'. 'guifont' is used for the single-width characters,
'guifontwide' for the double-width characters. Thus the 'guifontwide' font
must be exactly twice as wide as 'guifont'. Example for UTF-8: >
:set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
:set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1
You can also set 'guifont' alone, Vim will try to find a matching
You can also set 'guifont' alone, the Nvim GUI will try to find a matching
'guifontwide' for you.
@ -267,16 +258,16 @@ Recognized 'fileencoding' values include: *encoding-values*
1 cp1258 Vietnamese
1 cp{number} MS-Windows: any installed single-byte codepage
2 cp932 Japanese (Windows only)
2 euc-jp Japanese (Unix only)
2 sjis Japanese (Unix only)
2 cp949 Korean (Unix and Windows)
2 euc-kr Korean (Unix only)
2 euc-jp Japanese
2 sjis Japanese
2 cp949 Korean
2 euc-kr Korean
2 cp936 simplified Chinese (Windows only)
2 euc-cn simplified Chinese (Unix only)
2 cp950 traditional Chinese (on Unix alias for big5)
2 big5 traditional Chinese (on Windows alias for cp950)
2 euc-tw traditional Chinese (Unix only)
2 2byte-{name} Unix: any double-byte encoding (Vim specific name)
2 euc-cn simplified Chinese
2 cp950 traditional Chinese (alias for big5)
2 big5 traditional Chinese (alias for cp950)
2 euc-tw traditional Chinese
2 2byte-{name} any double-byte encoding (Vim-specific name)
2 cp{number} MS-Windows: any installed double-byte codepage
u utf-8 32 bit UTF-8 encoded Unicode (ISO/IEC 10646-1)
u ucs-2 16 bit UCS-2 encoded Unicode (ISO/IEC 10646-1)
@ -298,14 +289,14 @@ the same encoding is used and it's called latin1. 'isprint' can be used to
display the characters 0x80 - 0xA0 or not.
Several aliases can be used, they are translated to one of the names above.
An incomplete list:
Incomplete list:
1 ansi same as latin1 (obsolete, for backward compatibility)
2 japan Japanese: on Unix "euc-jp", on MS-Windows cp932
2 korea Korean: on Unix "euc-kr", on MS-Windows cp949
2 prc simplified Chinese: on Unix "euc-cn", on MS-Windows cp936
2 japan Japanese: "euc-jp"
2 korea Korean: "euc-kr"
2 prc simplified Chinese: "euc-cn"
2 chinese same as "prc"
2 taiwan traditional Chinese: on Unix "euc-tw", on MS-Windows cp950
2 taiwan traditional Chinese: "euc-tw"
u utf8 same as utf-8
u unicode same as ucs-2
u ucs2be same as ucs-2 (big endian)
@ -394,148 +385,6 @@ conversion needs to be done. These conversions are supported:
request a very large buffer, more than Vim is willing to provide).
Try getting another iconv() implementation.
*iconv-dynamic*
On MS-Windows Vim can be compiled with the |+iconv/dyn| feature. This means
Vim will search for the "iconv.dll" and "libiconv.dll" libraries. When
neither of them can be found Vim will still work but some conversions won't be
possible.
==============================================================================
Fonts on X11 *mbyte-fonts-X11*
Unfortunately, using fonts in X11 is complicated. The name of a single-byte
font is a long string. For multi-byte fonts we need several of these...
First of all, Vim only accepts fixed-width fonts for displaying text. You
cannot use proportionally spaced fonts. This excludes many of the available
(and nicer looking) fonts. However, for menus and tooltips any font can be
used.
Note that Display and Input are independent. It is possible to see your
language even though you have no input method for it.
You should get a default font for menus and tooltips that works, but it might
be ugly. Read the following to find out how to select a better font.
X LOGICAL FONT DESCRIPTION (XLFD)
*XLFD*
XLFD is the X font name and contains the information about the font size,
charset, etc. The name is in this format:
FOUNDRY-FAMILY-WEIGHT-SLANT-WIDTH-STYLE-PIXEL-POINT-X-Y-SPACE-AVE-CR-CE
Each field means:
- FOUNDRY: FOUNDRY field. The company that created the font.
- FAMILY: FAMILY_NAME field. Basic font family name. (helvetica, gothic,
times, etc)
- WEIGHT: WEIGHT_NAME field. How thick the letters are. (light, medium,
bold, etc)
- SLANT: SLANT field.
r: Roman (no slant)
i: Italic
o: Oblique
ri: Reverse Italic
ro: Reverse Oblique
ot: Other
number: Scaled font
- WIDTH: SETWIDTH_NAME field. Width of characters. (normal, condensed,
narrow, double wide)
- STYLE: ADD_STYLE_NAME field. Extra info to describe font. (Serif, Sans
Serif, Informal, Decorated, etc)
- PIXEL: PIXEL_SIZE field. Height, in pixels, of characters.
- POINT: POINT_SIZE field. Ten times height of characters in points.
- X: RESOLUTION_X field. X resolution (dots per inch).
- Y: RESOLUTION_Y field. Y resolution (dots per inch).
- SPACE: SPACING field.
p: Proportional
m: Monospaced
c: CharCell
- AVE: AVERAGE_WIDTH field. Ten times average width in pixels.
- CR: CHARSET_REGISTRY field. The name of the charset group.
- CE: CHARSET_ENCODING field. The rest of the charset name. For some
charsets, such as JIS X 0208, if this field is 0, code points has
the same value as GL, and GR if 1.
For example, in case of a 16 dots font corresponding to JIS X 0208, it is
written like:
-misc-fixed-medium-r-normal--16-110-100-100-c-160-jisx0208.1990-0
X FONTSET
*fontset* *xfontset*
A single-byte charset is typically associated with one font. For multi-byte
charsets a combination of fonts is often used. This means that one group of
characters are used from one font and another group from another font (which
might be double wide). This collection of fonts is called a fontset.
Which fonts are required in a fontset depends on the current locale. X
windows maintains a table of which groups of characters are required for a
locale. You have to specify all the fonts that a locale requires in the
'guifontset' option.
NOTE: The fontset always uses the current locale, even though 'encoding' may
be set to use a different charset. In that situation you might want to use
'guifont' and 'guifontwide' instead of 'guifontset'.
Example:
|charset| language "groups of characters" ~
GB2312 Chinese (simplified) ISO-8859-1 and GB 2312
Big5 Chinese (traditional) ISO-8859-1 and Big5
CNS-11643 Chinese (traditional) ISO-8859-1, CNS 11643-1 and CNS 11643-2
EUC-JP Japanese JIS X 0201 and JIS X 0208
EUC-KR Korean ISO-8859-1 and KS C 5601 (KS X 1001)
You can search for fonts using the xlsfonts command. For example, when you're
searching for a font for KS C 5601: >
xlsfonts | grep ksc5601
This is complicated and confusing. You might want to consult the X-Windows
documentation if there is something you don't understand.
*base_font_name_list*
When you have found the names of the fonts you want to use, you need to set
the 'guifontset' option. You specify the list by concatenating the font names
and putting a comma in between them.
For example, when you use the ja_JP.eucJP locale, this requires JIS X 0201
and JIS X 0208. You could supply a list of fonts that explicitly specifies
the charsets, like: >
:set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0,
\-misc-fixed-medium-r-normal--14-130-75-75-c-70-jisx0201.1976-0
Alternatively, you can supply a base font name list that omits the charset
name, letting X-Windows select font characters required for the locale. For
example: >
:set guifontset=-misc-fixed-medium-r-normal--14-130-75-75-c-140,
\-misc-fixed-medium-r-normal--14-130-75-75-c-70
Alternatively, you can supply a single base font name that allows X-Windows to
select from all available fonts. For example: >
:set guifontset=-misc-fixed-medium-r-normal--14-*
Alternatively, you can specify alias names. See the fonts.alias file in the
fonts directory (e.g., /usr/X11R6/lib/X11/fonts/). For example: >
:set guifontset=k14,r14
<
*E253*
Note that in East Asian fonts, the standard character cell is square. When
mixing a Latin font and an East Asian font, the East Asian font width should
be twice the Latin font width.
If 'guifontset' is not empty, the "font" argument of the |:highlight| command
is also interpreted as a fontset. For example, you should use for
highlighting: >
:hi Comment font=english_font,your_font
If you use a wrong "font" argument you will get an error message.
Also make sure that you set 'guifontset' before setting fonts for highlight
groups.
==============================================================================
Input on X11 *mbyte-XIM*
@ -647,10 +496,6 @@ Note that Display and Input are independent. It is possible to see your
language even though you have no input method for it. But when your Display
method doesn't match your Input method, the text will be displayed wrong.
Note: You can not use IM unless you specify 'guifontset'.
Therefore, Latin users, you have to also use 'guifontset'
if you use IM.
To input your language you should run the |IM-server| which supports your
language and |conversion-server| if needed.
@ -962,9 +807,9 @@ Vim has comprehensive UTF-8 support. It works well in:
- MS-Windows GUI
- several other platforms
Double-width characters are supported. This works best with 'guifontwide' or
'guifontset'. When using only 'guifont' the wide characters are drawn in the
normal width and a space to fill the gap.
Double-width characters are supported. Works best with 'guifontwide'. When
using only 'guifont' the wide characters are drawn in the normal width and
a space to fill the gap.
*bom-bytes*
When reading a file a BOM (Byte Order Mark) can be used to recognize the
@ -1031,7 +876,6 @@ this:
1. Set 'guifont' and let Vim find a matching 'guifontwide'
2. Set 'guifont' and 'guifontwide'
3. Set 'guifontset'
See the documentation for each option for details. Example: >
@ -1077,10 +921,7 @@ not everybody is able to type a composing character.
==============================================================================
Overview of options *mbyte-options*
These options are relevant for editing multi-byte files. Check the help in
options.txt for detailed information.
'encoding' Internal text encoding, always "utf-8".
These options are relevant for editing multi-byte files.
'fileencoding' Encoding of a file. When it's different from "utf-8"
conversion is done when reading or writing the file.
@ -1096,9 +937,6 @@ options.txt for detailed information.
languages where a sequence of characters can be broken
anywhere.
'guifontset' The list of font names used for a multi-byte encoding. When
this option is not empty, it replaces 'guifont'.
'keymap' Specify the name of a keyboard mapping.
==============================================================================

+ 1
- 1
runtime/doc/message.txt View File

@ -359,7 +359,7 @@ the other way around. It should be used like this: {foo,bar}. This matches
ml_get: invalid lnum: {number}
This is an internal Vim error. Please try to find out how it can be
reproduced, and submit a bug report |bugreport.vim|.
reproduced, and submit a |bug-report|.
*E173* >
{number} more files to edit

+ 1
- 2
runtime/doc/mlang.txt View File

@ -124,8 +124,7 @@ maintainer of the translation and ask him to update it. You can find the
name and e-mail address of the translator in
"$VIMRUNTIME/lang/menu_<lang>.vim".
To set the font (or fontset) to use for the menus, use the |:highlight|
command. Example: >
To set the font to use for the menus, use the |:highlight| command. Example: >
:highlight Menu font=k12,r12

+ 1
- 1
runtime/doc/nvim_terminal_emulator.txt View File

@ -92,7 +92,7 @@ Mouse input has the following behavior:
the terminal wont lose focus and the hovered window will be scrolled.
==============================================================================
Configuration *terminal-configuration*
Configuration *terminal-config*
Options: 'modified', 'scrollback'
Events: |TermOpen|, |TermEnter|, |TermLeave|, |TermClose|

+ 5
- 38
runtime/doc/options.txt View File

@ -118,8 +118,7 @@ A few special texts:
Option was set with command line argument |-c|, +, |-S| or
|-q|.
Last set from environment variable ~
Option was set from an environment variable, $VIMINIT,
$GVIMINIT or $EXINIT.
Option was set from $VIMINIT.
Last set from error handler ~
Option was cleared when evaluating it resulted in an error.
@ -2796,9 +2795,6 @@ A jump table for the options with a short description can be found at |Q_op|.
font names a list can be specified, font names separated with commas.
The first valid font is used.
On systems where 'guifontset' is supported (X11) and 'guifontset' is
not empty, then 'guifont' is not used.
Spaces after a comma are ignored. To include a comma in a font name
precede it with a backslash. Setting an option requires an extra
backslash before a space and a backslash. See also
@ -2850,45 +2846,16 @@ A jump table for the options with a short description can be found at |Q_op|.
:set guifont=courier_new:h12:w5:b:cRUSSIAN
:set guifont=Andale_Mono:h7.5:w4.5
<
*'guifontset'* *'gfs'*
*E250* *E252* *E234* *E597* *E598*
'guifontset' 'gfs' string (default "")
global
When not empty, specifies two (or more) fonts to be used. The first
one for normal English, the second one for your special language. See
|xfontset|.
Setting this option also means that all font names will be handled as
a fontset name. Also the ones used for the "font" argument of the
|:highlight| command.
The fonts must match with the current locale. If fonts for the
character sets that the current locale uses are not included, setting
'guifontset' will fail.
Note the difference between 'guifont' and 'guifontset': In 'guifont'
the comma-separated names are alternative names, one of which will be
used. In 'guifontset' the whole string is one fontset name,
including the commas. It is not possible to specify alternative
fontset names.
This example works on many X11 systems: >
:set guifontset=-*-*-medium-r-normal--16-*-*-*-c-*-*-*
<
*'guifontwide'* *'gfw'* *E231* *E533* *E534*
'guifontwide' 'gfw' string (default "")
global
When not empty, specifies a comma-separated list of fonts to be used
for double-width characters. The first font that can be loaded is
used.
Comma-separated list of fonts to be used for double-width characters.
The first font that can be loaded is used.
Note: The size of these fonts must be exactly twice as wide as the one
specified with 'guifont' and the same height.
'guifontwide' is only used when 'guifontset' is empty or invalid.
When 'guifont' is set and a valid font is found in it and
'guifontwide' is empty Vim will attempt to find a matching
double-width font and set 'guifontwide' to it.
Windows +multibyte only: *guifontwide_win_mbyte*
If set and valid, 'guifontwide' is used for IME instead of 'guifont'.
When 'guifont' has a valid font and 'guifontwide' is empty Vim will
attempt to set 'guifontwide' to a matching double-width font.
*'guioptions'* *'go'*
'guioptions' 'go' string (default "egmrLT" (MS-Windows))

+ 0
- 2
runtime/doc/quickref.txt View File

@ -711,7 +711,6 @@ Short explanation of each option: *option-list*
'grepprg' 'gp' program to use for ":grep"
'guicursor' 'gcr' GUI: settings for cursor shape and blinking
'guifont' 'gfn' GUI: Name(s) of font(s) to be used
'guifontset' 'gfs' GUI: Names of multi-byte fonts to be used
'guifontwide' 'gfw' list of font names for double-wide characters
'guioptions' 'go' GUI: Which components and options are used
'guitablabel' 'gtl' GUI: custom label for a tab page
@ -1106,7 +1105,6 @@ Context-sensitive completion on the command-line:
------------------------------------------------------------------------------
*Q_st* Starting Vim
|-vim| vim [options] start editing with an empty buffer
|-file| vim [options] {file} .. start editing one or more files
|--| vim [options] - read file from stdin
|-tag| vim [options] -t {tag} edit the file associated with {tag}

+ 71
- 104
runtime/doc/starting.txt View File

@ -9,20 +9,20 @@ Starting Vim *starting*
Type |gO| to see the table of contents.
==============================================================================
1. Vim arguments *vim-arguments*
Nvim arguments *vim-arguments*
Most often, Vim is started to edit a single file with the command
Most often, Nvim is started to edit a single file with the command: >
nvim filename *-vim*
nvim filename
More generally, Vim is started with:
More generally, Nvim is started with: >
nvim [option | filename] ..
Option arguments and file name arguments can be mixed, and any number of them
can be given. However, watch out for options that take an argument.
The following items may be used to choose how to start editing:
The following items decide how to start editing:
*-file* *---*
filename One or more file names. The first one will be the current
@ -231,9 +231,8 @@ argument.
-b Binary mode. File I/O will only recognize <NL> to separate
lines. The 'expandtab' option will be reset. The 'textwidth'
option is set to 0. 'modeline' is reset. The 'binary' option
is set. This is done after reading the init.vim/exrc files
but before reading any file in the arglist. See also
|edit-binary|.
is set. This is done after reading the |vimrc| but before
reading any file in the arglist. See also |edit-binary|.
*-l*
-l Lisp mode. Sets the 'lisp' and 'showmatch' options on.
@ -398,7 +397,7 @@ argument.
primary listen address |v:servername| to {addr}. |serverstart()|
==============================================================================
2. Initialization *initialization* *startup*
Initialization *initialization* *startup*
At startup, Vim checks environment variables and files and sets values
accordingly. Vim proceeds in this order:
@ -414,45 +413,47 @@ accordingly. Vim proceeds in this order:
The |-V| argument can be used to display or log what happens next,
useful for debugging the initializations.
3. Execute Ex commands, from environment variables and/or files
An environment variable (e.g. $VIMINIT) is read as one Ex command
line, where multiple commands must be separated with '|' or <NL>.
3. Wait for UI to connect.
Nvim started with |--embed| waits for the UI to connect before
proceeding to load user configuration.
4. Load user config (execute Ex commands from files, environment, …).
$VIMINIT environment variable is read as one Ex command line (separate
multiple commands with '|' or <NL>).
*config* *init.vim* *vimrc* *exrc*
A file that contains initialization commands is generically called
a "vimrc" or config file. Each line in a vimrc file is executed as an
Ex command line. See also |vimrc-intro| and |base-directories|.
A file containing init commands is generically called a "vimrc" or
"config". Each line in such a file is executed as an Ex command.
|vimrc-intro| |base-directories|
The Nvim config file is named "init.vim", located at:
The Nvim config file is "init.vim", located at:
Unix ~/.config/nvim/init.vim
Windows ~/AppData/Local/nvim/init.vim
Or if |$XDG_CONFIG_HOME| is defined:
or if |$XDG_CONFIG_HOME| is defined:
$XDG_CONFIG_HOME/nvim/init.vim
If Nvim was started with "-u filename", the file "filename" is used.
All following initializations until 4. are skipped. $MYVIMRC is not
set.
If Nvim was started with "-u {file}" then {file} is used as the config
and all initializations until 5. are skipped. $MYVIMRC is not set.
"nvim -u NORC" can be used to skip these initializations without
reading a file. "nvim -u NONE" also skips plugins and syntax
highlighting. |-u|
If Nvim was started with |-es|, all following initializations until 4.
are skipped.
If Nvim was started with |-es| all initializations until 5. are
skipped.
*system-vimrc* *sysinit.vim*
a. The system vimrc file is read for initializations. If
nvim/sysinit.vim file exists in one of $XDG_CONFIG_DIRS, it will be
used. Otherwise, the system vimrc file is used. The path of this file
is shown with the ":version" command. Mostly it's "$VIM/sysinit.vim".
used. Otherwise the system vimrc file is used. The path of this file
is given by the |:version| command. Usually it's "$VIM/sysinit.vim".
*VIMINIT* *EXINIT* *$MYVIMRC*
b. Four places are searched for initializations. The first that exists
is used, the others are ignored. The $MYVIMRC environment variable is
set to the file that was first found, unless $MYVIMRC was already set
and when using VIMINIT.
- Environment variable $VIMINIT, used as an Ex command line.
- User |config| file: $XDG_CONFIG_HOME/nvim/init.vim.
- Other config file: {xdg_config_dir}/nvim/init.vim where
{xdg_config_dir} is one of the directories in $XDG_CONFIG_DIRS.
- Environment variable $EXINIT, used as an Ex command line.
b. Locations searched for initializations, in order of preference:
- $VIMINIT environment variable (Ex command line).
- User |config|: $XDG_CONFIG_HOME/nvim/init.vim.
- Other config: {dir}/nvim/init.vim where {dir} is any directory
in $XDG_CONFIG_DIRS.
- $EXINIT environment variable (Ex command line).
|$MYVIMRC| is set to the first valid location unless it was already
set or when using $VIMINIT.
c. If the 'exrc' option is on (which is NOT the default), the current
directory is searched for two files. The first that exists is used,
@ -460,7 +461,7 @@ accordingly. Vim proceeds in this order:
- The file ".nvimrc"
- The file ".exrc"
4. Enable filetype and indent plugins.
5. Enable filetype and indent plugins.
This does the same as the commands: >
:runtime! filetype.vim
:runtime! ftplugin.vim
@ -468,13 +469,13 @@ accordingly. Vim proceeds in this order:
< Skipped if ":filetype … off" was called or if the "-u NONE" command
line argument was given.
5. Enable syntax highlighting.
6. Enable syntax highlighting.
This does the same as the command: >
:runtime! syntax/syntax.vim
< Skipped if ":syntax off" was called or if the "-u NONE" command
line argument was given.
6. Load the plugin scripts. *load-plugins*
7. Load the plugin scripts. *load-plugins*
This does the same as the command: >
:runtime! plugin/**/*.vim
< The result is that all directories in the 'runtimepath' option will be
@ -503,26 +504,26 @@ accordingly. Vim proceeds in this order:
if packages have been found, but that should not add a directory
ending in "after".
7. Set 'shellpipe' and 'shellredir'
8. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
This means that Vim will figure out the values of 'shellpipe' and
'shellredir' for you, unless you have set them yourself.
8. Set 'updatecount' to zero, if "-n" command argument used
9. Set 'updatecount' to zero, if "-n" command argument used
9. Set binary options
10. Set binary options
If the "-b" flag was given to Vim, the options for binary editing will
be set now. See |-b|.
10. Read the ShaDa file
11. Read the ShaDa file
See |shada-file|.
11. Read the quickfix file
12. Read the quickfix file
If the "-q" flag was given to Vim, the quickfix file is read. If this
fails, Vim exits.
12. Open all windows
13. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
When the |-p| flag was given, tab pages will be created (but not
@ -531,7 +532,7 @@ accordingly. Vim proceeds in this order:
If the "-q" flag was given to Vim, the first error is jumped to.
Buffers for all windows will be loaded.
13. Execute startup commands
14. Execute startup commands
If a "-t" flag was given to Vim, the tag is jumped to.
The commands given with the |-c| and |+cmd| arguments are executed.
If the 'insertmode' option is set, Insert mode is entered.
@ -540,29 +541,6 @@ accordingly. Vim proceeds in this order:
The |VimEnter| autocommands are executed.
Some hints on using initializations ~
Standard setup:
Create a vimrc file to set the default settings and mappings for all your edit
sessions. Put it in a place so that it will be found by 3b:
~/.config/nvim/init.vim (Unix)
~/AppData/Local/nvim/init.vim (Win32)
Local setup:
Put all commands that you need for editing a specific directory only into a
vimrc file and place it in that directory under the name ".nvimrc" ("_nvimrc"
for Windows). NOTE: To make Vim look for these special files you
have to turn on the option 'exrc'. See |trojan-horse| too.
System setup:
This only applies if you are managing a Unix system with several users and
want to set the defaults for all users. Create a vimrc file with commands
for default settings and mappings and put it in the place that is given with
the ":version" command. NOTE: System vimrc file needs specific compilation
options (one needs to define SYS_VIMRC_FILE macros). If :version command does
not show anything like this, consider contacting the nvim package maintainer.
Saving the current state of Vim to a file ~
Whenever you have changed values of options or when you have created a
@ -570,20 +548,6 @@ mapping, then you may want to save them in a vimrc file for later use. See
|save-settings| about saving the current state of settings to a file.
Avoiding setup problems for Vi users ~
Vi uses the variable EXINIT and the file "~/.exrc". So if you do not want to
interfere with Vi, then use the variable VIMINIT and the file init.vim
instead.
MS-DOS line separators: ~
On Windows systems Vim assumes that all the vimrc files have <CR> <NL> pairs
as line separators. This will give problems if you have a file with only
<NL>s and have a line like ":map xx yy^M". The trailing ^M will be ignored.
Avoiding trojan horses ~
*trojan-horse*
While reading the "vimrc" or the "exrc" file in the current directory, some
@ -606,7 +570,7 @@ it possible for another user to create a nasty vimrc and make you the owner.
Be careful!
When using tag search commands, executing the search command (the last
part of the line in the tags file) is always done in secure mode. This works
just like executing a command from a vimrc/exrc in the current directory.
just like executing a command from a vimrc in the current directory.
If Vim startup is slow ~
@ -620,27 +584,29 @@ moment (use the Vim argument "-i NONE", |-i|). Try reducing the number of
lines stored in a register with ":set shada='20,<50,s10". |shada-file|.
Intro message ~
*:intro*
When Vim starts without a file name, an introductory message is displayed (for
those who don't know what Vim is). It is removed as soon as the display is
redrawn in any way. To see the message again, use the ":intro" command (if
there is not enough room, you will see only part of it).
To avoid the intro message on startup, add the 'I' flag to 'shortmess'.
Troubleshooting broken configurations ~
*bisect*
The extreme flexibility of editors like Vim and Emacs means that any plugin or
setting can affect the entire editor in ways that are not initially obvious.
*info-message*
The |--help| and |--version| arguments cause Nvim to print a message and then
exit. Normally the message is sent to stdout, thus can be redirected to a
file with: >
To find the cause of a problem in your config, you must "bisect" it:
1. Remove or disable half of your `init.vim`.
2. Restart Nvim.
3. If the problem still occurs, goto 1.
4. If the problem is gone, restore half of the removed lines.
5. Continue narrowing your config in this way, until you find the setting or
plugin causing the issue.
nvim --help >file
From inside Nvim: >
:read !nvim --help
Intro message ~
*:intro*
When Vim starts without a file name, an introductory message is displayed. It
is removed as soon as the display is redrawn. To see the message again, use
the ":intro" command. To avoid the intro message on startup, add the "I" flag
to 'shortmess'.
==============================================================================
3. $VIM and $VIMRUNTIME
$VIM and $VIMRUNTIME
*$VIM*
The environment variable "$VIM" is used to locate various user files for Nvim,
such as the user startup script |init.vim|. This depends on the system, see
@ -683,9 +649,9 @@ greps in the help files) you might be able to use this: >
VIMRUNTIME="$(nvim --clean --headless --cmd 'echo $VIMRUNTIME|q')"
==============================================================================
4. Suspending *suspend*
Suspending *suspend*
*iconize* *iconise* *CTRL-Z* *v_CTRL-Z*
*CTRL-Z* *v_CTRL-Z*
CTRL-Z Suspend Nvim, like ":stop".
Works in Normal and in Visual mode. In Insert and
Command-line mode, the CTRL-Z is inserted as a normal
@ -706,7 +672,7 @@ CTRL-Z Suspend Nvim, like ":stop".
In the GUI, suspending is implementation-defined.
==============================================================================
5. Exiting *exiting*
Exiting *exiting*
There are several ways to exit Vim:
- Close the last window with `:quit`. Only when there are no changes.
@ -719,7 +685,7 @@ When using `:cquit` or when there was an error message Vim exits with exit
code 1. Errors can be avoided by using `:silent!` or with `:catch`.
==============================================================================
6. Saving settings *save-settings*
Saving settings *save-settings*
Mostly you will edit your vimrc files manually. This gives you the greatest
flexibility. There are a few commands to generate a vimrc file automatically.
@ -776,7 +742,7 @@ these steps:
You need to escape special characters, esp. spaces.
==============================================================================
7. Views and Sessions *views-sessions*
Views and Sessions *views-sessions*
This is introduced in sections |21.4| and |21.5| of the user manual.
@ -920,7 +886,7 @@ To automatically save and restore views for *.c files: >
au BufWinEnter *.c silent! loadview
==============================================================================
8. The ShaDa file *shada* *shada-file*
Shada ("shared data") file *shada* *shada-file*
If you exit Vim and later start it again, you would normally lose a lot of
information. The ShaDa file can be used to remember that information, which
@ -1358,7 +1324,7 @@ file when reading and include:
complete MessagePack object.
==============================================================================
9. Standard Paths *standard-path*
Standard Paths *standard-path*
Nvim stores configuration and data in standard locations. Plugins are strongly
encouraged to follow this pattern also. Use |stdpath()| to get the paths.
@ -1389,4 +1355,5 @@ debugging, plugins and RPC clients. >
Usually the file is ~/.local/share/nvim/log unless that path is inaccessible
or if $NVIM_LOG_FILE was set before |startup|.
vim:noet:tw=78:ts=8:ft=help:norl:

+ 1
- 2
runtime/doc/ui.txt View File

@ -183,7 +183,6 @@ the editor.
'ambiwidth'
'emoji'
'guifont'
'guifontset'
'guifontwide'
'linespace'
'pumblend'
@ -719,7 +718,7 @@ events, which the UI must handle.
kind
Name indicating the message kind:
"" (empty) Unknown, report a |feature-request|
"" (empty) Unknown (consider a feature-request: |bugs|)
"confirm" |confirm()| or |:confirm| dialog
"confirm_sub" |:substitute| confirm dialog |:s_c|
"emsg" Error (|errors|, internal error, |:throw|, …)

+ 1
- 1
runtime/doc/usr_02.txt View File

@ -652,7 +652,7 @@ Summary: *help-summary* >
22) Autocommand events can be found by their name: >
:help BufWinLeave
< To see all possible events: >
:help autocommand-events
:help events
23) Command-line switches always start with "-". So for the help of the -f
command switch of Vim use: >

+ 10
- 8
runtime/doc/vim_diff.txt View File

@ -13,7 +13,7 @@ the differences.
Type |gO| to see the table of contents.
==============================================================================
1. Configuration *nvim-configuration*
1. Configuration *nvim-config*
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for configuration.
- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files.
@ -66,8 +66,8 @@ the differences.
- 'wildmenu' is enabled
- 'wildoptions' defaults to "pum,tagfile"
- The |man.vim| plugin is enabled, to provide the |:Man| command.
- The |matchit| plugin is enabled. To disable it in your config: >
- |man.vim| plugin is enabled, so |:Man| is available by default.
- |matchit| plugin is enabled. To disable it in your config: >
:let loaded_matchit = 1
==============================================================================
@ -173,6 +173,7 @@ Functions:
|msgpackdump()|, |msgpackparse()| provide msgpack de/serialization
|stdpath()|
|system()|, |systemlist()| can run {cmd} directly (without 'shell')
|tabpagenr()| "#" argument
Highlight groups:
|highlight-blend| controls blend level for a highlight group
@ -187,18 +188,18 @@ Highlight groups:
|hl-TermCursorNC|
|hl-Whitespace| highlights 'listchars' whitespace
Input:
Input/Mappings:
|<Cmd>| pseudokey
ALT (|META|) chords always work (even in the |TUI|). Map |<M-| with any key:
<M-1>, <M-BS>, <M-Del>, <M-Ins>, <M-/>, <M-\>, <M-Space>, <M-Enter>, etc.
Case-sensitive: <M-a> and <M-A> are two different keycodes.
ALT in insert-mode behaves like <Esc> if not mapped. |i_ALT|
Mappings:
|<Cmd>| pseudokey
Normal commands:
"Outline": Type |gO| in |:Man| and |:help| pages to see a document outline.
|g<Tab>| goes to the last-accessed tabpage.
|gO| shows a filetype-defined "outline" of the current buffer.
Options:
'cpoptions' flags: |cpo-_|
@ -472,6 +473,7 @@ Options:
'encoding' ("utf-8" is always used)
'esckeys'
'guioptions' "t" flag was removed
*'guifontset'* *'gfs'* (Use 'guifont' instead.)
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
'highlight' (Names of builtin |highlight-groups| cannot be changed.)
*'imactivatefunc'* *'imaf'*

+ 1
- 1
runtime/lua/vim/lsp.lua View File

@ -922,7 +922,7 @@ end
--- To stop all clients:
---
--- <pre>
--- vim.lsp.stop_client(lsp.get_active_clients())
--- vim.lsp.stop_client(vim.lsp.get_active_clients())
--- </pre>
---
--- By default asks the server to shutdown, unless stop was requested

+ 8
- 10
runtime/lua/vim/shared.lua View File

@ -190,10 +190,10 @@ function vim.tbl_contains(t, value)
return false
end
-- Returns true if the table is empty, and contains no indexed or keyed values.
--
--@see From https://github.com/premake/premake-core/blob/master/src/base/table.lua
--