mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	docs: autocmds, misc
This commit is contained in:
		@@ -209,7 +209,7 @@ any of these approaches:
 | 
				
			|||||||
     nvim --api-info | python -c 'import msgpack, sys, yaml; yaml.dump(msgpack.unpackb(sys.stdin.buffer.read()), sys.stdout)'
 | 
					     nvim --api-info | python -c 'import msgpack, sys, yaml; yaml.dump(msgpack.unpackb(sys.stdin.buffer.read()), sys.stdout)'
 | 
				
			||||||
<
 | 
					<
 | 
				
			||||||
  3. Use the |api_info()| Vimscript function. >vim
 | 
					  3. Use the |api_info()| Vimscript function. >vim
 | 
				
			||||||
     :lua print(vim.inspect(vim.fn.api_info()))
 | 
					     :lua vim.print(vim.fn.api_info())
 | 
				
			||||||
<     Example using |filter()| to exclude non-deprecated API functions: >vim
 | 
					<     Example using |filter()| to exclude non-deprecated API functions: >vim
 | 
				
			||||||
     :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val.name')
 | 
					     :new|put =map(filter(api_info().functions, '!has_key(v:val,''deprecated_since'')'), 'v:val.name')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2030,7 +2030,7 @@ whether a buffer is loaded.
 | 
				
			|||||||
nvim_buf_attach({buffer}, {send_buffer}, {opts})           *nvim_buf_attach()*
 | 
					nvim_buf_attach({buffer}, {send_buffer}, {opts})           *nvim_buf_attach()*
 | 
				
			||||||
    Activates buffer-update events on a channel, or as Lua callbacks.
 | 
					    Activates buffer-update events on a channel, or as Lua callbacks.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Example (Lua): capture buffer updates in a global `events` variable (use "print(vim.inspect(events))" to see its contents): >lua
 | 
					    Example (Lua): capture buffer updates in a global `events` variable (use "vim.print(events)" to see its contents): >lua
 | 
				
			||||||
      events = {}
 | 
					      events = {}
 | 
				
			||||||
      vim.api.nvim_buf_attach(0, false, {
 | 
					      vim.api.nvim_buf_attach(0, false, {
 | 
				
			||||||
        on_lines=function(...) table.insert(events, {...}) end})
 | 
					        on_lines=function(...) table.insert(events, {...}) end})
 | 
				
			||||||
@@ -2554,7 +2554,7 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
 | 
				
			|||||||
      local ms  = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
 | 
					      local ms  = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
 | 
				
			||||||
      -- Get all marks in this buffer + namespace.
 | 
					      -- Get all marks in this buffer + namespace.
 | 
				
			||||||
      local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
 | 
					      local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
 | 
				
			||||||
      print(vim.inspect(ms))
 | 
					      vim.print(ms)
 | 
				
			||||||
<
 | 
					<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Parameters: ~
 | 
					    Parameters: ~
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -212,28 +212,27 @@ events.
 | 
				
			|||||||
Nvim recognizes the following events.  Names are case-insensitive.
 | 
					Nvim recognizes the following events.  Names are case-insensitive.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							*BufAdd*
 | 
												*BufAdd*
 | 
				
			||||||
BufAdd				Just after creating a new buffer which is
 | 
					BufAdd				After adding a new buffer or existing unlisted
 | 
				
			||||||
				added to the buffer list, or adding a buffer
 | 
									buffer to the buffer list (except during
 | 
				
			||||||
				to the buffer list, a buffer in the buffer
 | 
									startup, see |VimEnter|), or renaming a listed
 | 
				
			||||||
				list was renamed.
 | 
									buffer.
 | 
				
			||||||
				Not triggered for the initial buffers created
 | 
					 | 
				
			||||||
				during startup.
 | 
					 | 
				
			||||||
				Before |BufEnter|.
 | 
									Before |BufEnter|.
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer being created "<afile>".
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
							*BufDelete*
 | 
												*BufDelete*
 | 
				
			||||||
BufDelete			Before deleting a buffer from the buffer list.
 | 
					BufDelete			Before deleting a buffer from the buffer list.
 | 
				
			||||||
				The BufUnload may be called first (if the
 | 
									The BufUnload may be called first (if the
 | 
				
			||||||
				buffer was loaded).
 | 
									buffer was loaded).
 | 
				
			||||||
				Also used just before a buffer in the buffer
 | 
									Also used just before a buffer in the buffer
 | 
				
			||||||
				list is renamed.
 | 
									list is renamed.
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer being deleted "<afile>" and "<abuf>".
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
				Do not change to another buffer.
 | 
									Do not change to another buffer.
 | 
				
			||||||
							*BufEnter*
 | 
												*BufEnter*
 | 
				
			||||||
BufEnter			After entering a buffer.  Useful for setting
 | 
					BufEnter			After entering (visiting, switching-to) a new
 | 
				
			||||||
				options for a file type.  Also executed when
 | 
									or existing buffer. Useful for setting
 | 
				
			||||||
				starting to edit a buffer.
 | 
									filetype options.  Compare |BufNew| which
 | 
				
			||||||
 | 
									does not trigger for existing buffers.
 | 
				
			||||||
				After |BufAdd|.
 | 
									After |BufAdd|.
 | 
				
			||||||
				After |BufReadPost|.
 | 
									After |BufReadPost|.
 | 
				
			||||||
							*BufFilePost*
 | 
												*BufFilePost*
 | 
				
			||||||
@@ -248,8 +247,8 @@ BufHidden			Before a buffer becomes hidden: when there are
 | 
				
			|||||||
				the buffer is not unloaded or deleted.
 | 
									the buffer is not unloaded or deleted.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				Not used for ":qa" or ":q" when exiting Vim.
 | 
									Not used for ":qa" or ":q" when exiting Vim.
 | 
				
			||||||
				NOTE: current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer being unloaded "<afile>".
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
							*BufLeave*
 | 
												*BufLeave*
 | 
				
			||||||
BufLeave			Before leaving to another buffer.  Also when
 | 
					BufLeave			Before leaving to another buffer.  Also when
 | 
				
			||||||
				leaving or closing the current window and the
 | 
									leaving or closing the current window and the
 | 
				
			||||||
@@ -260,12 +259,14 @@ BufLeave			Before leaving to another buffer.  Also when
 | 
				
			|||||||
BufModifiedSet			After the `'modified'` value of a buffer has
 | 
					BufModifiedSet			After the `'modified'` value of a buffer has
 | 
				
			||||||
				been changed.
 | 
									been changed.
 | 
				
			||||||
							*BufNew*
 | 
												*BufNew*
 | 
				
			||||||
BufNew				Just after creating a new buffer.  Also used
 | 
					BufNew				After creating a new buffer (except during
 | 
				
			||||||
				just after a buffer has been renamed.  When
 | 
									startup, see |VimEnter|) or renaming an
 | 
				
			||||||
				the buffer is added to the buffer list BufAdd
 | 
									existing buffer. Unlike |BufEnter|, visiting
 | 
				
			||||||
				will be triggered too.
 | 
									(switching to) an existing buffer will not
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									trigger this again.
 | 
				
			||||||
				the buffer being created "<afile>".
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
 | 
									See also |BufAdd|, |BufNewFile|.
 | 
				
			||||||
							*BufNewFile*
 | 
												*BufNewFile*
 | 
				
			||||||
BufNewFile			When starting to edit a file that doesn't
 | 
					BufNewFile			When starting to edit a file that doesn't
 | 
				
			||||||
				exist.  Can be used to read in a skeleton
 | 
									exist.  Can be used to read in a skeleton
 | 
				
			||||||
@@ -298,8 +299,8 @@ BufUnload			Before unloading a buffer, when the text in
 | 
				
			|||||||
				Before BufDelete.
 | 
									Before BufDelete.
 | 
				
			||||||
				Triggers for all loaded buffers when Vim is
 | 
									Triggers for all loaded buffers when Vim is
 | 
				
			||||||
				going to exit.
 | 
									going to exit.
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer being unloaded "<afile>".
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
				Do not switch buffers or windows!
 | 
									Do not switch buffers or windows!
 | 
				
			||||||
				Not triggered when exiting and v:dying is 2 or
 | 
									Not triggered when exiting and v:dying is 2 or
 | 
				
			||||||
				more.
 | 
									more.
 | 
				
			||||||
@@ -319,8 +320,8 @@ BufWinLeave			Before a buffer is removed from a window.
 | 
				
			|||||||
				Not when it's still visible in another window.
 | 
									Not when it's still visible in another window.
 | 
				
			||||||
				Also triggered when exiting.
 | 
									Also triggered when exiting.
 | 
				
			||||||
				Before BufUnload, BufHidden.
 | 
									Before BufUnload, BufHidden.
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer being unloaded "<afile>".
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
				Not triggered when exiting and v:dying is 2 or
 | 
									Not triggered when exiting and v:dying is 2 or
 | 
				
			||||||
				more.
 | 
									more.
 | 
				
			||||||
							*BufWipeout*
 | 
												*BufWipeout*
 | 
				
			||||||
@@ -330,8 +331,8 @@ BufWipeout			Before completely deleting a buffer.  The
 | 
				
			|||||||
				buffer list).  Also used just before a buffer
 | 
									buffer list).  Also used just before a buffer
 | 
				
			||||||
				is renamed (also when it's not in the buffer
 | 
									is renamed (also when it's not in the buffer
 | 
				
			||||||
				list).
 | 
									list).
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer being deleted "<afile>".
 | 
									buffer "<afile>", "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
				Do not change to another buffer.
 | 
									Do not change to another buffer.
 | 
				
			||||||
						*BufWrite* *BufWritePre*
 | 
											*BufWrite* *BufWritePre*
 | 
				
			||||||
BufWrite or BufWritePre		Before writing the whole buffer to a file.
 | 
					BufWrite or BufWritePre		Before writing the whole buffer to a file.
 | 
				
			||||||
@@ -597,8 +598,8 @@ FileChangedShell		When Vim notices that the modification time of
 | 
				
			|||||||
				prompt is not given.
 | 
									prompt is not given.
 | 
				
			||||||
				|v:fcs_reason| indicates what happened. Set
 | 
									|v:fcs_reason| indicates what happened. Set
 | 
				
			||||||
				|v:fcs_choice| to control what happens next.
 | 
									|v:fcs_choice| to control what happens next.
 | 
				
			||||||
				NOTE: Current buffer "%" may be different from
 | 
									NOTE: Current buffer "%" is not the target
 | 
				
			||||||
				the buffer that was changed "<afile>".
 | 
									buffer "<afile>" and "<abuf>". |<buffer=abuf>|
 | 
				
			||||||
							*E246* *E811*
 | 
												*E246* *E811*
 | 
				
			||||||
				Cannot switch, jump to or delete buffers.
 | 
									Cannot switch, jump to or delete buffers.
 | 
				
			||||||
				Non-recursive (event cannot trigger itself).
 | 
									Non-recursive (event cannot trigger itself).
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -656,7 +656,7 @@ api_info()						*api_info()*
 | 
				
			|||||||
		Returns Dictionary of |api-metadata|.
 | 
							Returns Dictionary of |api-metadata|.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		View it in a nice human-readable format: >
 | 
							View it in a nice human-readable format: >
 | 
				
			||||||
		       :lua print(vim.inspect(vim.fn.api_info()))
 | 
							       :lua vim.print(vim.fn.api_info())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
append({lnum}, {text})					*append()*
 | 
					append({lnum}, {text})					*append()*
 | 
				
			||||||
		When {text} is a |List|: Append each item of the |List| as a
 | 
							When {text} is a |List|: Append each item of the |List| as a
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -154,16 +154,17 @@ The `vim.lsp.buf_…` functions perform operations for all LSP clients attached
 | 
				
			|||||||
to the given buffer. |lsp-buf|
 | 
					to the given buffer. |lsp-buf|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LSP request/response handlers are implemented as Lua functions (see
 | 
					LSP request/response handlers are implemented as Lua functions (see
 | 
				
			||||||
|lsp-handler|). The |vim.lsp.handlers| table defines default handlers used
 | 
					|lsp-handler|).
 | 
				
			||||||
when creating a new client. Keys are LSP method names: >vim
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    :lua print(vim.inspect(vim.tbl_keys(vim.lsp.handlers)))
 | 
					 | 
				
			||||||
<
 | 
					 | 
				
			||||||
                                                                  *lsp-method*
 | 
					                                                                  *lsp-method*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Methods are the names of requests and notifications as defined by the LSP
 | 
					Requests and notifications defined by the LSP specification are referred to as
 | 
				
			||||||
specification. These LSP requests/notifications are defined by default in the
 | 
					"LSP methods". The Nvim LSP client provides default handlers in the global
 | 
				
			||||||
Nvim LSP client (but depends on server support):
 | 
					|vim.lsp.handlers| table, you can list them with this command: >vim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :lua vim.print(vim.tbl_keys(vim.lsp.handlers))
 | 
				
			||||||
 | 
					<
 | 
				
			||||||
 | 
					They are also listed below. Note that handlers depend on server support: they
 | 
				
			||||||
 | 
					won't run if your server doesn't support them.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- callHierarchy/incomingCalls
 | 
					- callHierarchy/incomingCalls
 | 
				
			||||||
- callHierarchy/outgoingCalls
 | 
					- callHierarchy/outgoingCalls
 | 
				
			||||||
@@ -190,8 +191,11 @@ Nvim LSP client (but depends on server support):
 | 
				
			|||||||
- window/showDocument
 | 
					- window/showDocument
 | 
				
			||||||
- window/showMessageRequest
 | 
					- window/showMessageRequest
 | 
				
			||||||
- workspace/applyEdit
 | 
					- workspace/applyEdit
 | 
				
			||||||
 | 
					- workspace/configuration
 | 
				
			||||||
 | 
					- workspace/executeCommand
 | 
				
			||||||
- workspace/inlayHint/refresh
 | 
					- workspace/inlayHint/refresh
 | 
				
			||||||
- workspace/symbol
 | 
					- workspace/symbol
 | 
				
			||||||
 | 
					- workspace/workspaceFolders
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                                                 *lsp-handler*
 | 
					                                                                 *lsp-handler*
 | 
				
			||||||
LSP handlers are functions that handle |lsp-response|s to requests made by Nvim
 | 
					LSP handlers are functions that handle |lsp-response|s to requests made by Nvim
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -218,7 +218,7 @@ Vimscript are automatically converted:
 | 
				
			|||||||
    print(vim.fn.printf('Hello from %s', 'Lua'))
 | 
					    print(vim.fn.printf('Hello from %s', 'Lua'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    local reversed_list = vim.fn.reverse({ 'a', 'b', 'c' })
 | 
					    local reversed_list = vim.fn.reverse({ 'a', 'b', 'c' })
 | 
				
			||||||
    print(vim.inspect(reversed_list)) -- { "c", "b", "a" }
 | 
					    vim.print(reversed_list) -- { "c", "b", "a" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    local function print_stdout(chan_id, data, name)
 | 
					    local function print_stdout(chan_id, data, name)
 | 
				
			||||||
      print(data[1])
 | 
					      print(data[1])
 | 
				
			||||||
@@ -261,7 +261,7 @@ Data types are converted automatically. For example:
 | 
				
			|||||||
      key2 = 300
 | 
					      key2 = 300
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print(vim.inspect(vim.g.some_global_variable))
 | 
					    vim.print(vim.g.some_global_variable)
 | 
				
			||||||
    --> { key1 = "value", key2 = 300 }
 | 
					    --> { key1 = "value", key2 = 300 }
 | 
				
			||||||
<
 | 
					<
 | 
				
			||||||
You can target specific buffers (via number), windows (via |window-ID|), or
 | 
					You can target specific buffers (via number), windows (via |window-ID|), or
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ INTRODUCTION                                                       *lua-intro*
 | 
				
			|||||||
The Lua 5.1 script engine is builtin and always available. Try this command to
 | 
					The Lua 5.1 script engine is builtin and always available. Try this command to
 | 
				
			||||||
get an idea of what lurks beneath: >vim
 | 
					get an idea of what lurks beneath: >vim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :lua print(vim.inspect(package.loaded))
 | 
					    :lua vim.print(package.loaded)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Nvim includes a "standard library" |lua-stdlib| for Lua.  It complements the
 | 
					Nvim includes a "standard library" |lua-stdlib| for Lua.  It complements the
 | 
				
			||||||
"editor stdlib" (|builtin-functions| and |Ex-commands|) and the |API|, all of
 | 
					"editor stdlib" (|builtin-functions| and |Ex-commands|) and the |API|, all of
 | 
				
			||||||
@@ -423,7 +423,7 @@ is unnecessary.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
You can peek at the module properties: >vim
 | 
					You can peek at the module properties: >vim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :lua print(vim.inspect(vim))
 | 
					    :lua vim.print(vim)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Result is something like this: >
 | 
					Result is something like this: >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1414,6 +1414,7 @@ inspect({object}, {options})                                   *vim.inspect()*
 | 
				
			|||||||
    Gets a human-readable representation of the given object.
 | 
					    Gets a human-readable representation of the given object.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    See also: ~
 | 
					    See also: ~
 | 
				
			||||||
 | 
					      • |vim.print()|
 | 
				
			||||||
      • https://github.com/kikito/inspect.lua
 | 
					      • https://github.com/kikito/inspect.lua
 | 
				
			||||||
      • https://github.com/mpeterv/vinspect
 | 
					      • https://github.com/mpeterv/vinspect
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1538,6 +1539,7 @@ print({...})                                                     *vim.print()*
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    See also: ~
 | 
					    See also: ~
 | 
				
			||||||
      • |vim.inspect()|
 | 
					      • |vim.inspect()|
 | 
				
			||||||
 | 
					      • |:=|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive})         *vim.region()*
 | 
					region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive})         *vim.region()*
 | 
				
			||||||
    Get a table of lines with start, end columns for a region marked by two
 | 
					    Get a table of lines with start, end columns for a region marked by two
 | 
				
			||||||
@@ -3172,7 +3174,7 @@ Iter:find({self}, {f})                                           *Iter:find()*
 | 
				
			|||||||
        any
 | 
					        any
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Iter:fold({self}, {init}, {f})                                   *Iter:fold()*
 | 
					Iter:fold({self}, {init}, {f})                                   *Iter:fold()*
 | 
				
			||||||
    Fold an iterator or table into a single value.
 | 
					    Fold ("reduce") an iterator or table into a single value.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Examples: >lua
 | 
					    Examples: >lua
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,8 +171,8 @@ g8			Print the hex values of the bytes used in the
 | 
				
			|||||||
			Like ":z" or ":z!", but number the lines.
 | 
								Like ":z" or ":z!", but number the lines.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							*:=*
 | 
												*:=*
 | 
				
			||||||
:=			Without arg: Print the last line number.
 | 
					:= [args]		Without [args]: prints the last line number.
 | 
				
			||||||
			with args: equivalent to `:lua ={expr}`. see |:lua|
 | 
								With [args]: equivalent to `:lua ={expr}`. see |:lua|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
:{range}=		Prints the last line number in {range}.  For example,
 | 
					:{range}=		Prints the last line number in {range}.  For example,
 | 
				
			||||||
			this prints the current line number: >
 | 
								this prints the current line number: >
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -459,8 +459,9 @@ Lua interface (|lua.txt|):
 | 
				
			|||||||
- `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim
 | 
					- `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim
 | 
				
			||||||
  that prints `a` and `b` on separate lines, exactly like
 | 
					  that prints `a` and `b` on separate lines, exactly like
 | 
				
			||||||
  `:lua print("a\nb")` .
 | 
					  `:lua print("a\nb")` .
 | 
				
			||||||
- `:lua error('TEST')` emits the error “E5105: Error while calling Lua chunk:
 | 
					- `:lua error('TEST')` emits the error: >
 | 
				
			||||||
  [string "<Vimscript compiled string>"]:1: TEST”, whereas Vim emits only “TEST”.
 | 
					  E5108: Error executing lua: [string "<Vimscript compiled string>"]:1: TEST
 | 
				
			||||||
 | 
					<  whereas Vim emits only "TEST".
 | 
				
			||||||
- Lua has direct access to Nvim |API| via `vim.api`.
 | 
					- Lua has direct access to Nvim |API| via `vim.api`.
 | 
				
			||||||
- Lua package.path and package.cpath are automatically updated according to
 | 
					- Lua package.path and package.cpath are automatically updated according to
 | 
				
			||||||
  'runtimepath': |lua-require|.
 | 
					  'runtimepath': |lua-require|.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -184,6 +184,7 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
--- Gets a human-readable representation of the given object.
 | 
					--- Gets a human-readable representation of the given object.
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					---@see |vim.print()|
 | 
				
			||||||
---@see https://github.com/kikito/inspect.lua
 | 
					---@see https://github.com/kikito/inspect.lua
 | 
				
			||||||
---@see https://github.com/mpeterv/vinspect
 | 
					---@see https://github.com/mpeterv/vinspect
 | 
				
			||||||
local function inspect(object, options) -- luacheck: no unused
 | 
					local function inspect(object, options) -- luacheck: no unused
 | 
				
			||||||
@@ -870,6 +871,7 @@ end
 | 
				
			|||||||
--- </pre>
 | 
					--- </pre>
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
--- @see |vim.inspect()|
 | 
					--- @see |vim.inspect()|
 | 
				
			||||||
 | 
					--- @see |:=|
 | 
				
			||||||
--- @return any # given arguments.
 | 
					--- @return any # given arguments.
 | 
				
			||||||
function vim.print(...)
 | 
					function vim.print(...)
 | 
				
			||||||
  if vim.in_fast_event() then
 | 
					  if vim.in_fast_event() then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2457,7 +2457,7 @@ end
 | 
				
			|||||||
---                   buffer number as arguments. Example:
 | 
					---                   buffer number as arguments. Example:
 | 
				
			||||||
---             <pre>lua
 | 
					---             <pre>lua
 | 
				
			||||||
---               vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr)
 | 
					---               vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr)
 | 
				
			||||||
---                 print(vim.inspect(client))
 | 
					---                 vim.print(client)
 | 
				
			||||||
---               end)
 | 
					---               end)
 | 
				
			||||||
---             </pre>
 | 
					---             </pre>
 | 
				
			||||||
---@deprecated use lsp.get_active_clients({ bufnr = bufnr }) with regular loop
 | 
					---@deprecated use lsp.get_active_clients({ bufnr = bufnr }) with regular loop
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
"""Generates Nvim :help docs from C/Lua docstrings, using Doxygen.
 | 
					"""Generates Nvim :help docs from C/Lua docstrings, using Doxygen.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Also generates *.mpack files. To inspect the *.mpack structure:
 | 
					Also generates *.mpack files. To inspect the *.mpack structure:
 | 
				
			||||||
    :new | put=v:lua.vim.inspect(v:lua.vim.mpack.unpack(readfile('runtime/doc/api.mpack','B')))
 | 
					    :new | put=v:lua.vim.inspect(v:lua.vim.mpack.decode(readfile('runtime/doc/api.mpack','B')))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Flow:
 | 
					Flow:
 | 
				
			||||||
    main
 | 
					    main
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,7 +84,7 @@ Integer nvim_buf_line_count(Buffer buffer, Error *err)
 | 
				
			|||||||
/// Activates buffer-update events on a channel, or as Lua callbacks.
 | 
					/// Activates buffer-update events on a channel, or as Lua callbacks.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Example (Lua): capture buffer updates in a global `events` variable
 | 
					/// Example (Lua): capture buffer updates in a global `events` variable
 | 
				
			||||||
/// (use "print(vim.inspect(events))" to see its contents):
 | 
					/// (use "vim.print(events)" to see its contents):
 | 
				
			||||||
/// <pre>lua
 | 
					/// <pre>lua
 | 
				
			||||||
///   events = {}
 | 
					///   events = {}
 | 
				
			||||||
///   vim.api.nvim_buf_attach(0, false, {
 | 
					///   vim.api.nvim_buf_attach(0, false, {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -320,7 +320,7 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
 | 
				
			|||||||
///   local ms  = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
 | 
					///   local ms  = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
 | 
				
			||||||
///   -- Get all marks in this buffer + namespace.
 | 
					///   -- Get all marks in this buffer + namespace.
 | 
				
			||||||
///   local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
 | 
					///   local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
 | 
				
			||||||
///   print(vim.inspect(ms))
 | 
					///   vim.print(ms)
 | 
				
			||||||
/// </pre>
 | 
					/// </pre>
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// @param buffer  Buffer handle, or 0 for current buffer
 | 
					/// @param buffer  Buffer handle, or 0 for current buffer
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user