mirror of
https://github.com/neovim/neovim.git
synced 2025-11-18 00:01:46 +00:00
docs: misc
Co-authored-by: Dustin S. <dstackmasta27@gmail.com> Co-authored-by: Ferenc Fejes <fejes@inf.elte.hu> Co-authored-by: Maria José Solano <majosolano99@gmail.com> Co-authored-by: Yochem van Rosmalen <git@yochem.nl> Co-authored-by: brianhuster <phambinhanctb2004@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
@@ -108,20 +108,20 @@ For arm64:
|
|||||||
The [Releases](https://github.com/neovim/neovim/releases) page provides pre-built binaries for Linux systems.
|
The [Releases](https://github.com/neovim/neovim/releases) page provides pre-built binaries for Linux systems.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
|
||||||
sudo rm -rf /opt/nvim
|
sudo rm -rf /opt/nvim
|
||||||
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
|
||||||
```
|
```
|
||||||
|
|
||||||
Then add this to your shell config (`~/.bashrc`, `~/.zshrc`, ...):
|
Then add this to your shell config (`~/.bashrc`, `~/.zshrc`, ...):
|
||||||
|
|
||||||
export PATH="$PATH:/opt/nvim-linux64/bin"
|
export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
|
||||||
|
|
||||||
### AppImage ("universal" Linux package)
|
### AppImage ("universal" Linux package)
|
||||||
|
|
||||||
The [Releases](https://github.com/neovim/neovim/releases) page provides an [AppImage](https://appimage.org) that runs on most Linux systems. No installation is needed, just download `nvim-linux-x86_64.appimage` and run it. (It might not work if your Linux distribution is more than 4 years old.) The following instructions assume an `x86_64` architecture; on ARM Linux replace with `arm64`.
|
The [Releases](https://github.com/neovim/neovim/releases) page provides an [AppImage](https://appimage.org) that runs on most Linux systems. No installation is needed, just download `nvim-linux-x86_64.appimage` and run it. (It might not work if your Linux distribution is more than 4 years old.) The following instructions assume an `x86_64` architecture; on ARM Linux replace with `arm64`.
|
||||||
|
|
||||||
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-86_64.appimage
|
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.appimage
|
||||||
chmod u+x nvim-linux-x86_64.appimage
|
chmod u+x nvim-linux-x86_64.appimage
|
||||||
./nvim-linux-x86_64.appimage
|
./nvim-linux-x86_64.appimage
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ after adding them, the returned |extmark| id can be used. >lua
|
|||||||
See also |vim.hl.range()|.
|
See also |vim.hl.range()|.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Floating windows *api-floatwin*
|
Floating windows *api-floatwin* *floating-windows*
|
||||||
|
|
||||||
Floating windows ("floats") are displayed on top of normal windows. This is
|
Floating windows ("floats") are displayed on top of normal windows. This is
|
||||||
useful to implement simple widgets, such as tooltips displayed next to the
|
useful to implement simple widgets, such as tooltips displayed next to the
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Third-party GUIs *third-party-guis* *vscode*
|
|||||||
|
|
||||||
Nvim provides a builtin "terminal UI" (|TUI|), but also works with many
|
Nvim provides a builtin "terminal UI" (|TUI|), but also works with many
|
||||||
(third-party) GUIs which may provide a fresh look or extra features on top of
|
(third-party) GUIs which may provide a fresh look or extra features on top of
|
||||||
Nvim. For example, "vscode-neovim" essentally allows you to use VSCode as
|
Nvim. For example, "vscode-neovim" essentially allows you to use VSCode as
|
||||||
a Nvim GUI.
|
a Nvim GUI.
|
||||||
|
|
||||||
- vscode-neovim (Nvim in VSCode!) https://github.com/vscode-neovim/vscode-neovim
|
- vscode-neovim (Nvim in VSCode!) https://github.com/vscode-neovim/vscode-neovim
|
||||||
|
|||||||
@@ -882,8 +882,9 @@ foldexpr({lnum}) *vim.lsp.foldexpr()*
|
|||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
if client:supports_method('textDocument/foldingRange') then
|
if client:supports_method('textDocument/foldingRange') then
|
||||||
vim.wo.foldmethod = 'expr'
|
local win = vim.api.nvim_get_current_win()
|
||||||
vim.wo.foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
vim.wo[win][0].foldmethod = 'expr'
|
||||||
|
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ argument.
|
|||||||
*-n*
|
*-n*
|
||||||
-n Disables |swap-file| by setting 'updatecount' to 0 (after
|
-n Disables |swap-file| by setting 'updatecount' to 0 (after
|
||||||
executing any |vimrc|). Recovery after a crash will be
|
executing any |vimrc|). Recovery after a crash will be
|
||||||
impossible. Improves peformance when working with a file on
|
impossible. Improves performance when working with a file on
|
||||||
a very slow medium (usb drive, network share).
|
a very slow medium (usb drive, network share).
|
||||||
|
|
||||||
Enable it again by setting 'updatecount' to some value, e.g.
|
Enable it again by setting 'updatecount' to some value, e.g.
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ convention, nodes to be concealed are captured as `@conceal`, but any capture
|
|||||||
can be used. For example, the following query can be used to hide code block
|
can be used. For example, the following query can be used to hide code block
|
||||||
delimiters in Markdown: >query
|
delimiters in Markdown: >query
|
||||||
|
|
||||||
(fenced_code_block_delimiter @conceal (#set! conceal ""))
|
((fenced_code_block_delimiter) @conceal (#set! conceal ""))
|
||||||
<
|
<
|
||||||
It is also possible to replace a node with a single character, which (unlike
|
It is also possible to replace a node with a single character, which (unlike
|
||||||
legacy syntax) can be given a custom highlight. For example, the following
|
legacy syntax) can be given a custom highlight. For example, the following
|
||||||
@@ -508,6 +508,13 @@ still highlighted the same as other operators: >query
|
|||||||
<
|
<
|
||||||
Conceals specified in this way respect 'conceallevel'.
|
Conceals specified in this way respect 'conceallevel'.
|
||||||
|
|
||||||
|
Note that although you can use any string for `conceal`, only the first
|
||||||
|
character will be used: >query
|
||||||
|
|
||||||
|
; identifiers will be concealed with 'f'.
|
||||||
|
((identifier) @conceal (#set! conceal "foo"))
|
||||||
|
<
|
||||||
|
|
||||||
*treesitter-highlight-priority*
|
*treesitter-highlight-priority*
|
||||||
Treesitter uses |nvim_buf_set_extmark()| to set highlights with a default
|
Treesitter uses |nvim_buf_set_extmark()| to set highlights with a default
|
||||||
priority of 100. This enables plugins to set a highlighting priority lower or
|
priority of 100. This enables plugins to set a highlighting priority lower or
|
||||||
@@ -1666,8 +1673,8 @@ LanguageTree:parse({range}, {on_parse}) *LanguageTree:parse()*
|
|||||||
Function invoked when parsing completes. When provided and
|
Function invoked when parsing completes. When provided and
|
||||||
`vim.g._ts_force_sync_parsing` is not set, parsing will
|
`vim.g._ts_force_sync_parsing` is not set, parsing will
|
||||||
run asynchronously. The first argument to the function is
|
run asynchronously. The first argument to the function is
|
||||||
a string respresenting the error type, in case of a
|
a string representing the error type, in case of a failure
|
||||||
failure (currently only possible for timeouts). The second
|
(currently only possible for timeouts). The second
|
||||||
argument is the list of trees returned by the parse (upon
|
argument is the list of trees returned by the parse (upon
|
||||||
success), or `nil` if the parse timed out (determined by
|
success), or `nil` if the parse timed out (determined by
|
||||||
'redrawtime').
|
'redrawtime').
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ do
|
|||||||
|
|
||||||
-- This autocommand updates the value of 'background' anytime we receive
|
-- This autocommand updates the value of 'background' anytime we receive
|
||||||
-- an OSC 11 response from the terminal emulator. If the user has set
|
-- an OSC 11 response from the terminal emulator. If the user has set
|
||||||
-- 'background' explictly then we will delete this autocommand,
|
-- 'background' explicitly then we will delete this autocommand,
|
||||||
-- effectively disabling automatic background setting.
|
-- effectively disabling automatic background setting.
|
||||||
local force = false
|
local force = false
|
||||||
local id = vim.api.nvim_create_autocmd('TermResponse', {
|
local id = vim.api.nvim_create_autocmd('TermResponse', {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ local matchregex = vim.filetype._matchregex
|
|||||||
-- can be detected from the first five lines of the file.
|
-- can be detected from the first five lines of the file.
|
||||||
--- @type vim.filetype.mapfn
|
--- @type vim.filetype.mapfn
|
||||||
function M.asm(path, bufnr)
|
function M.asm(path, bufnr)
|
||||||
-- tiasm uses `* commment`
|
-- tiasm uses `* comment`
|
||||||
local lines = table.concat(getlines(bufnr, 1, 10), '\n')
|
local lines = table.concat(getlines(bufnr, 1, 10), '\n')
|
||||||
if findany(lines, { '^%*', '\n%*', 'Texas Instruments Incorporated' }) then
|
if findany(lines, { '^%*', '\n%*', 'Texas Instruments Incorporated' }) then
|
||||||
return 'tiasm'
|
return 'tiasm'
|
||||||
|
|||||||
@@ -1395,8 +1395,9 @@ end
|
|||||||
--- callback = function(args)
|
--- callback = function(args)
|
||||||
--- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
--- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
--- if client:supports_method('textDocument/foldingRange') then
|
--- if client:supports_method('textDocument/foldingRange') then
|
||||||
--- vim.wo.foldmethod = 'expr'
|
--- local win = vim.api.nvim_get_current_win()
|
||||||
--- vim.wo.foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
--- vim.wo[win][0].foldmethod = 'expr'
|
||||||
|
--- vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
||||||
--- end
|
--- end
|
||||||
--- end,
|
--- end,
|
||||||
--- })
|
--- })
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ end
|
|||||||
---
|
---
|
||||||
---@see vim.lsp.protocol.CompletionTriggerKind
|
---@see vim.lsp.protocol.CompletionTriggerKind
|
||||||
function M.completion(context)
|
function M.completion(context)
|
||||||
vim.depends('vim.lsp.buf.completion', 'vim.lsp.commpletion.trigger', '0.12')
|
vim.depends('vim.lsp.buf.completion', 'vim.lsp.completion.trigger', '0.12')
|
||||||
return lsp.buf_request(
|
return lsp.buf_request(
|
||||||
0,
|
0,
|
||||||
ms.textDocument_completion,
|
ms.textDocument_completion,
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ end
|
|||||||
--- only the root tree without injections).
|
--- only the root tree without injections).
|
||||||
--- @param on_parse fun(err?: string, trees?: table<integer, TSTree>)? Function invoked when parsing completes.
|
--- @param on_parse fun(err?: string, trees?: table<integer, TSTree>)? Function invoked when parsing completes.
|
||||||
--- When provided and `vim.g._ts_force_sync_parsing` is not set, parsing will run
|
--- When provided and `vim.g._ts_force_sync_parsing` is not set, parsing will run
|
||||||
--- asynchronously. The first argument to the function is a string respresenting the error type,
|
--- asynchronously. The first argument to the function is a string representing the error type,
|
||||||
--- in case of a failure (currently only possible for timeouts). The second argument is the list
|
--- in case of a failure (currently only possible for timeouts). The second argument is the list
|
||||||
--- of trees returned by the parse (upon success), or `nil` if the parse timed out (determined
|
--- of trees returned by the parse (upon success), or `nil` if the parse timed out (determined
|
||||||
--- by 'redrawtime').
|
--- by 'redrawtime').
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ static void prepare_call(RemoteUI *ui, const char *name)
|
|||||||
ui_alloc_buf(ui);
|
ui_alloc_buf(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
// To optimize data transfer(especially for "grid_line"), we bundle adjacent
|
// To optimize data transfer (especially for "grid_line"), we bundle adjacent
|
||||||
// calls to same method together, so only add a new call entry if the last
|
// calls to same method together, so only add a new call entry if the last
|
||||||
// method call is different from "name"
|
// method call is different from "name"
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint
|
|||||||
char *host_end = strrchr(addr, ':');
|
char *host_end = strrchr(addr, ':');
|
||||||
|
|
||||||
if (host_end && addr != host_end) {
|
if (host_end && addr != host_end) {
|
||||||
// Split user specified address into two strings, addr(hostname) and port.
|
// Split user specified address into two strings, addr (hostname) and port.
|
||||||
// The port part in watcher->addr will be updated later.
|
// The port part in watcher->addr will be updated later.
|
||||||
*host_end = NUL;
|
*host_end = NUL;
|
||||||
char *port = host_end + 1;
|
char *port = host_end + 1;
|
||||||
|
|||||||
@@ -2593,7 +2593,7 @@ static bool cmdpreview_may_show(CommandLineState *s)
|
|||||||
// Place it there in case preview callback flushes it. #30696
|
// Place it there in case preview callback flushes it. #30696
|
||||||
cursorcmd();
|
cursorcmd();
|
||||||
// Flush now: external cmdline may itself wish to update the screen which is
|
// Flush now: external cmdline may itself wish to update the screen which is
|
||||||
// currently disallowed during cmdpreview(no longer needed in case that changes).
|
// currently disallowed during cmdpreview (no longer needed in case that changes).
|
||||||
cmdline_ui_flush();
|
cmdline_ui_flush();
|
||||||
|
|
||||||
// Swap invalid command range if needed
|
// Swap invalid command range if needed
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ typedef struct {
|
|||||||
bool previous_got_int; // `got_int` was true
|
bool previous_got_int; // `got_int` was true
|
||||||
bool cmdwin; // command-line window normal mode
|
bool cmdwin; // command-line window normal mode
|
||||||
bool noexmode; // true if the normal mode was pushed from
|
bool noexmode; // true if the normal mode was pushed from
|
||||||
// ex mode(:global or :visual for example)
|
// ex mode (:global or :visual for example)
|
||||||
bool toplevel; // top-level normal mode
|
bool toplevel; // top-level normal mode
|
||||||
oparg_T oa; // operator arguments
|
oparg_T oa; // operator arguments
|
||||||
cmdarg_T ca; // command arguments
|
cmdarg_T ca; // command arguments
|
||||||
@@ -504,9 +504,9 @@ bool op_pending(void)
|
|||||||
/// Normal state entry point. This is called on:
|
/// Normal state entry point. This is called on:
|
||||||
///
|
///
|
||||||
/// - Startup, In this case the function never returns.
|
/// - Startup, In this case the function never returns.
|
||||||
/// - The command-line window is opened(`q:`). Returns when `cmdwin_result` != 0.
|
/// - The command-line window is opened (`q:`). Returns when `cmdwin_result` != 0.
|
||||||
/// - The :visual command is called from :global in ex mode, `:global/PAT/visual`
|
/// - The :visual command is called from :global in ex mode, `:global/PAT/visual`
|
||||||
/// for example. Returns when re-entering ex mode(because ex mode recursion is
|
/// for example. Returns when re-entering ex mode (because ex mode recursion is
|
||||||
/// not allowed)
|
/// not allowed)
|
||||||
///
|
///
|
||||||
/// This used to be called main_loop() on main.c
|
/// This used to be called main_loop() on main.c
|
||||||
@@ -642,8 +642,7 @@ static bool normal_need_redraw_mode_message(NormalState *s)
|
|||||||
return (
|
return (
|
||||||
// 'showmode' is set and messages can be printed
|
// 'showmode' is set and messages can be printed
|
||||||
((p_smd && msg_silent == 0
|
((p_smd && msg_silent == 0
|
||||||
// must restart insert mode(ctrl+o or ctrl+l) or we just entered visual
|
// must restart insert mode (ctrl+o or ctrl+l) or just entered visual mode
|
||||||
// mode
|
|
||||||
&& (restart_edit != 0 || (VIsual_active
|
&& (restart_edit != 0 || (VIsual_active
|
||||||
&& s->old_pos.lnum == curwin->w_cursor.lnum
|
&& s->old_pos.lnum == curwin->w_cursor.lnum
|
||||||
&& s->old_pos.col == curwin->w_cursor.col))
|
&& s->old_pos.col == curwin->w_cursor.col))
|
||||||
@@ -6625,8 +6624,8 @@ static void nv_event(cmdarg_T *cap)
|
|||||||
// `input_get` branch was not executed (!multiqueue_empty(loop.events), which
|
// `input_get` branch was not executed (!multiqueue_empty(loop.events), which
|
||||||
// could have `may_garbage_collect` set to true in `normal_check`).
|
// could have `may_garbage_collect` set to true in `normal_check`).
|
||||||
//
|
//
|
||||||
// That is because here we may run code that calls `input_get`
|
// That is because here we may run code that calls `input_get` later
|
||||||
// later(`f_confirm` or `get_keystroke` for example), but in these cases it is
|
// (`f_confirm` or `get_keystroke` for example), but in these cases it is
|
||||||
// not safe to perform garbage collection because there could be unreferenced
|
// not safe to perform garbage collection because there could be unreferenced
|
||||||
// lists or dicts being used.
|
// lists or dicts being used.
|
||||||
may_garbage_collect = false;
|
may_garbage_collect = false;
|
||||||
|
|||||||
@@ -187,8 +187,7 @@ static void on_signal(SignalWatcher *handle, int signum, void *data)
|
|||||||
switch (signum) {
|
switch (signum) {
|
||||||
#ifdef SIGPWR
|
#ifdef SIGPWR
|
||||||
case SIGPWR:
|
case SIGPWR:
|
||||||
// Signal of a power failure(eg batteries low), flush the swap files to
|
// Signal of a power failure (eg batteries low), flush the swap files to be safe
|
||||||
// be safe
|
|
||||||
ml_sync_all(false, false, true);
|
ml_sync_all(false, false, true);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2073,7 +2073,7 @@ char *path_shorten_fname(char *full_path, char *dir_name)
|
|||||||
/// @param[in] flags Flags passed to expand_wildcards().
|
/// @param[in] flags Flags passed to expand_wildcards().
|
||||||
///
|
///
|
||||||
/// @returns OK when *file is set to allocated array of matches
|
/// @returns OK when *file is set to allocated array of matches
|
||||||
/// and *num_file(can be zero) to the number of matches.
|
/// and *num_file (can be zero) to the number of matches.
|
||||||
/// If FAIL is returned, *num_file and *file are either
|
/// If FAIL is returned, *num_file and *file are either
|
||||||
/// unchanged or *num_file is set to 0 and *file is set
|
/// unchanged or *num_file is set to 0 and *file is set
|
||||||
/// to NULL or points to "".
|
/// to NULL or points to "".
|
||||||
|
|||||||
Reference in New Issue
Block a user