diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/buffer.c | 9 | ||||
-rw-r--r-- | src/nvim/api/vim.c | 2 | ||||
-rw-r--r-- | src/nvim/options.lua | 8 | ||||
-rw-r--r-- | src/nvim/vvars.lua | 58 |
4 files changed, 41 insertions, 36 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 1cd9d2df76..f8ebf4b838 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -238,6 +238,8 @@ Boolean nvim_buf_detach(uint64_t channel_id, Buffer buffer, Error *err) /// Out-of-bounds indices are clamped to the nearest valid value, unless /// `strict_indexing` is set. /// +/// @see |nvim_buf_get_text()| +/// /// @param channel_id /// @param buffer Buffer id, or 0 for current buffer /// @param start First line index @@ -294,7 +296,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, /// /// Indexing is zero-based, end-exclusive. Negative indices are interpreted /// as length+1+index: -1 refers to the index past the end. So to change -/// or delete the last element use start=-2 and end=-1. +/// or delete the last line use start=-2 and end=-1. /// /// To insert lines at a given index, set `start` and `end` to the same index. /// To delete a range of lines, set `replacement` to an empty array. @@ -685,10 +687,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In }); } -/// Gets a range from the buffer. -/// -/// This differs from |nvim_buf_get_lines()| in that it allows retrieving only -/// portions of a line. +/// Gets a range from the buffer (may be partial lines, unlike |nvim_buf_get_lines()|). /// /// Indexing is zero-based. Row indices are end-inclusive, and column indices /// are end-exclusive. diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 96cc8b68ae..70f5ebacb7 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -872,7 +872,7 @@ Window nvim_get_current_win(void) return curwin->handle; } -/// Sets the current window. Also changes tabpage, if necessary. +/// Sets the current window (and tabpage, implicitly). /// /// @param window |window-ID| to focus /// @param[out] err Error details, if any diff --git a/src/nvim/options.lua b/src/nvim/options.lua index e9f8051ed3..d150303033 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -2663,9 +2663,10 @@ local options = { abbreviation = 'ex', defaults = false, desc = [=[ - Automatically execute .nvim.lua, .nvimrc, and .exrc files in the - current directory, if the file is in the |trust| list. Use |:trust| to - manage trusted files. See also |vim.secure.read()|. + Enables project-local configuration. Nvim will execute any .nvim.lua, + .nvimrc, or .exrc file found in the |current-directory|, if the file is + in the |trust| list. Use |:trust| to manage trusted files. See also + |vim.secure.read()|. Compare 'exrc' to |editorconfig|: - 'exrc' can execute any code; editorconfig only specifies settings. @@ -2678,6 +2679,7 @@ local options = { scope = { 'global' }, secure = true, short_desc = N_('read .nvimrc and .exrc in the current directory'), + tags = { 'project-config', 'workspace-config' }, type = 'boolean', varname = 'p_exrc', }, diff --git a/src/nvim/vvars.lua b/src/nvim/vvars.lua index 52af56e607..cb84df015c 100644 --- a/src/nvim/vvars.lua +++ b/src/nvim/vvars.lua @@ -175,45 +175,43 @@ M.vars = { an aborting condition (e.g. |c_Esc| or |c_CTRL-C| for |CmdlineLeave|). chan |channel-id| - info Dict of arbitrary event data. + changed_window Is |v:true| if the event fired while + changing window (or tab) on |DirChanged|. cmdlevel Level of cmdline. cmdtype Type of cmdline, |cmdline-char|. + col Column count of popup menu on |CompleteChanged|, + relative to screen. + complete_type See |complete_info_mode| + complete_word The selected word, or empty if completion + was abandoned/discarded. + completed_item Current selected item on |CompleteChanged|, + or `{}` if no item selected. cwd Current working directory. + height Height of popup menu on |CompleteChanged| inclusive Motion is |inclusive|, else exclusive. - scope Event-specific scope name. + info Dict of arbitrary event data. operator Current |operator|. Also set for Ex commands (unlike |v:operator|). For example if |TextYankPost| is triggered by the |:yank| Ex command then `v:event.operator` is "y". + reason |CompleteDone| reason. regcontents Text stored in the register as a |readfile()|-style list of lines. - regname Requested register (e.g "x" for "xyy) - or the empty string for an unnamed - operation. + regname Requested register (e.g "x" for "xyy), or + empty string for an unnamed operation. regtype Type of register as returned by |getregtype()|. - visual Selection is visual (as opposed to, - e.g., via motion). - completed_item Current selected complete item on - |CompleteChanged|, Is `{}` when no complete - item selected. - height Height of popup menu on |CompleteChanged| - width Width of popup menu on |CompleteChanged| row Row count of popup menu on |CompleteChanged|, relative to screen. - col Col count of popup menu on |CompleteChanged|, - relative to screen. + scope Event-specific scope name. + scrollbar |v:true| if popup menu has a scrollbar, or + |v:false| if not. size Total number of completion items on |CompleteChanged|. - scrollbar Is |v:true| if popup menu have scrollbar, or - |v:false| if not. - changed_window Is |v:true| if the event fired while - changing window (or tab) on |DirChanged|. status Job status or exit code, -1 means "unknown". |TermClose| - reason Reason for completion being done. |CompleteDone| - complete_word The word that was selected, empty if abandoned complete. - complete_type See |complete_info_mode| + visual Selection is visual (as opposed to e.g. a motion range). + width Width of popup menu on |CompleteChanged| windows List of window IDs that changed on |WinResized| ]=], }, @@ -678,13 +676,19 @@ M.vars = { *$NVIM* $NVIM is set by |terminal| and |jobstart()|, and is thus a hint that the current environment is a subprocess of Nvim. - Example: >vim - if $NVIM - echo nvim_get_chan_info(v:parent) - endif - < - Note the contents of $NVIM may change in the future. + Example: a child Nvim process can detect and make requests to + its parent Nvim: >lua + + if vim.env.NVIM then + local ok, chan = pcall(vim.fn.sockconnect, 'pipe', vim.env.NVIM, {rpc=true}) + if ok and chan then + local client = vim.api.nvim_get_chan_info(chan).client + local rv = vim.rpcrequest(chan, 'nvim_exec_lua', [[return ... + 1]], { 41 }) + vim.print(('got "%s" from parent Nvim'):format(rv)) + end + end + < ]=], }, shell_error = { |