2022-10-08 08:49:09 -07:00
|
|
|
*news.txt* Nvim
|
|
|
|
|
|
|
|
|
|
|
|
NVIM REFERENCE MANUAL
|
|
|
|
|
|
|
|
|
|
|
|
Notable changes in Nvim 0.9 from 0.8 *news*
|
|
|
|
|
|
|
|
Type |gO| to see the table of contents.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
BREAKING CHANGES *news-breaking*
|
|
|
|
|
|
|
|
The following changes may require adaptations in user config or plugins.
|
|
|
|
|
2023-01-10 07:49:39 -07:00
|
|
|
• Cscope support is now removed (see |cscope| and |nvim-removed|):
|
2022-10-08 07:48:07 -07:00
|
|
|
- Commands removed:
|
|
|
|
- `:cscope`
|
|
|
|
- `:lcscope`
|
|
|
|
- `:scscope`
|
|
|
|
- `:cstag`
|
|
|
|
- Options removed:
|
|
|
|
- `cscopepathcomp`
|
|
|
|
- `cscopeprg`
|
|
|
|
- `cscopequickfix`
|
|
|
|
- `cscoperelative`
|
|
|
|
- `cscopetag`
|
|
|
|
- `cscopetagorder`
|
|
|
|
- `cscopeverbose`
|
|
|
|
- Eval functions removed:
|
|
|
|
- `cscope_connection()`
|
|
|
|
|
2022-10-16 23:52:40 -07:00
|
|
|
Note: support for |ctags| remains with no plans to remove.
|
2022-10-08 07:48:07 -07:00
|
|
|
|
2022-10-16 23:52:40 -07:00
|
|
|
See https://github.com/neovim/neovim/pull/20545 for more information.
|
2022-10-08 07:48:07 -07:00
|
|
|
|
2023-01-10 07:49:39 -07:00
|
|
|
• `:hardcopy` is now removed (see |hardcopy| and |nvim-removed|):
|
2023-01-03 03:07:43 -07:00
|
|
|
- Commands removed:
|
|
|
|
- `:hardcopy`
|
|
|
|
- Options removed:
|
|
|
|
- `printdevice`
|
|
|
|
- `printencoding`
|
|
|
|
- `printexpr`
|
|
|
|
- `printfont`
|
|
|
|
- `printheader`
|
|
|
|
- `printmbcharset`
|
|
|
|
|
2023-03-12 19:29:11 -07:00
|
|
|
• 'paste' option is now deprecated and 'pastetoggle' is removed. |paste| works
|
|
|
|
automatically in GUI and terminal (TUI) Nvim. Just Paste It.™
|
|
|
|
|
2023-03-07 01:39:08 -07:00
|
|
|
• libiconv and intl are now required build dependencies.
|
2023-01-23 09:33:45 -07:00
|
|
|
|
2023-02-11 03:25:01 -07:00
|
|
|
• Unsaved changes are now preserved rather than discarded when |channel-stdio|
|
|
|
|
is closed.
|
|
|
|
|
2023-03-10 09:40:27 -07:00
|
|
|
• Changes to |vim.treesitter.get_node_text()|:
|
|
|
|
- It now returns `string`, as opposed to `string|string[]|nil`.
|
|
|
|
- The `concat` option has been removed as it was not consistently applied.
|
|
|
|
- Invalid ranges now cause an error instead of returning `nil`.
|
|
|
|
|
refactor!: rename vim.pretty_print => vim.print
Problem:
The function name `vim.pretty_print`:
1. is verbose, which partially defeats its purpose as sugar
2. does not draw from existing precedent or any sort of convention
(except external projects like penlight or python?), which reduces
discoverability, and degrades signaling about best practices.
Solution:
- Rename to `vim.print`.
- Change the behavior so that
1. strings are printed without quotes
2. each arg is printed on its own line
3. tables are indented with 2 instead of 4 spaces
- Example:
:lua ='a', 'b', 42, {a=3}
a
b
42
{
a = 3
}
Comparison of alternatives:
- `vim.print`:
- pro: consistent with Lua's `print()`
- pro: aligns with potential `nvim_print` API function which will
replace nvim_echo, nvim_notify, etc.
- con: behaves differently than Lua's `print()`, slightly misleading?
- `vim.echo`:
- pro: `:echo` has similar "pretty print" behavior.
- con: inconsistent with Lua idioms.
- `vim.p`:
- pro: very short, fits with `vim.o`, etc.
- con: not as discoverable as "echo"
- con: less opportunity for `local p = vim.p` because of potential shadowing.
2023-03-07 08:04:57 -07:00
|
|
|
• Renamed vim.pretty_print to vim.print. |deprecated|
|
|
|
|
|
2022-10-08 08:49:09 -07:00
|
|
|
==============================================================================
|
|
|
|
NEW FEATURES *news-features*
|
|
|
|
|
|
|
|
The following new APIs or features were added.
|
|
|
|
|
2023-03-16 17:12:33 -07:00
|
|
|
• Added |lua-version| for parsing and comparing version strings conforming to
|
|
|
|
the semver specification.
|
2023-02-19 04:33:57 -07:00
|
|
|
|
2023-02-16 05:15:02 -07:00
|
|
|
• A new environment variable named NVIM_APPNAME enables configuring the
|
|
|
|
directories where Neovim should find its configuration and state files. See
|
|
|
|
`:help $NVIM_APPNAME` .
|
|
|
|
|
feat(float): open float relative to mouse #21531
Problem:
No easy way to position a LSP hover window relative to mouse.
Solution:
Introduce another option to the `relative` key in `nvim_open_win()`.
With this PR it should be possible to override the handler and do something
similar to this https://github.com/neovim/neovim/pull/19481#issuecomment-1193248674
to have hover information displayed from the mouse.
Test case:
```lua
local util = require('vim.lsp.util')
local function make_position_param(window, offset_encoding)
window = window or 0
local buf = vim.api.nvim_win_get_buf(window)
local row, col
local mouse = vim.fn.getmousepos()
row = mouse.line
col = mouse.column
offset_encoding = offset_encoding or util._get_offset_encoding(buf)
row = row - 1
local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
if not line then
return { line = 0, character = 0 }
end
if #line < col then
return { line = 0, character = 0 }
end
col = util._str_utfindex_enc(line, col, offset_encoding)
return { line = row, character = col }
end
local make_params = function(window, offset_encoding)
window = window or 0
local buf = vim.api.nvim_win_get_buf(window)
offset_encoding = offset_encoding or util._get_offset_encoding(buf)
return {
textDocument = util.make_text_document_params(buf),
position = make_position_param(window, offset_encoding),
}
end
local hover_timer = nil
vim.o.mousemoveevent = true
vim.keymap.set({ '', 'i' }, '<MouseMove>', function()
if hover_timer then
hover_timer:close()
end
hover_timer = vim.defer_fn(function()
hover_timer = nil
local params = make_params()
vim.lsp.buf_request(
0,
'textDocument/hover',
params,
vim.lsp.with(vim.lsp.handlers.hover, {
silent = true,
focusable = false,
relative = 'mouse',
})
)
end, 500)
return '<MouseMove>'
end, { expr = true })
```
2023-01-10 03:22:41 -07:00
|
|
|
• |nvim_open_win()| now accepts a relative `mouse` option to open a floating win
|
|
|
|
relative to the mouse. Note that the mouse doesn't update frequently without
|
|
|
|
setting `vim.o.mousemoveevent = true`
|
|
|
|
|
2023-01-03 09:25:16 -07:00
|
|
|
• EditorConfig support is now builtin. This is enabled by default and happens
|
2023-01-03 11:08:58 -07:00
|
|
|
automatically. To disable it, users should add >lua
|
2023-01-03 09:25:16 -07:00
|
|
|
|
2023-01-04 15:10:19 -07:00
|
|
|
vim.g.editorconfig = false
|
2023-01-03 09:25:16 -07:00
|
|
|
<
|
|
|
|
(or the Vimscript equivalent) to their |config| file.
|
|
|
|
|
2023-02-11 02:34:20 -07:00
|
|
|
• Added support for running Lua scripts from shell using |-l|. >
|
2021-09-20 19:00:50 -07:00
|
|
|
nvim -l foo.lua --arg1 --arg2
|
|
|
|
< Also works with stdin: >
|
|
|
|
echo "print(42)" | nvim -l -
|
|
|
|
|
2022-12-31 08:16:21 -07:00
|
|
|
• Added a |vim.lsp.codelens.clear()| function to clear codelenses.
|
|
|
|
|
2022-12-14 02:46:54 -07:00
|
|
|
• |vim.inspect_pos()|, |vim.show_pos()| and |:Inspect| allow a user to get or show items
|
2023-01-03 16:38:48 -07:00
|
|
|
at a given buffer position. Currently this includes treesitter captures,
|
2022-12-14 02:46:54 -07:00
|
|
|
semantic tokens, syntax groups and extmarks.
|
|
|
|
|
2022-11-23 09:06:36 -07:00
|
|
|
• Added support for semantic token highlighting to the LSP client. This
|
|
|
|
functionality is enabled by default when a client that supports this feature
|
|
|
|
is attached to a buffer. Opt-out can be performed by deleting the
|
|
|
|
`semanticTokensProvider` from the LSP client's {server_capabilities} in the
|
|
|
|
`LspAttach` callback.
|
|
|
|
|
2023-03-06 11:03:13 -07:00
|
|
|
See |lsp-semantic-highlight| for more information.
|
2022-11-23 09:06:36 -07:00
|
|
|
|
2023-03-02 10:03:11 -07:00
|
|
|
• |vim.treesitter.inspect_tree()| and |:InspectTree| opens a split window
|
|
|
|
showing a text representation of the nodes in a language tree for the current
|
|
|
|
buffer.
|
2022-12-08 09:22:57 -07:00
|
|
|
|
2022-12-08 02:55:01 -07:00
|
|
|
• Added support for the `willSave` and `willSaveWaitUntil` capabilities to the
|
|
|
|
LSP client. `willSaveWaitUntil` allows a server to modify a document before it
|
|
|
|
gets saved. Example use-cases by language servers include removing unused
|
|
|
|
imports, or formatting the file.
|
|
|
|
|
2022-11-26 03:54:26 -07:00
|
|
|
• Treesitter syntax highlighting for `help` files now supports highlighted
|
|
|
|
code examples. To enable, create a `.config/nvim/ftplugin/help.lua` with
|
|
|
|
the contents >lua
|
|
|
|
vim.treesitter.start()
|
|
|
|
<
|
|
|
|
Note: Highlighted code examples are only available in the Nvim manual, not
|
|
|
|
in help files taken from Vim. The treesitter `help` parser is also work in
|
|
|
|
progress and not guaranteed to correctly highlight every help file in the
|
|
|
|
wild.
|
|
|
|
|
2022-11-28 12:23:04 -07:00
|
|
|
• |vim.secure.trust()|, |:trust| allows the user to manage files in trust
|
|
|
|
database.
|
|
|
|
|
2022-11-23 18:42:05 -07:00
|
|
|
• |vim.diagnostic.open_float()| (and therefore |vim.diagnostic.config()|) now
|
|
|
|
accepts a `suffix` option which, by default, renders LSP error codes.
|
|
|
|
Similarly, the `virtual_text` configuration in |vim.diagnostic.config()| now
|
|
|
|
has a `suffix` option which does nothing by default.
|
|
|
|
|
2022-12-13 06:59:31 -07:00
|
|
|
• |vim.fs.dir()| now has a `opts` argument with a depth field to allow
|
|
|
|
recursively searching a directory tree.
|
|
|
|
|
2023-03-20 00:12:33 -07:00
|
|
|
• |vim.gsplit()| supports all features of |vim.split()|.
|
|
|
|
|
2022-11-05 12:37:05 -07:00
|
|
|
• |vim.secure.read()| reads a file and prompts the user if it should be
|
|
|
|
trusted and, if so, returns the file's contents.
|
|
|
|
|
2022-11-05 15:48:13 -07:00
|
|
|
• When using Nvim inside tmux 3.2 or later, the default clipboard provider
|
|
|
|
will now copy to the system clipboard. |provider-clipboard|
|
2022-11-07 03:22:16 -07:00
|
|
|
|
2022-12-15 13:23:28 -07:00
|
|
|
• |'showcmdloc'| option to display the 'showcmd' information in the
|
|
|
|
status line or tab line. A new %S statusline item is available to place
|
|
|
|
the 'showcmd' text in a custom 'statusline'. Useful for when |'cmdheight'|
|
|
|
|
is set to 0.
|
|
|
|
|
|
|
|
• |'splitkeep'| option to control the scroll behavior of horizontal splits.
|
2022-11-07 03:22:16 -07:00
|
|
|
|
2023-01-09 10:12:06 -07:00
|
|
|
• |'statuscolumn'| option to customize the area to the side of a window,
|
|
|
|
normally containing the fold, sign and number columns. This new option follows
|
|
|
|
the 'statusline' syntax and can be used to transform the line numbers, create
|
|
|
|
mouse click callbacks for |signs|, introduce a custom margin or separator etc.
|
|
|
|
|
2022-10-20 03:04:32 -07:00
|
|
|
• |nvim_select_popupmenu_item()| now supports |cmdline-completion| popup menu.
|
2022-10-17 06:00:50 -07:00
|
|
|
|
2022-11-07 03:22:16 -07:00
|
|
|
• |'diffopt'| now includes a `linematch` option to enable a second-stage diff
|
|
|
|
on individual hunks to provide much more accurate diffs. This option is also
|
|
|
|
available to |vim.diff()|
|
|
|
|
|
|
|
|
See https://github.com/neovim/neovim/pull/14537.
|
|
|
|
|
2023-01-12 09:57:39 -07:00
|
|
|
• |vim.diagnostic.is_disabled()| checks if diagnostics are disabled in a given
|
|
|
|
buffer or namespace.
|
|
|
|
|
2022-05-02 12:10:01 -07:00
|
|
|
• |--remote-ui| option was added to connect to a remote instance and display
|
|
|
|
in it in a |TUI| in the local terminal. This can be used run a headless nvim
|
|
|
|
instance in the background and display its UI on demand, which previously
|
2023-01-03 16:38:48 -07:00
|
|
|
only was possible using an external UI implementation.
|
2022-05-02 12:10:01 -07:00
|
|
|
|
2023-01-23 02:26:46 -07:00
|
|
|
• Several improvements were made to make the code generation scripts more
|
|
|
|
deterministic, and a `LUA_GEN_PRG` build parameter has been introduced to
|
|
|
|
allow for a workaround for some remaining reproducibility problems.
|
|
|
|
|
2023-01-19 16:18:21 -07:00
|
|
|
• |:highlight| now supports an additional attribute "altfont".
|
|
|
|
|
2023-03-07 07:13:09 -07:00
|
|
|
• |:Man| manpage viewer supports manpage names containing spaces.
|
|
|
|
|
2022-07-21 04:08:37 -07:00
|
|
|
• Treesitter captures can now be transformed by directives. This will allow
|
|
|
|
more complicated dynamic language injections.
|
|
|
|
|
2023-03-02 12:46:59 -07:00
|
|
|
• |vim.treesitter.get_node_text()| now accepts a `metadata` option for
|
|
|
|
writing custom directives using |vim.treesitter.add_directive()|.
|
2022-12-26 14:10:59 -07:00
|
|
|
|
2023-03-02 12:46:59 -07:00
|
|
|
• |vim.treesitter.add()| replaces `vim.treesitter.language.require_language`.
|
2023-02-21 10:09:18 -07:00
|
|
|
|
2022-11-28 14:43:10 -07:00
|
|
|
• `require'bit'` is now always available |lua-bit|
|
2023-02-23 10:05:20 -07:00
|
|
|
|
|
|
|
• |vim.treesitter.foldexpr()| can be used for 'foldexpr' to use treesitter for folding.
|
|
|
|
|
2023-02-26 09:53:33 -07:00
|
|
|
• Expanded the TSNode API with:
|
|
|
|
- |TSNode:tree()|
|
|
|
|
- |TSNode:has_changes()|
|
|
|
|
- |TSNode:extra()|
|
|
|
|
- |TSNode:equal()|
|
|
|
|
|
|
|
|
Additionally |TSNode:range()| now takes an optional {include_bytes} argument.
|
|
|
|
|
2023-02-23 10:29:36 -07:00
|
|
|
• |nvim_list_uis()| reports all |ui-option| fields.
|
|
|
|
|
2023-02-27 08:31:05 -07:00
|
|
|
• Vim's `has('gui_running')` is now supported as a way for plugins to check if
|
|
|
|
a GUI (not the |TUI|) is attached to Nvim. |has()|
|
|
|
|
|
2023-03-04 23:52:27 -07:00
|
|
|
• Added preliminary support for the `workspace/didChangeWatchedFiles` capability
|
|
|
|
to the LSP client to notify servers of file changes on disk. The feature is
|
|
|
|
disabled by default and can be enabled by setting the
|
|
|
|
`workspace.didChangeWatchedFiles.dynamicRegistration=true` capability.
|
|
|
|
|
2021-01-27 01:00:28 -07:00
|
|
|
• Added an omnifunc implementation for lua, |vim.lua_omnifunc()|
|
|
|
|
|
2023-03-08 04:03:11 -07:00
|
|
|
• Treesitter injection queries now use the format described at
|
|
|
|
https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection .
|
|
|
|
Support for the previous format will be removed in a future release.
|
|
|
|
|
2023-03-15 16:30:14 -07:00
|
|
|
• |nvim_get_option_value()| now has a `filetype` option so it can return the
|
|
|
|
default option for a specific filetype.
|
|
|
|
|
2023-03-11 10:11:02 -07:00
|
|
|
• |vim.filetype.get_option()| to get the default option value for a specific
|
|
|
|
filetype. This is a wrapper around |nvim_get_option_value()| with caching.
|
|
|
|
|
2022-10-08 08:49:09 -07:00
|
|
|
==============================================================================
|
|
|
|
CHANGED FEATURES *news-changes*
|
|
|
|
|
|
|
|
The following changes to existing APIs or features add new behavior.
|
|
|
|
|
2022-12-19 09:33:47 -07:00
|
|
|
• 'exrc' now supports `.nvim.lua` file.
|
2022-11-05 18:30:48 -07:00
|
|
|
• 'exrc' is no longer marked deprecated.
|
|
|
|
|
2022-05-02 12:10:01 -07:00
|
|
|
• The |TUI| is changed to run in a separate process (previously, a separate
|
|
|
|
thread was used). This is not supposed to be a visible change to the user,
|
|
|
|
but might be the cause of subtle changes of behavior and bugs.
|
|
|
|
|
2022-12-27 06:43:03 -07:00
|
|
|
Previously, the TUI could be disabled as a build time feature (+tui/-tui),
|
|
|
|
resulting in a nvim binary which only could be run headless or embedded
|
2023-01-03 16:38:48 -07:00
|
|
|
in an external process. As of this version, TUI is always available.
|
2022-12-27 06:43:03 -07:00
|
|
|
|
2023-01-15 15:38:50 -07:00
|
|
|
• API calls now show more information about where an exception happened.
|
|
|
|
|
2023-03-12 15:58:46 -07:00
|
|
|
• The `win_viewport` UI event now contains information about virtual lines,
|
|
|
|
meaning that smooth scrolling can now be implemented more consistenlty.
|
|
|
|
|
2023-03-20 13:11:10 -07:00
|
|
|
• The `:= {expr}` syntax can be used to evaluate a lua expression, as
|
|
|
|
a shorter form of `:lua ={expr}`. `:=` and `:[range]=` without argument
|
|
|
|
are unchanged. However `:=#` and similar variants using |ex-flags|
|
|
|
|
are no longer supported.
|
|
|
|
|
2022-10-08 08:49:09 -07:00
|
|
|
==============================================================================
|
|
|
|
REMOVED FEATURES *news-removed*
|
|
|
|
|
|
|
|
The following deprecated functions or APIs were removed.
|
|
|
|
|
2023-01-16 02:44:20 -07:00
|
|
|
• It is no longer possible to scroll the whole screen when showing messages
|
|
|
|
longer than 'cmdheight'. |msgsep| is now always enabled even if 'display'
|
|
|
|
doesn't contain the "msgsep" flag.
|
|
|
|
|
2022-10-16 23:52:40 -07:00
|
|
|
• `filetype.vim` is removed in favor of |lua-filetype|
|
|
|
|
(Note that filetype logic and tests still align with Vim, so additions or
|
|
|
|
changes need to be contributed there first.)
|
|
|
|
See https://github.com/neovim/neovim/pull/20674.
|
|
|
|
|
2023-03-10 09:16:49 -07:00
|
|
|
• 'hkmap', 'hkmapp' and 'aleph' options were removed. Use 'keymap' option instead.
|
|
|
|
|
|
|
|
• |LanguageTree:parse()| no longer returns changed regions. Please use the
|
|
|
|
`on_changedtree` callbacks instead.
|
2023-02-27 04:29:20 -07:00
|
|
|
|
2023-03-11 03:57:07 -07:00
|
|
|
• `vim.highlight.create()`, `vim.highlight.link()` were removed, use |nvim_set_hl()| instead.
|
|
|
|
|
|
|
|
• `require'health'` was removed. Use |vim.health| instead.
|
|
|
|
|
2022-10-08 08:49:09 -07:00
|
|
|
==============================================================================
|
|
|
|
DEPRECATIONS *news-deprecations*
|
|
|
|
|
|
|
|
The following functions are now deprecated and will be removed in the next
|
|
|
|
release.
|
|
|
|
|
2023-03-02 12:46:59 -07:00
|
|
|
• |vim.treesitter.add()| replaces `vim.treesitter.language.require_language()`
|
2022-10-08 08:49:09 -07:00
|
|
|
|
2023-02-22 08:01:08 -07:00
|
|
|
• |vim.treesitter.get_node_at_pos()| and |vim.treesitter.get_node_at_cursor()|
|
|
|
|
are both deprecated in favor of |vim.treesitter.get_node()|.
|
2022-10-08 08:49:09 -07:00
|
|
|
|
|
|
|
vim:tw=78:ts=8:sw=2:et:ft=help:norl:
|