aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md34
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.yml60
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md27
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.yml20
-rw-r--r--.github/ISSUE_TEMPLATE/lsp_bug_report.md58
-rw-r--r--.github/ISSUE_TEMPLATE/lsp_bug_report.yml69
-rw-r--r--.gitignore1
-rw-r--r--runtime/doc/eval.txt3
-rw-r--r--runtime/doc/options.txt5
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/treesitter.txt42
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--runtime/lua/vim/treesitter/query.lua7
-rw-r--r--src/nvim/buffer.c14
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/digraph.c4
-rw-r--r--src/nvim/ex_cmds.c19
-rw-r--r--src/nvim/ex_docmd.c17
-rw-r--r--src/nvim/ex_docmd.h4
-rw-r--r--src/nvim/ex_getln.c264
-rw-r--r--src/nvim/getchar.c24
-rw-r--r--src/nvim/globals.h3
-rw-r--r--src/nvim/highlight.c2
-rw-r--r--src/nvim/indent.c14
-rw-r--r--src/nvim/keymap.c2
-rw-r--r--src/nvim/main.c27
-rw-r--r--src/nvim/main.h1
-rw-r--r--src/nvim/mbyte.c6
-rw-r--r--src/nvim/memfile_defs.h2
-rw-r--r--src/nvim/message.c5
-rw-r--r--src/nvim/misc1.c4
-rw-r--r--src/nvim/mouse.c5
-rw-r--r--src/nvim/normal.c19
-rw-r--r--src/nvim/option_defs.h1
-rw-r--r--src/nvim/options.lua2
-rw-r--r--src/nvim/search.h2
-rw-r--r--src/nvim/sign.c4
-rw-r--r--src/nvim/state.c6
-rw-r--r--src/nvim/tui/tui.c7
-rw-r--r--test/functional/treesitter/parser_spec.lua13
40 files changed, 296 insertions, 505 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index ae30f00f31..0000000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-name: Bug report
-about: Report a problem in Nvim
-title: ''
-labels: bug
-
----
-
-<!-- Before reporting: search existing issues and check the FAQ. -->
-
-- `nvim --version`:
-- Operating system/version:
-- Terminal name/version:
-- `$TERM`:
-
-<!--
-If this report is about different behaviour between Nvim and Vim, make sure to
-read `:h vim-differences` first. Otherwise remove the next line.
--->
-[ ] `vim -u DEFAULTS` (version: ) behaves differently
-
-### Steps to reproduce using `nvim -u NORC`
-
-```
-nvim -u NORC
-# Alternative for shell-related problems:
-# env -i TERM=ansi-256color "$(which nvim)"
-
-```
-
-### Actual behaviour
-
-### Expected behaviour
-
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000000..e5530a1511
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,60 @@
+name: Bug Report
+description: Report a problem in Neovim
+labels: [bug]
+body:
+
+ - type: markdown
+ attributes:
+ value: |
+ Before reporting: search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ).
+
+ - type: input
+ attributes:
+ label: "Neovim Version"
+ description: "`nvim --version`:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Operating system/version:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Terminal name/version:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "TERM environment variable"
+ description: "echo `$TERM`:"
+ validations:
+ required: true
+
+ - type: input
+ attributes:
+ label: "Installation"
+ description: "How did you install neovim: build from repo / system package manager / appimage / homebrew / snap / chocolatey / other (please specify)?"
+ placeholder: "Arch User Repository (AUR)"
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: "Steps to reproduce"
+ description: |
+ Steps to reproduce using `nvim -u NORC` and/or `nvim -u NONE` (please test both).
+ If you are reporting build failures, please list the exact sequence of steps including all CMake flags (if any).
+
+ - type: input
+ attributes:
+ label: "Vim"
+ description: "Does Vim behave differently when called with `vim -u DEFAULTS`? If yes, which version of Vim are you using (`vim --version`):"
+
+ - type: textarea
+ attributes:
+ label: "Expected behavior"
+ - type: textarea
+ attributes:
+ label: "Actual behavior"
+ description: "A description of the behavior you expected. May optionally include logs, images, or videos."
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
deleted file mode 100644
index 928cde894c..0000000000
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,27 +0,0 @@
----
-name: Feature request
-about: Request an enhancement for Nvim
-title: ''
-labels: enhancement
-
----
-
-<!-- Before reporting: search existing issues and check the FAQ. -->
-
-- `nvim --version`:
-- `vim -u DEFAULTS` (version: ) behaves differently?
-- Operating system/version:
-- Terminal name/version:
-- `$TERM`:
-
-### Steps to reproduce using `nvim -u NORC`
-
-```
-nvim -u NORC
-
-```
-
-### Actual behaviour
-
-### Expected behaviour
-
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000000..a9ed2824cb
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,20 @@
+name: Feature request
+description: Request an enhancement for Neovim
+labels: [enhancement]
+body:
+
+ - type: markdown
+ attributes:
+ value: |
+ Before requesting: search [existing issues](https://github.com/neovim/neovim/labels/enhancement) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ).
+
+ - type: input
+ attributes:
+ label: "Feature already in Vim?"
+ description: "Does the feature already exist in Vim? If possible, please specify which version of Vim it was introduced in."
+
+ - type: textarea
+ attributes:
+ label: "Feature description"
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.md b/.github/ISSUE_TEMPLATE/lsp_bug_report.md
deleted file mode 100644
index d2488a14e8..0000000000
--- a/.github/ISSUE_TEMPLATE/lsp_bug_report.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-name: Language server client bug report
-about: Report a built-in lsp problem in Nvim
-title: ''
-labels: bug, lsp
-
----
-
-<!--
-Before reporting: search existing issues and check the FAQ. Usage questions
-such as "How do I...?" or "Why isn't X language server/feature working?" belong
-on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will
-be closed.
--->
-
-- `nvim --version`:
-- language server name/version:
-- Operating system/version:
-
-<details>
-<summary>nvim -c ":checkhealth nvim lspconfig"</summary>
-
-<!-- Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here. -->
-
-</details>
-
-<details>
-<summary>lsp.log</summary>
-
-<!--
-Please paste the lsp log before and after the problem.
-
-You can set log level like this.
-`:lua vim.lsp.set_log_level("debug")`
-
-You can find the location of the log with the following command.
-`:lua print(vim.lsp.get_log_path())`
--->
-
-</details>
-
-### Steps to reproduce using nvim -u minimal_init.lua
-<!--
- Note, if the issue is with an autocompletion or other LSP plugin, please
- report to the upstream tracker. Download the minmal config with
- wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua
- and modify it to include any specific commands or servers pertaining to your issues.
--->
-
-
-```
-nvim -u minimal_init.lua
-```
-
-### Actual behaviour
-
-### Expected behaviour
-
diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
new file mode 100644
index 0000000000..ff25bb0a23
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml
@@ -0,0 +1,69 @@
+name: Language server client bug report
+description: Report a built-in lsp problem in Neovim
+labels: [bug, lsp]
+body:
+
+ - type: markdown
+ attributes:
+ value: |
+ Before reporting: search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://github.com/neovim/neovim/wiki/FAQ). Usage questions such as "How do I...?" or "Why isn't X language server/feature working?" belong on the [Neovim Discourse](https://neovim.discourse.group/c/7-category/7) and will be closed.
+
+ - type: input
+ attributes:
+ label: "Neovim Version"
+ description: "`nvim --version`:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Language server name/version:"
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: "Operating system/version:"
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: Checkhealth
+ description: |
+ Paste the results from `nvim -c ":checkhealth nvim lspconfig"` here:
+ render: markdown
+
+ - type: markdown
+ attributes:
+ value: |
+ Note: if the issue is with an autocompletion or other LSP plugin, please report it at that plugin's issue tracker. Download the minimal config with `wget https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua` and modify it to include any specific commands or servers pertaining to your issues.
+ - type: textarea
+ attributes:
+ label: "Steps to reproduce"
+ description: |
+ Steps to reproduce using `nvim -u minimal_init.lua`:
+ validations:
+ required: true
+
+ - type: textarea
+ attributes:
+ label: "Expected behavior"
+ - type: textarea
+ attributes:
+ label: "Actual behavior"
+ description: "A description of the behavior you expected. May optionally include logs, images, or videos."
+
+ - type: markdown
+ attributes:
+ value: |
+ Please upload `lsp.log` before and after the problem in a [secret gist](https://gist.github.com/). Paste the url to the gist in the text field below.
+
+ You can set the log level by adding the Lua command
+ `vim.lsp.set_log_level("debug")`
+ after setting up LSP in your config.
+
+ You can find the location of the log with the command
+ `:lua print(vim.lsp.get_log_path())`
+
+ - type: input
+ attributes:
+ label: "Link to uploaded log file"
diff --git a/.gitignore b/.gitignore
index 163140c6e1..e07ce4906e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ compile_commands.json
/tmp/
/.clangd/
/.cache/clangd/
+/.ccls-cache/
.DS_Store
*.mo
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 8c360b1778..e32691dfb4 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -6358,8 +6358,7 @@ mode([expr]) Return a string that indicates the current mode.
Rv Virtual Replace |gR|
Rx Replace mode |i_CTRL-X| completion
c Command-line editing
- cv Vim Ex mode |gQ|
- ce Normal Ex mode |Q|
+ cv Vim Ex mode |Q| or |gQ|
r Hit-enter prompt
rm The -- more -- prompt
r? |:confirm| query of some sort
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 6aa508956b..ab2230641d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4539,11 +4539,6 @@ A jump table for the options with a short description can be found at |Q_op|.
List of items that control the format of the output of |:hardcopy|.
See |popt-option|.
- *'prompt'* *'noprompt'*
-'prompt' boolean (default on)
- global
- When on a ":" prompt is used in Ex mode.
-
*'pumblend'* *'pb'*
'pumblend' 'pb' number (default 0)
global
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index fb20a583c9..c19b05f6c7 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -809,7 +809,6 @@ Short explanation of each option: *option-list*
'printmbcharset' 'pmbcs' CJK character set to be used for :hardcopy
'printmbfont' 'pmbfn' font names to be used for CJK output of :hardcopy
'printoptions' 'popt' controls the format of :hardcopy output
-'prompt' 'prompt' enable prompt in Ex mode
'pumheight' 'ph' maximum height of the popup menu
'pumwidth' 'pw' minimum width of the popup menu
'pythondll' name of the Python 2 dynamic library
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 340db92ae3..5ddc0394cd 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -226,6 +226,18 @@ Here is a list of built-in predicates :
Each predicate has a `not-` prefixed predicate that is just the negation of
the predicate.
+ *vim.treesitter.query.add_predicate()*
+vim.treesitter.query.add_predicate({name}, {handler})
+
+This adds a predicate with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate)
+<
+ *vim.treesitter.query.list_predicates()*
+vim.treesitter.query.list_predicates()
+
+This lists the currently available predicates to use in queries.
+
Treesitter Query Directive *lua-treesitter-directives*
Treesitter queries can also contain `directives`. Directives store metadata for a node
@@ -249,6 +261,21 @@ Here is a list of built-in directives:
`({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})`
The default key is "offset".
+ *vim.treesitter.query.add_directive()*
+vim.treesitter.query.add_directive({name}, {handler})
+
+This adds a directive with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate, metadata)
+Handlers can set match level data by setting directly on the metadata object `metadata.key = value`
+Handlers can set node level data by using the capture id on the metadata table
+`metadata[capture_id].key = value`
+
+ *vim.treesitter.query.list_directives()*
+vim.treesitter.query.list_directives()
+
+This lists the currently available directives to use in queries.
+
Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
NOTE: This is a partially implemented feature, and not usable as a default
@@ -406,8 +433,13 @@ get_query_files({lang}, {query_name}, {is_included})
{is_included} Internal parameter, most of the time left
as `nil`
+list_directives() *list_directives()*
+ Return: ~
+ The list of supported directives.
+
list_predicates() *list_predicates()*
- TODO: Documentation
+ Return: ~
+ The list of supported predicates.
parse_query({lang}, {query}) *parse_query()*
Parse {query} as a string. (If the query is in a file, the
@@ -487,11 +519,9 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
for id, node in pairs(match) do
local name = query.captures[id]
-- `node` was captured by the `name` capture in the match
-<
->
- local node_data = metadata[id] -- Node level metadata
-<
->
+
+ local node_data = metadata[id] -- Node level metadata
+
... use the info here ...
end
end
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 27c4b82aca..a259afded0 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -473,6 +473,7 @@ Options:
'maxmem' Nvim delegates memory-management to the OS.
'maxmemtot' Nvim delegates memory-management to the OS.
'maxcombine' (6 is always used)
+ *'prompt'* *'noprompt'*
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'shelltype'
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index b81eb18945..4ecd91d295 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -351,7 +351,12 @@ function M.add_directive(name, handler, force)
directive_handlers[name] = handler
end
---- Returns the list of currently supported predicates
+--- @return The list of supported directives.
+function M.list_directives()
+ return vim.tbl_keys(directive_handlers)
+end
+
+--- @return The list of supported predicates.
function M.list_predicates()
return vim.tbl_keys(predicate_handlers)
end
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 3b4fc6c3df..587ef74b35 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -540,12 +540,10 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
del_buf = true;
}
- /*
- * Free all things allocated for this buffer.
- * Also calls the "BufDelete" autocommands when del_buf is TRUE.
- */
- /* Remember if we are closing the current buffer. Restore the number of
- * windows, so that autocommands in buf_freeall() don't get confused. */
+ // Free all things allocated for this buffer.
+ // Also calls the "BufDelete" autocommands when del_buf is true.
+ // Remember if we are closing the current buffer. Restore the number of
+ // windows, so that autocommands in buf_freeall() don't get confused.
bool is_curbuf = (buf == curbuf);
// When closing the current buffer stop Visual mode before freeing
@@ -5046,8 +5044,8 @@ do_arg_all(
xfree(opened);
}
-// Return TRUE if "buf" is a prompt buffer.
-int bt_prompt(buf_T *buf)
+/// @return true if "buf" is a prompt buffer.
+bool bt_prompt(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'p';
}
diff --git a/src/nvim/change.c b/src/nvim/change.c
index ca1ca756bb..b30490deca 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -779,7 +779,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
int movelen = oldlen - col - count + 1; // includes trailing NUL
if (movelen <= 1) {
// If we just took off the last character of a non-blank line, and
- // fixpos is TRUE, we don't want to end up positioned at the NUL,
+ // fixpos is true, we don't want to end up positioned at the NUL,
// unless "restart_edit" is set or 'virtualedit' contains "onemore".
if (col > 0 && fixpos && restart_edit == 0
&& (ve_flags & VE_ONEMORE) == 0
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index dd32cef1e3..07e484c178 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1502,10 +1502,10 @@ char_u *get_digraph_for_char(int val_arg)
/// Get a digraph. Used after typing CTRL-K on the command line or in normal
/// mode.
///
-/// @param cmdline TRUE when called from the cmdline
+/// @param cmdline true when called from the cmdline
///
/// @returns composed character, or NUL when ESC was used.
-int get_digraph(int cmdline)
+int get_digraph(bool cmdline)
{
int cc;
no_mapping++;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 0e7d7c2dc2..dc096bdb93 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2887,7 +2887,6 @@ void ex_append(exarg_T *eap)
} else if (lnum > 0)
indent = get_indent_lnum(lnum);
}
- ex_keep_indent = FALSE;
if (eap->getline == NULL) {
/* No getline() function, use the lines that follow. This ends
* when there is no more. */
@@ -2915,10 +2914,6 @@ void ex_append(exarg_T *eap)
if (theline == NULL)
break;
- /* Using ^ CTRL-D in getexmodeline() makes us repeat the indent. */
- if (ex_keep_indent)
- append_indent = indent;
-
/* Look for the "." after automatic indent. */
vcol = 0;
for (p = theline; indent > vcol; ++p) {
@@ -3751,6 +3746,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
*/
while (subflags.do_ask) {
if (exmode_active) {
+ char *prompt;
char_u *resp;
colnr_T sc, ec;
@@ -3767,13 +3763,14 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
sc += numw;
ec += numw;
}
- msg_start();
- for (i = 0; i < (long)sc; ++i)
- msg_putchar(' ');
- for (; i <= (long)ec; ++i)
- msg_putchar('^');
- resp = getexmodeline('?', NULL, 0, true);
+ prompt = xmallocz(ec + 1);
+ memset(prompt, ' ', sc);
+ memset(prompt + sc, '^', ec - sc + 1);
+ resp = (char_u *)getcmdline_prompt(NUL, prompt, 0, EXPAND_NOTHING,
+ NULL, CALLBACK_NONE);
+ msg_putchar('\n');
+ xfree(prompt);
if (resp != NULL) {
typed = *resp;
xfree(resp);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 83472fe146..cf604c2015 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -186,17 +186,14 @@ static void restore_dbg_stuff(struct dbg_stuff *dsp)
}
/// Repeatedly get commands for Ex mode, until the ":vi" command is given.
-void do_exmode(int improved)
+void do_exmode(void)
{
int save_msg_scroll;
int prev_msg_row;
linenr_T prev_line;
int changedtick;
- if (improved)
- exmode_active = EXMODE_VIM;
- else
- exmode_active = EXMODE_NORMAL;
+ exmode_active = true;
State = NORMAL;
/* When using ":global /pat/ visual" and then "Q" we return to continue
@@ -212,7 +209,7 @@ void do_exmode(int improved)
while (exmode_active) {
/* Check for a ":normal" command and no more characters left. */
if (ex_normal_busy > 0 && typebuf.tb_len == 0) {
- exmode_active = 0;
+ exmode_active = false;
break;
}
msg_scroll = true;
@@ -750,8 +747,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
* the :endtry to be missed. */
&& (cstack.cs_trylevel == 0 || did_emsg_syntax)
&& used_getline
- && (getline_equal(fgetline, cookie, getexmodeline)
- || getline_equal(fgetline, cookie, getexline)))
+ && getline_equal(fgetline, cookie, getexline))
&& (next_cmdline != NULL
|| cstack.cs_idx >= 0
|| (flags & DOCMD_REPEAT)));
@@ -2056,8 +2052,7 @@ int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only)
// in ex mode, an empty line works like :+
if (*eap->cmd == NUL && exmode_active
- && (getline_equal(eap->getline, eap->cookie, getexmodeline)
- || getline_equal(eap->getline, eap->cookie, getexline))
+ && getline_equal(eap->getline, eap->cookie, getexline)
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
eap->cmd = (char_u *)"+";
if (!skip_only) {
@@ -7303,7 +7298,7 @@ do_exedit(
*/
if (exmode_active && (eap->cmdidx == CMD_visual
|| eap->cmdidx == CMD_view)) {
- exmode_active = 0;
+ exmode_active = false;
ex_pressedreturn = false;
if (*eap->arg == NUL) {
/* Special case: ":global/pat/visual\NLvi-commands" */
diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h
index f6bd2adcd5..c8c5a0a3e2 100644
--- a/src/nvim/ex_docmd.h
+++ b/src/nvim/ex_docmd.h
@@ -16,10 +16,6 @@
#define VALID_PATH 1
#define VALID_HEAD 2
-/* Values for exmode_active (0 is no exmode) */
-#define EXMODE_NORMAL 1
-#define EXMODE_VIM 2
-
// Structure used to save the current state. Used when executing Normal mode
// commands while in any other mode.
typedef struct {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 4ebd384ae0..855f71ca28 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2510,266 +2510,6 @@ getexline(
return getcmdline(c, 1L, indent, do_concat);
}
-/*
- * Get an Ex command line for Ex mode.
- * In Ex mode we only use the OS supplied line editing features and no
- * mappings or abbreviations.
- * Returns a string in allocated memory or NULL.
- */
-char_u *
-getexmodeline(
- int promptc, // normally ':', NUL for ":append" and '?'
- // for :s prompt
- void *cookie,
- int indent, // indent for inside conditionals
- bool do_concat
-)
-{
- garray_T line_ga;
- char_u *pend;
- int startcol = 0;
- int c1 = 0;
- int escaped = FALSE; /* CTRL-V typed */
- int vcol = 0;
- char_u *p;
- int prev_char;
- int len;
-
- /* always start in column 0; write a newline if necessary */
- compute_cmdrow();
- if ((msg_col || msg_didout) && promptc != '?')
- msg_putchar('\n');
- if (promptc == ':') {
- /* indent that is only displayed, not in the line itself */
- if (p_prompt)
- msg_putchar(':');
- while (indent-- > 0)
- msg_putchar(' ');
- startcol = msg_col;
- }
-
- ga_init(&line_ga, 1, 30);
-
- /* autoindent for :insert and :append is in the line itself */
- if (promptc <= 0) {
- vcol = indent;
- while (indent >= 8) {
- ga_append(&line_ga, TAB);
- msg_puts(" ");
- indent -= 8;
- }
- while (indent-- > 0) {
- ga_append(&line_ga, ' ');
- msg_putchar(' ');
- }
- }
- no_mapping++;
-
- /*
- * Get the line, one character at a time.
- */
- got_int = FALSE;
- while (!got_int) {
- ga_grow(&line_ga, 40);
-
- /* Get one character at a time. Don't use inchar(), it can't handle
- * special characters. */
- prev_char = c1;
-
- // Check for a ":normal" command and no more characters left.
- if (ex_normal_busy > 0 && typebuf.tb_len == 0) {
- c1 = '\n';
- } else {
- c1 = vgetc();
- }
-
- /*
- * Handle line editing.
- * Previously this was left to the system, putting the terminal in
- * cooked mode, but then CTRL-D and CTRL-T can't be used properly.
- */
- if (got_int) {
- msg_putchar('\n');
- break;
- }
-
- if (!escaped) {
- /* CR typed means "enter", which is NL */
- if (c1 == '\r')
- c1 = '\n';
-
- if (c1 == BS || c1 == K_BS || c1 == DEL || c1 == K_DEL || c1 == K_KDEL) {
- if (!GA_EMPTY(&line_ga)) {
- p = (char_u *)line_ga.ga_data;
- p[line_ga.ga_len] = NUL;
- len = utf_head_off(p, p + line_ga.ga_len - 1) + 1;
- line_ga.ga_len -= len;
- goto redraw;
- }
- continue;
- }
-
- if (c1 == Ctrl_U) {
- msg_col = startcol;
- msg_clr_eos();
- line_ga.ga_len = 0;
- goto redraw;
- }
-
- int num_spaces;
- if (c1 == Ctrl_T) {
- int sw = get_sw_value(curbuf);
-
- p = (char_u *)line_ga.ga_data;
- p[line_ga.ga_len] = NUL;
- indent = get_indent_str(p, 8, FALSE);
- num_spaces = sw - indent % sw;
-add_indent:
- if (num_spaces > 0) {
- ga_grow(&line_ga, num_spaces + 1);
- p = (char_u *)line_ga.ga_data;
- char_u *s = skipwhite(p);
-
- // Insert spaces after leading whitespaces.
- long move_len = line_ga.ga_len - (s - p) + 1;
- assert(move_len >= 0);
- memmove(s + num_spaces, s, (size_t)move_len);
- memset(s, ' ', (size_t)num_spaces);
-
- line_ga.ga_len += num_spaces;
- }
-redraw:
- /* redraw the line */
- msg_col = startcol;
- vcol = 0;
- p = (char_u *)line_ga.ga_data;
- p[line_ga.ga_len] = NUL;
- while (p < (char_u *)line_ga.ga_data + line_ga.ga_len) {
- if (*p == TAB) {
- do {
- msg_putchar(' ');
- } while (++vcol % 8);
- p++;
- } else {
- len = utfc_ptr2len(p);
- msg_outtrans_len(p, len);
- vcol += ptr2cells(p);
- p += len;
- }
- }
- msg_clr_eos();
- cmd_cursor_goto(msg_row, msg_col);
- continue;
- }
-
- if (c1 == Ctrl_D) {
- /* Delete one shiftwidth. */
- p = (char_u *)line_ga.ga_data;
- if (prev_char == '0' || prev_char == '^') {
- if (prev_char == '^')
- ex_keep_indent = TRUE;
- indent = 0;
- p[--line_ga.ga_len] = NUL;
- } else {
- p[line_ga.ga_len] = NUL;
- indent = get_indent_str(p, 8, FALSE);
- if (indent == 0) {
- continue;
- }
- --indent;
- indent -= indent % get_sw_value(curbuf);
- }
-
- // reduce the line's indentation
- char_u *from = skipwhite(p);
- char_u *to = from;
- int old_indent;
- while ((old_indent = get_indent_str(p, 8, FALSE)) > indent) {
- *--to = NUL;
- }
- long move_len = line_ga.ga_len - (from - p) + 1;
- assert(move_len > 0);
- memmove(to, from, (size_t)move_len);
- line_ga.ga_len -= (int)(from - to);
-
- // Removed to much indentation, fix it before redrawing.
- num_spaces = indent - old_indent;
- goto add_indent;
- }
-
- if (c1 == Ctrl_V || c1 == Ctrl_Q) {
- escaped = TRUE;
- continue;
- }
-
- if (IS_SPECIAL(c1)) {
- // Ignore other special key codes
- continue;
- }
- }
-
- if (IS_SPECIAL(c1)) {
- c1 = '?';
- }
- len = utf_char2bytes(c1, (char_u *)line_ga.ga_data + line_ga.ga_len);
- if (c1 == '\n') {
- msg_putchar('\n');
- } else if (c1 == TAB) {
- // Don't use chartabsize(), 'ts' can be different.
- do {
- msg_putchar(' ');
- } while (++vcol % 8);
- } else {
- msg_outtrans_len(((char_u *)line_ga.ga_data) + line_ga.ga_len, len);
- vcol += char2cells(c1);
- }
- line_ga.ga_len += len;
- escaped = FALSE;
-
- cmd_cursor_goto(msg_row, msg_col);
- pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
-
- /* We are done when a NL is entered, but not when it comes after an
- * odd number of backslashes, that results in a NUL. */
- if (!GA_EMPTY(&line_ga) && pend[-1] == '\n') {
- int bcount = 0;
-
- while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
- ++bcount;
-
- if (bcount > 0) {
- /* Halve the number of backslashes: "\NL" -> "NUL", "\\NL" ->
- * "\NL", etc. */
- line_ga.ga_len -= (bcount + 1) / 2;
- pend -= (bcount + 1) / 2;
- pend[-1] = '\n';
- }
-
- if ((bcount & 1) == 0) {
- --line_ga.ga_len;
- --pend;
- *pend = NUL;
- break;
- }
- }
- }
-
- no_mapping--;
-
- /* make following messages go to the next line */
- msg_didout = FALSE;
- msg_col = 0;
- if (msg_row < Rows - 1) {
- msg_row++;
- }
- emsg_on_display = false; // don't want os_delay()
-
- if (got_int)
- ga_clear(&line_ga);
-
- return (char_u *)line_ga.ga_data;
-}
-
bool cmdline_overstrike(void)
{
return ccline.overstrike;
@@ -6469,7 +6209,7 @@ static int open_cmdwin(void)
char_u typestr[2];
int save_restart_edit = restart_edit;
int save_State = State;
- int save_exmode = exmode_active;
+ bool save_exmode = exmode_active;
int save_cmdmsg_rl = cmdmsg_rl;
/* Can't do this recursively. Can't do it when typing a password. */
@@ -6563,7 +6303,7 @@ static int open_cmdwin(void)
save_cmdline(&save_ccline);
// No Ex mode here!
- exmode_active = 0;
+ exmode_active = false;
State = NORMAL;
setmouse();
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 538ebf7978..b0d06b7a30 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2230,20 +2230,22 @@ static int vgetorpeek(bool advance)
timedout = true;
continue;
}
- /* When 'insertmode' is set, ESC just beeps in Insert
- * mode. Use CTRL-L to make edit() return.
- * For the command line only CTRL-C always breaks it.
- * For the cmdline window: Alternate between ESC and
- * CTRL-C: ESC for most situations and CTRL-C to close the
- * cmdline window. */
- if (p_im && (State & INSERT))
+ // When 'insertmode' is set, ESC just beeps in Insert
+ // mode. Use CTRL-L to make edit() return.
+ // In Ex-mode \n is compatible with original Vim behaviour.
+ // For the command line only CTRL-C always breaks it.
+ // For the cmdline window: Alternate between ESC and
+ // CTRL-C: ESC for most situations and CTRL-C to close the
+ // cmdline window.
+ if (p_im && (State & INSERT)) {
c = Ctrl_L;
- else if ((State & CMDLINE)
- || (cmdwin_type > 0 && tc == ESC)
- )
+ } else if (exmode_active) {
+ c = '\n';
+ } else if ((State & CMDLINE) || (cmdwin_type > 0 && tc == ESC)) {
c = Ctrl_C;
- else
+ } else {
c = ESC;
+ }
tc = c;
break;
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 9fd5ccf324..bbc936cf16 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -239,7 +239,6 @@ EXTERN int did_wait_return INIT(= false); // wait_return() was used and
EXTERN int need_maketitle INIT(= true); // call maketitle() soon
EXTERN int quit_more INIT(= false); // 'q' hit at "--more--" msg
-EXTERN int ex_keep_indent INIT(= false); // getexmodeline(): keep indent
EXTERN int vgetc_busy INIT(= 0); // when inside vgetc() then > 0
EXTERN int didset_vim INIT(= false); // did set $VIM ourselves
@@ -621,7 +620,7 @@ EXTERN long opcount INIT(= 0); // count for pending operator
EXTERN int motion_force INIT(=0); // motion force for pending operator
// Ex Mode (Q) state
-EXTERN int exmode_active INIT(= 0); // Zero, EXMODE_NORMAL or EXMODE_VIM.
+EXTERN bool exmode_active INIT(= false); // true if Ex mode is active
EXTERN int ex_no_reprint INIT(=false); // No need to print after z or p.
EXTERN int reg_recording INIT(= 0); // register for recording or zero
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index 79e474fa2e..29ee7aae56 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -46,7 +46,7 @@ void highlight_init(void)
.id1 = 0, .id2 = 0 }));
}
-/// @return TRUE if hl table was reset
+/// @return true if hl table was reset
bool highlight_use_hlstate(void)
{
if (hlstate_active) {
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 8fa61515ef..c1f9c1e172 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -62,10 +62,10 @@ int get_indent_buf(buf_T *buf, linenr_T lnum)
}
-// Count the size (in window cells) of the indent in line "ptr", with
-// 'tabstop' at "ts".
-// If @param list is TRUE, count only screen size for tabs.
-int get_indent_str(const char_u *ptr, int ts, int list)
+/// Count the size (in window cells) of the indent in line "ptr", with
+/// 'tabstop' at "ts".
+/// If @param list is true, count only screen size for tabs.
+int get_indent_str(const char_u *ptr, int ts, bool list)
FUNC_ATTR_NONNULL_ALL
{
int count = 0;
@@ -91,9 +91,9 @@ int get_indent_str(const char_u *ptr, int ts, int list)
return count;
}
-// Count the size (in window cells) of the indent in line "ptr", using
-// variable tabstops.
-// if "list" is true, count only screen size for tabs.
+/// Count the size (in window cells) of the indent in line "ptr", using
+/// variable tabstops.
+/// if "list" is true, count only screen size for tabs.
int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list)
{
int count = 0;
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 6dacace0a4..277b9ade89 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -543,7 +543,7 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len,
/// Put the character sequence for "key" with "modifiers" into "dst" and return
/// the resulting length.
-/// When "keycode" is TRUE prefer key code, e.g. K_DEL instead of DEL.
+/// When "keycode" is true prefer key code, e.g. K_DEL instead of DEL.
/// The sequence is not NUL terminated.
/// This is how characters in a string are encoded.
unsigned int special_to_buf(int key, int modifiers, bool keycode, char_u *dst)
diff --git a/src/nvim/main.c b/src/nvim/main.c
index cf9cb9cfbd..ed40da5866 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -318,7 +318,8 @@ int main(int argc, char **argv)
debug_break_level = params.use_debug_break_level;
// Read ex-commands if invoked with "-es".
- if (!params.input_isatty && silent_mode && exmode_active == EXMODE_NORMAL) {
+ if (!params.input_isatty && !params.input_neverscript
+ && silent_mode && exmode_active) {
input_start(STDIN_FILENO);
}
@@ -366,19 +367,16 @@ int main(int argc, char **argv)
// Execute --cmd arguments.
exe_pre_commands(&params);
- // If using the runtime (-u is not NONE), enable syntax & filetype plugins.
- bool enable_syntax =
- (params.use_vimrc == NULL || !strequal(params.use_vimrc, "NONE"));
-
- // Source syncolor.vim to set up default UI highlights
- if (enable_syntax) {
- source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL);
- }
-
// Source startup scripts.
source_startup_scripts(&params);
- if (enable_syntax) {
+ // If using the runtime (-u is not NONE), enable syntax & filetype plugins.
+ if (params.use_vimrc == NULL || !strequal(params.use_vimrc, "NONE")) {
+ // Source syncolor.vim to set up default UI highlights if the user didn't
+ // already enable a colorscheme
+ if (!get_var_value("g:colors_name")) {
+ source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL);
+ }
// Does ":filetype plugin indent on".
filetype_maybe_enable();
// Sources syntax/syntax.vim, which calls `:filetype on`.
@@ -772,7 +770,7 @@ static bool edit_stdin(bool explicit, mparm_T *parmp)
{
bool implicit = !headless_mode
&& !embedded_mode
- && exmode_active != EXMODE_NORMAL // -E/-Es but not -e/-es.
+ && (!exmode_active || parmp->input_neverscript)
&& !parmp->input_isatty
&& scriptin[0] == NULL; // `-s -` was not given.
return explicit || implicit;
@@ -915,11 +913,12 @@ static void command_line_scan(mparm_T *parmp)
break;
}
case 'e': { // "-e" Ex mode
- exmode_active = EXMODE_NORMAL;
+ exmode_active = true;
break;
}
case 'E': { // "-E" Ex mode
- exmode_active = EXMODE_VIM;
+ exmode_active = true;
+ parmp->input_neverscript = true;
break;
}
case 'f': { // "-f" GUI: run in foreground.
diff --git a/src/nvim/main.h b/src/nvim/main.h
index 61252f2bce..d387e6d668 100644
--- a/src/nvim/main.h
+++ b/src/nvim/main.h
@@ -30,6 +30,7 @@ typedef struct {
bool input_isatty; // stdin is a terminal
bool output_isatty; // stdout is a terminal
bool err_isatty; // stderr is a terminal
+ bool input_neverscript; // never treat stdin as script (-E/-Es)
int no_swap_file; // "-n" argument used
int use_debug_break_level;
int window_count; // number of windows to use
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 73e3ba53a5..9cd57affb9 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -2354,10 +2354,8 @@ int convert_setup(vimconv_T *vcp, char_u *from, char_u *to)
return convert_setup_ext(vcp, from, true, to, true);
}
-/*
- * As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
- * "from" unicode charsets be considered utf-8. Same for "to".
- */
+/// As convert_setup(), but only when from_unicode_is_utf8 is true will all
+/// "from" unicode charsets be considered utf-8. Same for "to".
int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8,
char_u *to, bool to_unicode_is_utf8)
{
diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h
index 2402d2147d..3eaa7d83e0 100644
--- a/src/nvim/memfile_defs.h
+++ b/src/nvim/memfile_defs.h
@@ -101,7 +101,7 @@ typedef struct memfile {
blocknr_T mf_neg_count; /// number of negative blocks numbers
blocknr_T mf_infile_count; /// number of pages in the file
unsigned mf_page_size; /// number of bytes in a page
- bool mf_dirty; /// TRUE if there are dirty blocks
+ bool mf_dirty; /// true if there are dirty blocks
} memfile_T;
#endif // NVIM_MEMFILE_DEFS_H
diff --git a/src/nvim/message.c b/src/nvim/message.c
index ec5dabbbc0..3ab4ad5287 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1324,9 +1324,8 @@ void msg_start(void)
0;
} else if (msg_didout) { // start message on next line
msg_putchar('\n');
- did_return = TRUE;
- if (exmode_active != EXMODE_NORMAL)
- cmdline_row = msg_row;
+ did_return = true;
+ cmdline_row = msg_row;
}
if (!msg_didany || lines_left < 0)
msg_starthere();
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 38d0a7dadf..19239036fd 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -750,8 +750,8 @@ get_number (
stuffcharReadbuff(':');
if (!exmode_active)
cmdline_row = msg_row;
- skip_redraw = TRUE; /* skip redraw once */
- do_redraw = FALSE;
+ skip_redraw = true; // skip redraw once
+ do_redraw = false;
break;
} else if (c == Ctrl_C || c == ESC || c == 'q') {
n = 0;
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index 4c0339e5f4..f1ad0ed105 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -570,9 +570,8 @@ static linenr_T find_longest_lnum(void)
return ret;
}
-///
-/// Do a horizontal scroll. Return TRUE if the cursor moved, FALSE otherwise.
-///
+/// Do a horizontal scroll.
+/// @return true if the cursor moved, false otherwise.
bool mouse_scroll_horiz(int dir)
{
if (curwin->w_p_wrap) {
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 74a3d74860..4213e6f946 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1188,7 +1188,7 @@ static void normal_check_interrupt(NormalState *s)
&& s->previous_got_int) {
// Typed two CTRL-C in a row: go back to ex mode as if "Q" was
// used and keep "got_int" set, so that it aborts ":g".
- exmode_active = EXMODE_NORMAL;
+ exmode_active = true;
State = NORMAL;
} else if (!global_busy || !exmode_active) {
if (!quit_more) {
@@ -1340,7 +1340,7 @@ static int normal_check(VimState *state)
quit_more = false;
// If skip redraw is set (for ":" in wait_return()), don't redraw now.
- // If there is nothing in the stuff_buffer or do_redraw is TRUE,
+ // If there is nothing in the stuff_buffer or do_redraw is true,
// update cursor and redraw.
if (skip_redraw || exmode_active) {
skip_redraw = false;
@@ -1398,7 +1398,7 @@ static int normal_check(VimState *state)
if (s->noexmode) {
return 0;
}
- do_exmode(exmode_active == EXMODE_VIM);
+ do_exmode();
return -1;
}
@@ -4652,7 +4652,7 @@ static void nv_exmode(cmdarg_T *cap)
if (VIsual_active) {
vim_beep(BO_EX);
} else if (!checkclearop(cap->oap)) {
- do_exmode(false);
+ do_exmode();
}
}
@@ -7101,8 +7101,9 @@ static void nv_g_cmd(cmdarg_T *cap)
break;
}
- if (!checkclearopq(oap))
- do_exmode(true);
+ if (!checkclearopq(oap)) {
+ do_exmode();
+ }
break;
case ',':
@@ -8146,10 +8147,8 @@ static void nv_event(cmdarg_T *cap)
}
}
-/*
- * Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos".
- */
-static int mouse_model_popup(void)
+/// @return true when 'mousemodel' is set to "popup" or "popup_setpos".
+static bool mouse_model_popup(void)
{
return p_mousem[0] == 'p';
}
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 0a556390e7..5e40bdd6ef 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -459,7 +459,6 @@ EXTERN char_u *p_pmcs; // 'printmbcharset'
EXTERN char_u *p_pfn; // 'printfont'
EXTERN char_u *p_popt; // 'printoptions'
EXTERN char_u *p_header; // 'printheader'
-EXTERN int p_prompt; // 'prompt'
EXTERN char_u *p_guicursor; // 'guicursor'
EXTERN char_u *p_guifont; // 'guifont'
EXTERN char_u *p_guifontwide; // 'guifontwide'
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 48e53c68f3..0830fb4638 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -1800,7 +1800,7 @@ return {
full_name='prompt',
short_desc=N_("enable prompt in Ex mode"),
type='bool', scope={'global'},
- varname='p_prompt',
+ varname='p_force_on',
defaults={if_true={vi=true}}
},
{
diff --git a/src/nvim/search.h b/src/nvim/search.h
index 98ddaa5eeb..0dbaf79c37 100644
--- a/src/nvim/search.h
+++ b/src/nvim/search.h
@@ -88,7 +88,7 @@ typedef struct searchstat
{
int cur; // current position of found words
int cnt; // total count of found words
- int exact_match; // TRUE if matched exactly on specified position
+ bool exact_match; // true if matched exactly on specified position
int incomplete; // 0: search was fully completed
// 1: recomputing was timed out
// 2: max count exceeded
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index d884ae62f4..c6f59b42b8 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -115,10 +115,10 @@ static void sign_group_unref(char_u *groupname)
}
}
-/// Returns TRUE if 'sign' is in 'group'.
+/// @return true if 'sign' is in 'group'.
/// A sign can either be in the global group (sign->group == NULL)
/// or in a named group. If 'group' is '*', then the sign is part of the group.
-int sign_in_group(sign_entry_T *sign, const char_u *group)
+bool sign_in_group(sign_entry_T *sign, const char_u *group)
{
return ((group != NULL && STRCMP(group, "*") == 0)
|| (group == NULL && sign->se_group == NULL)
diff --git a/src/nvim/state.c b/src/nvim/state.c
index a3c74789d1..437cb0db47 100644
--- a/src/nvim/state.c
+++ b/src/nvim/state.c
@@ -171,12 +171,10 @@ char *get_mode(void)
buf[1] = 'x';
}
}
- } else if ((State & CMDLINE) || exmode_active) {
+ } else if (State & CMDLINE) {
buf[0] = 'c';
- if (exmode_active == EXMODE_VIM) {
+ if (exmode_active) {
buf[1] = 'v';
- } else if (exmode_active == EXMODE_NORMAL) {
- buf[1] = 'e';
}
} else if (State & TERM_FOCUS) {
buf[0] = 't';
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 70d39339c3..dcc086a0cf 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1123,10 +1123,9 @@ static void tui_mode_change(UI *ui, String mode, Integer mode_idx)
data->showing_mode = (ModeShape)mode_idx;
}
-static void tui_grid_scroll(UI *ui, Integer g, Integer startrow, Integer endrow,
- Integer startcol, Integer endcol,
- Integer rows,
- Integer cols FUNC_ATTR_UNUSED) // -V751
+static void tui_grid_scroll(UI *ui, Integer g, Integer startrow, // -V751
+ Integer endrow, Integer startcol, Integer endcol,
+ Integer rows, Integer cols FUNC_ATTR_UNUSED)
{
TUIData *data = ui->data;
UGrid *grid = &data->grid;
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index d2f9148e8f..d9df5fbc0d 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -646,6 +646,19 @@ int x = INT_MAX;
{2, 29, 2, 68} -- READ_STRING_OK(x, y) (char_u *)read_string((x), (size_t)(y))
}, get_ranges())
end)
+ it("should list all directives", function()
+ local res_list = exec_lua[[
+ local query = require'vim.treesitter.query'
+
+ local list = query.list_directives()
+
+ table.sort(list)
+
+ return list
+ ]]
+
+ eq({ 'offset!', 'set!' }, res_list)
+ end)
end)
end)