aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/notes.md14
-rw-r--r--cmake.deps/CMakeLists.txt4
-rw-r--r--cmake.deps/cmake/BuildLuarocks.cmake21
-rw-r--r--runtime/doc/api.txt14
-rw-r--r--runtime/doc/deprecated.txt2
-rw-r--r--runtime/lua/vim/_meta.lua20
-rw-r--r--runtime/lua/vim/treesitter.lua30
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua18
-rw-r--r--runtime/lua/vim/treesitter/language.lua4
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua22
-rw-r--r--runtime/lua/vim/treesitter/query.lua8
-rw-r--r--src/nvim/api/extmark.c14
-rw-r--r--src/nvim/api/options.c2
-rw-r--r--src/nvim/arglist.c2
-rw-r--r--src/nvim/buffer.c4
-rw-r--r--src/nvim/digraph.c6
-rw-r--r--src/nvim/eval.c16
-rw-r--r--src/nvim/eval/funcs.c10
-rw-r--r--src/nvim/eval/typval.c22
-rw-r--r--src/nvim/eval/userfunc.c16
-rw-r--r--src/nvim/eval/vars.c6
-rw-r--r--src/nvim/eval/window.c4
-rw-r--r--src/nvim/ex_docmd.c10
-rw-r--r--src/nvim/ex_eval.c2
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/file_search.c2
-rw-r--r--src/nvim/fileio.c4
-rw-r--r--src/nvim/fold.c2
-rw-r--r--src/nvim/gettext.h4
-rw-r--r--src/nvim/globals.h302
-rw-r--r--src/nvim/insexpand.c10
-rw-r--r--src/nvim/match.c2
-rw-r--r--src/nvim/mbyte.c12
-rw-r--r--src/nvim/menu.c4
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c2
-rw-r--r--src/nvim/option.c44
-rw-r--r--src/nvim/optionstr.c152
-rw-r--r--src/nvim/quickfix.c12
-rw-r--r--src/nvim/regexp.c30
-rw-r--r--src/nvim/regexp_nfa.c14
-rw-r--r--src/nvim/spell.c6
-rw-r--r--src/nvim/spellfile.c10
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/tag.c12
-rw-r--r--src/nvim/testing.c10
-rw-r--r--src/nvim/undo.c2
-rw-r--r--src/nvim/usercmd.c6
-rw-r--r--src/nvim/window.c4
-rw-r--r--test/functional/lua/fs_spec.lua9
-rw-r--r--test/functional/lua/vim_spec.lua44
-rw-r--r--test/functional/terminal/scrollback_spec.lua19
-rw-r--r--test/functional/treesitter/parser_spec.lua44
-rw-r--r--test/functional/ui/decorations_spec.lua52
-rw-r--r--test/functional/ui/float_spec.lua12
55 files changed, 584 insertions, 521 deletions
diff --git a/.github/workflows/notes.md b/.github/workflows/notes.md
index 0f8c67da48..2b34c72ffa 100644
--- a/.github/workflows/notes.md
+++ b/.github/workflows/notes.md
@@ -27,12 +27,6 @@ ${NVIM_VERSION}
### Linux (x64)
-#### Tarball
-
-1. Download **nvim-linux64.tar.gz**
-2. Extract: `tar xzvf nvim-linux64.tar.gz`
-3. Run `./nvim-linux64/bin/nvim`
-
#### AppImage
1. Download **nvim.appimage**
2. Run `chmod u+x nvim.appimage && ./nvim.appimage`
@@ -42,6 +36,14 @@ ${NVIM_VERSION}
./squashfs-root/usr/bin/nvim
```
+#### Tarball
+
+*(deprecated)*
+
+1. Download **nvim-linux64.tar.gz**
+2. Extract: `tar xzvf nvim-linux64.tar.gz`
+3. Run `./nvim-linux64/bin/nvim`
+
### Other
- Install by [package manager](https://github.com/neovim/neovim/wiki/Installing-Neovim)
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
index fb639e4801..e9314ffe02 100644
--- a/cmake.deps/CMakeLists.txt
+++ b/cmake.deps/CMakeLists.txt
@@ -189,8 +189,8 @@ set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.
set(TREESITTER_C_SHA256 af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2 )
set(TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.14.tar.gz)
set(TREESITTER_LUA_SHA256 930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8023395016d)
-set(TREESITTER_VIM_URL https://github.com/vigoux/tree-sitter-viml/archive/e39a7bbcfdcfc7900629962b785c7e14503ae590.tar.gz)
-set(TREESITTER_VIM_SHA256 7ca85fa1a5a9e4d057ff3b7ae53d13d31371973e734ada87a83f3f6cbe9c0e32)
+set(TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz)
+set(TREESITTER_VIM_SHA256 403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2)
set(TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz)
set(TREESITTER_VIMDOC_SHA256 1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274)
set(TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz)
diff --git a/cmake.deps/cmake/BuildLuarocks.cmake b/cmake.deps/cmake/BuildLuarocks.cmake
index 9998f55fcc..901d1f17da 100644
--- a/cmake.deps/cmake/BuildLuarocks.cmake
+++ b/cmake.deps/cmake/BuildLuarocks.cmake
@@ -13,9 +13,6 @@ if(NOT MSVC)
# In MSVC don't pass the compiler/linker to luarocks, the bundled
# version already knows, and passing them here breaks the build
set(LUAROCKS_BUILDARGS CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER})
-else()
- # Workaround for luarocks failing to find the md5sum.exe it is shipped with.
- set(LUAROCKS_BUILDARGS MD5SUM=md5sum)
endif()
# Lua version, used with rocks directories.
@@ -101,22 +98,28 @@ elseif(USE_BUNDLED_LUA)
endif()
set(ROCKS_DIR ${DEPS_LIB_DIR}/luarocks/rocks-${LUA_VERSION})
+if(MSVC)
+ # Workaround for luarocks failing to find the md5sum.exe it is shipped with.
+ list(APPEND LUAROCKS_BUILDARGS MD5SUM=md5sum)
+ set(PATH PATH=${DEPS_INSTALL_DIR}/luarocks/tools;$ENV{PATH})
+endif()
+
# mpack
add_custom_command(OUTPUT ${ROCKS_DIR}/mpack
- COMMAND ${LUAROCKS_BINARY} build mpack 1.0.10-0 ${LUAROCKS_BUILDARGS}
+ COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build mpack 1.0.10-0 ${LUAROCKS_BUILDARGS}
DEPENDS luarocks)
add_custom_target(mpack ALL DEPENDS ${ROCKS_DIR}/mpack)
# lpeg
add_custom_command(OUTPUT ${ROCKS_DIR}/lpeg
- COMMAND ${LUAROCKS_BINARY} build lpeg 1.0.2-1 ${LUAROCKS_BUILDARGS}
+ COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build lpeg 1.0.2-1 ${LUAROCKS_BUILDARGS}
DEPENDS mpack)
add_custom_target(lpeg ALL DEPENDS ${ROCKS_DIR}/lpeg)
if((NOT USE_BUNDLED_LUAJIT) AND USE_BUNDLED_LUA)
# luabitop
add_custom_command(OUTPUT ${ROCKS_DIR}/luabitop
- COMMAND ${LUAROCKS_BINARY} build luabitop 1.0.2-3 ${LUAROCKS_BUILDARGS}
+ COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build luabitop 1.0.2-3 ${LUAROCKS_BUILDARGS}
DEPENDS lpeg)
add_custom_target(luabitop ALL DEPENDS ${ROCKS_DIR}/luabitop)
endif()
@@ -137,20 +140,20 @@ if(USE_BUNDLED_BUSTED)
set(LUACHECK_EXE "${DEPS_BIN_DIR}/luacheck")
endif()
add_custom_command(OUTPUT ${BUSTED_EXE}
- COMMAND ${LUAROCKS_BINARY} build busted 2.1.1 ${LUAROCKS_BUILDARGS}
+ COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build busted 2.1.1 ${LUAROCKS_BUILDARGS}
DEPENDS ${BUSTED_DEPENDS})
add_custom_target(busted ALL DEPENDS ${BUSTED_EXE})
# luacheck
add_custom_command(OUTPUT ${LUACHECK_EXE}
- COMMAND ${LUAROCKS_BINARY} build luacheck 1.1.0-1 ${LUAROCKS_BUILDARGS}
+ COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build luacheck 1.1.0-1 ${LUAROCKS_BUILDARGS}
DEPENDS busted)
add_custom_target(luacheck ALL DEPENDS ${LUACHECK_EXE})
if (USE_BUNDLED_LUA OR NOT USE_BUNDLED_LUAJIT)
# coxpcall
add_custom_command(OUTPUT ${ROCKS_DIR}/coxpcall
- COMMAND ${LUAROCKS_BINARY} build coxpcall 1.17.0-1 ${LUAROCKS_BUILDARGS}
+ COMMAND ${CMAKE_COMMAND} -E env "${PATH}" ${LUAROCKS_BINARY} build coxpcall 1.17.0-1 ${LUAROCKS_BUILDARGS}
DEPENDS luarocks)
add_custom_target(coxpcall ALL DEPENDS ${ROCKS_DIR}/coxpcall)
endif()
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 46816856b9..52c3f7fa97 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -2570,17 +2570,17 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
`limit`, to get the first marks prior to a given position.)
Example: >lua
- local a = vim.api
- local pos = a.nvim_win_get_cursor(0)
- local ns = a.nvim_create_namespace('my-plugin')
+ local api = vim.api
+ local pos = api.nvim_win_get_cursor(0)
+ local ns = api.nvim_create_namespace('my-plugin')
-- Create new extmark at line 1, column 1.
- local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, {})
+ local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
-- Create new extmark at line 3, column 1.
- local m2 = a.nvim_buf_set_extmark(0, ns, 2, 0, {})
+ local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
-- Get extmarks only from line 3.
- local ms = a.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.
- local all = a.nvim_buf_get_extmarks(0, ns, 0, -1, {})
+ local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
print(vim.inspect(ms))
<
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 3eb2017bed..3735073867 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -130,6 +130,8 @@ TREESITTER FUNCTIONS
instead.
- *vim.treesitter.get_node_at_cursor()* Use |vim.treesitter.get_node()|
and |TSNode:type()| instead.
+- *vim.treesitter.query.get_query()* Use |vim.treesitter.query.get()|
+ instead.
LUA
- vim.register_keystroke_callback() Use |vim.on_key()| instead.
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index 104f29c4c0..e3ad4d76c9 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -1,4 +1,4 @@
-local a = vim.api
+local api = vim.api
-- TODO(tjdevries): Improve option metadata so that this doesn't have to be hardcoded.
-- Can be done in a separate PR.
@@ -30,7 +30,7 @@ end
local options_info = setmetatable({}, {
__index = function(t, k)
- local info = a.nvim_get_option_info(k)
+ local info = api.nvim_get_option_info(k)
info.metatype = get_option_metatype(k, info)
rawset(t, k, info)
return rawget(t, k)
@@ -74,12 +74,12 @@ local function new_opt_accessor(handle, scope)
return new_opt_accessor(k, scope)
end
opt_validate(k, scope)
- return a.nvim_get_option_value(k, { [scope] = handle or 0 })
+ return api.nvim_get_option_value(k, { [scope] = handle or 0 })
end,
__newindex = function(_, k, v)
opt_validate(k, scope)
- return a.nvim_set_option_value(k, v, { [scope] = handle or 0 })
+ return api.nvim_set_option_value(k, v, { [scope] = handle or 0 })
end,
})
end
@@ -91,10 +91,10 @@ vim.wo = new_opt_accessor(nil, 'win')
-- this ONLY sets the global option. like `setglobal`
vim.go = setmetatable({}, {
__index = function(_, k)
- return a.nvim_get_option_value(k, { scope = 'global' })
+ return api.nvim_get_option_value(k, { scope = 'global' })
end,
__newindex = function(_, k, v)
- return a.nvim_set_option_value(k, v, { scope = 'global' })
+ return api.nvim_set_option_value(k, v, { scope = 'global' })
end,
})
@@ -102,10 +102,10 @@ vim.go = setmetatable({}, {
-- it has no additional metamethod magic.
vim.o = setmetatable({}, {
__index = function(_, k)
- return a.nvim_get_option_value(k, {})
+ return api.nvim_get_option_value(k, {})
end,
__newindex = function(_, k, v)
- return a.nvim_set_option_value(k, v, {})
+ return api.nvim_set_option_value(k, v, {})
end,
})
@@ -488,7 +488,7 @@ local function create_option_accessor(scope)
-- opt[my_option] = value
_set = function(self)
local value = convert_value_to_vim(self._name, self._info, self._value)
- a.nvim_set_option_value(self._name, value, { scope = scope })
+ api.nvim_set_option_value(self._name, value, { scope = scope })
end,
get = function(self)
@@ -526,7 +526,7 @@ local function create_option_accessor(scope)
return setmetatable({}, {
__index = function(_, k)
- return make_option(k, a.nvim_get_option_value(k, {}))
+ return make_option(k, api.nvim_get_option_value(k, {}))
end,
__newindex = function(_, k, v)
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 092fdf0ae2..d1f5996768 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -1,4 +1,4 @@
-local a = vim.api
+local api = vim.api
local LanguageTree = require('vim.treesitter.languagetree')
local Range = require('vim.treesitter._range')
@@ -80,7 +80,7 @@ function M._create_parser(bufnr, lang, opts)
local source = self:source() --[[@as integer]]
- a.nvim_buf_attach(
+ api.nvim_buf_attach(
source,
false,
{ on_bytes = bytes_cb, on_detach = detach_cb, on_reload = reload_cb, preview = true }
@@ -109,7 +109,7 @@ function M.get_parser(bufnr, lang, opts)
opts = opts or {}
if bufnr == nil or bufnr == 0 then
- bufnr = a.nvim_get_current_buf()
+ bufnr = api.nvim_get_current_buf()
end
if not valid_lang(lang) then
@@ -141,7 +141,7 @@ end
---@return boolean
function M._has_parser(bufnr)
if bufnr == nil or bufnr == 0 then
- bufnr = a.nvim_get_current_buf()
+ bufnr = api.nvim_get_current_buf()
end
return parsers[bufnr] ~= nil
end
@@ -229,7 +229,7 @@ local function buf_range_get_text(buf, range)
end_col = -1
end_row = end_row - 1
end
- local lines = a.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col, {})
+ local lines = api.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col, {})
return table.concat(lines, '\n')
end
@@ -294,7 +294,7 @@ end
---@return table[] List of captures `{ capture = "name", metadata = { ... } }`
function M.get_captures_at_pos(bufnr, row, col)
if bufnr == 0 then
- bufnr = a.nvim_get_current_buf()
+ bufnr = api.nvim_get_current_buf()
end
local buf_highlighter = M.highlighter.active[bufnr]
@@ -345,8 +345,8 @@ end
---@return string[] List of capture names
function M.get_captures_at_cursor(winnr)
winnr = winnr or 0
- local bufnr = a.nvim_win_get_buf(winnr)
- local cursor = a.nvim_win_get_cursor(winnr)
+ local bufnr = api.nvim_win_get_buf(winnr)
+ local cursor = api.nvim_win_get_cursor(winnr)
local data = M.get_captures_at_pos(bufnr, cursor[1] - 1, cursor[2])
@@ -374,7 +374,7 @@ function M.get_node(opts)
local bufnr = opts.bufnr
if not bufnr or bufnr == 0 then
- bufnr = a.nvim_get_current_buf()
+ bufnr = api.nvim_get_current_buf()
end
local row, col
@@ -383,10 +383,10 @@ function M.get_node(opts)
row, col = opts.pos[1], opts.pos[2]
else
assert(
- bufnr == a.nvim_get_current_buf(),
+ bufnr == api.nvim_get_current_buf(),
'Position must be explicitly provided when not using the current buffer'
)
- local pos = a.nvim_win_get_cursor(0)
+ local pos = api.nvim_win_get_cursor(0)
-- Subtract one to account for 1-based row indexing in nvim_win_get_cursor
row, col = pos[1] - 1, pos[2]
end
@@ -417,7 +417,7 @@ end
function M.get_node_at_pos(bufnr, row, col, opts)
vim.deprecate('vim.treesitter.get_node_at_pos()', 'vim.treesitter.get_node()', '0.10')
if bufnr == 0 then
- bufnr = a.nvim_get_current_buf()
+ bufnr = api.nvim_get_current_buf()
end
local ts_range = { row, col, row, col }
@@ -440,7 +440,7 @@ end
function M.get_node_at_cursor(winnr)
vim.deprecate('vim.treesitter.get_node_at_cursor()', 'vim.treesitter.get_node():type()', '0.10')
winnr = winnr or 0
- local bufnr = a.nvim_win_get_buf(winnr)
+ local bufnr = api.nvim_win_get_buf(winnr)
return M.get_node({ bufnr = bufnr, ignore_injections = false }):type()
end
@@ -465,7 +465,7 @@ end
---@param bufnr (integer|nil) Buffer to be highlighted (default: current buffer)
---@param lang (string|nil) Language of the parser (default: buffer filetype)
function M.start(bufnr, lang)
- bufnr = bufnr or a.nvim_get_current_buf()
+ bufnr = bufnr or api.nvim_get_current_buf()
local parser = M.get_parser(bufnr, lang)
M.highlighter.new(parser)
end
@@ -474,7 +474,7 @@ end
---
---@param bufnr (integer|nil) Buffer to stop highlighting (default: current buffer)
function M.stop(bufnr)
- bufnr = bufnr or a.nvim_get_current_buf()
+ bufnr = bufnr or api.nvim_get_current_buf()
if M.highlighter.active[bufnr] then
M.highlighter.active[bufnr]:destroy()
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index d3cc1b698c..ac2a929487 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -1,4 +1,4 @@
-local a = vim.api
+local api = vim.api
local query = vim.treesitter.query
---@alias TSHlIter fun(): integer, TSNode, TSMetadata
@@ -25,7 +25,7 @@ TSHighlighter.active = TSHighlighter.active or {}
local TSHighlighterQuery = {}
TSHighlighterQuery.__index = TSHighlighterQuery
-local ns = a.nvim_create_namespace('treesitter/highlighter')
+local ns = api.nvim_create_namespace('treesitter/highlighter')
---@private
function TSHighlighterQuery.new(lang, query_string)
@@ -36,7 +36,7 @@ function TSHighlighterQuery.new(lang, query_string)
local name = self._query.captures[capture]
local id = 0
if not vim.startswith(name, '_') then
- id = a.nvim_get_hl_id_by_name('@' .. name .. '.' .. lang)
+ id = api.nvim_get_hl_id_by_name('@' .. name .. '.' .. lang)
end
rawset(table, capture, id)
@@ -121,7 +121,7 @@ function TSHighlighter.new(tree, opts)
vim.cmd.runtime({ 'syntax/synload.vim', bang = true })
end
- a.nvim_buf_call(self.bufnr, function()
+ api.nvim_buf_call(self.bufnr, function()
vim.opt_local.spelloptions:append('noplainbuffer')
end)
@@ -140,7 +140,7 @@ function TSHighlighter:destroy()
vim.bo[self.bufnr].spelloptions = self.orig_spelloptions
vim.b[self.bufnr].ts_highlight = nil
if vim.g.syntax_on == 1 then
- a.nvim_exec_autocmds('FileType', { group = 'syntaxset', buffer = self.bufnr })
+ api.nvim_exec_autocmds('FileType', { group = 'syntaxset', buffer = self.bufnr })
end
end
end
@@ -168,7 +168,7 @@ end
---@param start_row integer
---@param new_end integer
function TSHighlighter:on_bytes(_, _, start_row, _, _, _, _, _, new_end)
- a.nvim__buf_redraw_range(self.bufnr, start_row, start_row + new_end + 1)
+ api.nvim__buf_redraw_range(self.bufnr, start_row, start_row + new_end + 1)
end
---@package
@@ -180,7 +180,7 @@ end
---@param changes integer[][]?
function TSHighlighter:on_changedtree(changes)
for _, ch in ipairs(changes or {}) do
- a.nvim__buf_redraw_range(self.bufnr, ch[1], ch[3] + 1)
+ api.nvim__buf_redraw_range(self.bufnr, ch[1], ch[3] + 1)
end
end
@@ -252,7 +252,7 @@ local function on_line_impl(self, buf, line, is_spell_nav)
local spell_pri_offset = capture_name == 'nospell' and 1 or 0
if hl and end_row >= line and (not is_spell_nav or spell ~= nil) then
- a.nvim_buf_set_extmark(buf, ns, start_row, start_col, {
+ api.nvim_buf_set_extmark(buf, ns, start_row, start_col, {
end_line = end_row,
end_col = end_col,
hl_group = hl,
@@ -323,7 +323,7 @@ function TSHighlighter._on_win(_, _win, buf, _topline)
return true
end
-a.nvim_set_decoration_provider(ns, {
+api.nvim_set_decoration_provider(ns, {
on_buf = TSHighlighter._on_buf,
on_win = TSHighlighter._on_win,
on_line = TSHighlighter._on_line,
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index 5b74bb6200..b616d4d70b 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -1,4 +1,4 @@
-local a = vim.api
+local api = vim.api
---@class TSLanguageModule
local M = {}
@@ -89,7 +89,7 @@ function M.add(lang, opts)
end
local fname = 'parser/' .. lang .. '.*'
- local paths = a.nvim_get_runtime_file(fname, false)
+ local paths = api.nvim_get_runtime_file(fname, false)
if #paths == 0 then
error("no parser for '" .. lang .. "' language, see :help treesitter-parsers")
end
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index cf0ecbd839..4aa07d1b96 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -32,7 +32,7 @@
--- a plugin that does any kind of analysis on a tree should use a timer to throttle too frequent
--- updates.
-local a = vim.api
+local api = vim.api
local query = require('vim.treesitter.query')
local language = require('vim.treesitter.language')
local Range = require('vim.treesitter._range')
@@ -57,6 +57,7 @@ local Range = require('vim.treesitter._range')
---@field private _injection_query Query Queries defining injected languages
---@field private _opts table Options
---@field private _parser TSParser Parser for language
+---@field private _has_regions boolean
---@field private _regions Range6[][]?
---List of regions this tree should manage and parse. If nil then regions are
---taken from _trees. This is mostly a short-lived cache for included_regions()
@@ -141,16 +142,16 @@ function LanguageTree:_log(...)
local prefix =
string.format('%s:%d: [%s:%d] ', info.name, info.currentline, self:lang(), nregions)
- a.nvim_out_write(prefix)
+ api.nvim_out_write(prefix)
for _, x in ipairs(args) do
if type(x) == 'string' then
- a.nvim_out_write(x)
+ api.nvim_out_write(x)
else
- a.nvim_out_write(vim.inspect(x, { newline = ' ', indent = '' }))
+ api.nvim_out_write(vim.inspect(x, { newline = ' ', indent = '' }))
end
- a.nvim_out_write(' ')
+ api.nvim_out_write(' ')
end
- a.nvim_out_write('\n')
+ api.nvim_out_write('\n')
end
--- Invalidates this parser and all its children
@@ -440,6 +441,8 @@ end
---@private
---@param new_regions Range6[][] List of regions this tree should manage and parse.
function LanguageTree:set_included_regions(new_regions)
+ self._has_regions = true
+
-- Transform the tables from 4 element long to 6 element long (with byte offset)
for _, region in ipairs(new_regions) do
for i, range in ipairs(region) do
@@ -468,7 +471,8 @@ function LanguageTree:included_regions()
return self._regions
end
- if #self._trees == 0 then
+ if not self._has_regions or #self._trees == 0 then
+ -- treesitter.c will default empty ranges to { -1, -1, -1, -1, -1, -1}
return { {} }
end
@@ -744,6 +748,10 @@ function LanguageTree:_edit(
-- Validate regions after editing the tree
self:_iter_regions(function(_, region)
+ if #region == 0 then
+ -- empty region, use the full source
+ return false
+ end
for _, r in ipairs(region) do
if Range.intercepts(r, changed_range) then
return false
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 25623c1498..5b87e6ac31 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -1,4 +1,4 @@
-local a = vim.api
+local api = vim.api
local language = require('vim.treesitter.language')
---@class Query
@@ -74,7 +74,7 @@ end
---@return string[] query_files List of files to load for given query and language
function M.get_files(lang, query_name, is_included)
local query_path = string.format('queries/%s/%s.scm', lang, query_name)
- local lang_files = dedupe_files(a.nvim_get_runtime_file(query_path, true))
+ local lang_files = dedupe_files(api.nvim_get_runtime_file(query_path, true))
if #lang_files == 0 then
return {}
@@ -635,7 +635,7 @@ end
---@return (fun(): integer, TSNode, TSMetadata): capture id, capture node, metadata
function Query:iter_captures(node, source, start, stop)
if type(source) == 'number' and source == 0 then
- source = vim.api.nvim_get_current_buf()
+ source = api.nvim_get_current_buf()
end
start, stop = value_or_node_range(start, stop, node)
@@ -690,7 +690,7 @@ end
---@return (fun(): integer, table<integer,TSNode>, table): pattern id, match, metadata
function Query:iter_matches(node, source, start, stop)
if type(source) == 'number' and source == 0 then
- source = vim.api.nvim_get_current_buf()
+ source = api.nvim_get_current_buf()
end
start, stop = value_or_node_range(start, stop, node)
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 4afbdfa487..fc17b9d0cc 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -311,17 +311,17 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
///
/// Example:
/// <pre>lua
-/// local a = vim.api
-/// local pos = a.nvim_win_get_cursor(0)
-/// local ns = a.nvim_create_namespace('my-plugin')
+/// local api = vim.api
+/// local pos = api.nvim_win_get_cursor(0)
+/// local ns = api.nvim_create_namespace('my-plugin')
/// -- Create new extmark at line 1, column 1.
-/// local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, {})
+/// local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
/// -- Create new extmark at line 3, column 1.
-/// local m2 = a.nvim_buf_set_extmark(0, ns, 2, 0, {})
+/// local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
/// -- Get extmarks only from line 3.
-/// local ms = a.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.
-/// local all = a.nvim_buf_get_extmarks(0, ns, 0, -1, {})
+/// local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
/// print(vim.inspect(ms))
/// </pre>
///
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index 3e6466626f..467a4720a6 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -559,7 +559,7 @@ static getoption_T access_option_value(char *key, long *numval, char **stringval
if (get) {
return get_option_value(key, numval, stringval, NULL, opt_flags);
} else {
- char *errmsg;
+ const char *errmsg;
if ((errmsg = set_option_value(key, *numval, *stringval, opt_flags))) {
if (try_end(err)) {
return 0;
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 3882b98c2c..537b56353e 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -63,7 +63,7 @@ typedef struct {
# include "arglist.c.generated.h"
#endif
-static char e_cannot_change_arglist_recursively[]
+static const char e_cannot_change_arglist_recursively[]
= N_("E1156: Cannot change the argument list recursively");
enum {
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index cedbadbaf3..fb674774c6 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -106,8 +106,8 @@
# include "buffer.c.generated.h"
#endif
-static char *e_auabort = N_("E855: Autocommands caused command to abort");
-static char e_attempt_to_delete_buffer_that_is_in_use_str[]
+static const char *e_auabort = N_("E855: Autocommands caused command to abort");
+static const char e_attempt_to_delete_buffer_that_is_in_use_str[]
= N_("E937: Attempt to delete a buffer that is in use: %s");
// Number of times free_buffer() was called.
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 2066151564..7d6349e552 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -47,11 +47,11 @@ typedef struct digraph {
result_T result;
} digr_T;
-static char e_digraph_must_be_just_two_characters_str[]
+static const char e_digraph_must_be_just_two_characters_str[]
= N_("E1214: Digraph must be just two characters: %s");
-static char e_digraph_argument_must_be_one_character_str[]
+static const char e_digraph_argument_must_be_one_character_str[]
= N_("E1215: Digraph must be one character: %s");
-static char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
+static const char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
= N_("E1216: digraph_setlist() argument must be a list of lists with two items");
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index edaa2bb809..16a2dfa39b 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -86,15 +86,15 @@
#define DICT_MAXNEST 100 // maximum nesting of lists and dicts
-static char *e_missbrac = N_("E111: Missing ']'");
-static char *e_list_end = N_("E697: Missing end of List ']': %s");
-static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
-static char *e_nowhitespace
+static const char *e_missbrac = N_("E111: Missing ']'");
+static const char *e_list_end = N_("E697: Missing end of List ']': %s");
+static const char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
+static const char *e_nowhitespace
= N_("E274: No white space allowed before parenthesis");
-static char *e_write2 = N_("E80: Error while writing: %s");
-static char *e_string_list_or_blob_required = N_("E1098: String, List or Blob required");
-static char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s");
-static char e_dot_can_only_be_used_on_dictionary_str[]
+static const char *e_write2 = N_("E80: Error while writing: %s");
+static const char *e_string_list_or_blob_required = N_("E1098: String, List or Blob required");
+static const char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s");
+static const char e_dot_can_only_be_used_on_dictionary_str[]
= N_("E1203: Dot can only be used on a dictionary: %s");
static char * const namespace_char = "abglstvw";
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 4286e16eb1..4225e164e4 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -145,10 +145,10 @@ PRAGMA_DIAG_POP
PRAGMA_DIAG_POP
#endif
-static char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob");
-static char *e_invalwindow = N_("E957: Invalid window number");
-static char *e_reduceempty = N_("E998: Reduce of an empty %s with no initial value");
-static char e_using_number_as_bool_nr[]
+static const char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob");
+static const char *e_invalwindow = N_("E957: Invalid window number");
+static const char *e_reduceempty = N_("E998: Reduce of an empty %s with no initial value");
+static const char e_using_number_as_bool_nr[]
= N_("E1023: Using a Number as a Bool: %d");
/// Dummy va_list for passing to vim_snprintf
@@ -7557,7 +7557,7 @@ free_lstval:
/// "settagstack()" function
static void f_settagstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
- static char *e_invact2 = N_("E962: Invalid action: '%s'");
+ static const char *e_invact2 = N_("E962: Invalid action: '%s'");
char action = 'r';
rettv->vval.v_number = -1;
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index d077998dae..8e5db64d6a 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -40,25 +40,25 @@
# include "eval/typval.c.generated.h"
#endif
-static char e_string_required_for_argument_nr[]
+static const char e_string_required_for_argument_nr[]
= N_("E1174: String required for argument %d");
-static char e_non_empty_string_required_for_argument_nr[]
+static const char e_non_empty_string_required_for_argument_nr[]
= N_("E1175: Non-empty string required for argument %d");
-static char e_dict_required_for_argument_nr[]
+static const char e_dict_required_for_argument_nr[]
= N_("E1206: Dictionary required for argument %d");
-static char e_number_required_for_argument_nr[]
+static const char e_number_required_for_argument_nr[]
= N_("E1210: Number required for argument %d");
-static char e_list_required_for_argument_nr[]
+static const char e_list_required_for_argument_nr[]
= N_("E1211: List required for argument %d");
-static char e_string_or_list_required_for_argument_nr[]
+static const char e_string_or_list_required_for_argument_nr[]
= N_("E1222: String or List required for argument %d");
-static char e_list_or_blob_required_for_argument_nr[]
+static const char e_list_or_blob_required_for_argument_nr[]
= N_("E1226: List or Blob required for argument %d");
-static char e_blob_required_for_argument_nr[]
+static const char e_blob_required_for_argument_nr[]
= N_("E1238: Blob required for argument %d");
-static char e_invalid_value_for_blob_nr[]
+static const char e_invalid_value_for_blob_nr[]
= N_("E1239: Invalid value for blob: %d");
-static char e_string_or_function_required_for_argument_nr[]
+static const char e_string_or_function_required_for_argument_nr[]
= N_("E1256: String or function required for argument %d");
bool tv_in_free_unref_items = false;
@@ -2868,7 +2868,7 @@ void f_list2blob(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
varnumber_T n = tv_get_number_chk(TV_LIST_ITEM_TV(li), &error);
if (error || n < 0 || n > 255) {
if (!error) {
- semsg(_(e_invalid_value_for_blob_nr), n);
+ semsg(_(e_invalid_value_for_blob_nr), (int)n);
}
ga_clear(&blob->bv_ga);
return;
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 40bca9acc1..9f5d964075 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -65,11 +65,11 @@ static funccall_T *current_funccal = NULL;
// item in it is still being used.
static funccall_T *previous_funccal = NULL;
-static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it");
-static char *e_funcdict = N_("E717: Dictionary entry already exists");
-static char *e_funcref = N_("E718: Funcref required");
-static char *e_nofunc = N_("E130: Unknown function: %s");
-static char e_no_white_space_allowed_before_str_str[]
+static const char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it");
+static const char *e_funcdict = N_("E717: Dictionary entry already exists");
+static const char *e_funcref = N_("E718: Funcref required");
+static const char *e_nofunc = N_("E130: Unknown function: %s");
+static const char e_no_white_space_allowed_before_str_str[]
= N_("E1068: No white space allowed before '%s': %s");
void func_init(void)
@@ -421,9 +421,9 @@ char *deref_func_name(const char *name, int *lenp, partial_T **const partialp, b
/// Give an error message with a function name. Handle <SNR> things.
///
-/// @param ermsg must be passed without translation (use N_() instead of _()).
+/// @param errmsg must be passed without translation (use N_() instead of _()).
/// @param name function name
-void emsg_funcname(char *ermsg, const char *name)
+void emsg_funcname(const char *errmsg, const char *name)
{
char *p;
@@ -433,7 +433,7 @@ void emsg_funcname(char *ermsg, const char *name)
p = (char *)name;
}
- semsg(_(ermsg), p);
+ semsg(_(errmsg), p);
if (p != name) {
xfree(p);
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index ed2453bd59..6252adf6a1 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -50,8 +50,8 @@
#define DICT_MAXNEST 100 // maximum nesting of lists and dicts
-static char *e_letunexp = N_("E18: Unexpected characters in :let");
-static char *e_lock_unlock = N_("E940: Cannot lock or unlock variable %s");
+static const char *e_letunexp = N_("E18: Unexpected characters in :let");
+static const char *e_lock_unlock = N_("E940: Cannot lock or unlock variable %s");
/// Get a list of lines from a HERE document. The here document is a list of
/// lines surrounded by a marker.
@@ -693,7 +693,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
if (!failed) {
if (opt_type != gov_string || s != NULL) {
- char *err = set_option_value(arg, (long)n, s, scope);
+ const char *err = set_option_value(arg, (long)n, s, scope);
arg_end = p;
if (err != NULL) {
emsg(_(err));
diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c
index c1d2e5b38f..cf5727fa59 100644
--- a/src/nvim/eval/window.c
+++ b/src/nvim/eval/window.c
@@ -36,8 +36,8 @@
# include "eval/window.c.generated.h"
#endif
-static char *e_invalwindow = N_("E957: Invalid window number");
-static char e_cannot_resize_window_in_another_tab_page[]
+static const char *e_invalwindow = N_("E957: Invalid window number");
+static const char e_cannot_resize_window_in_another_tab_page[]
= N_("E1308: Cannot resize a window in another tab page");
static int win_getid(typval_T *argvars)
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 6a259b75fb..bc8c7eead0 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -85,15 +85,15 @@
#include "nvim/vim.h"
#include "nvim/window.h"
-static char e_ambiguous_use_of_user_defined_command[]
+static const char e_ambiguous_use_of_user_defined_command[]
= N_("E464: Ambiguous use of user-defined command");
-static char e_not_an_editor_command[]
+static const char e_not_an_editor_command[]
= N_("E492: Not an editor command");
-static char e_no_source_file_name_to_substitute_for_sfile[]
+static const char e_no_source_file_name_to_substitute_for_sfile[]
= N_("E498: no :source file name to substitute for \"<sfile>\"");
-static char e_no_call_stack_to_substitute_for_stack[]
+static const char e_no_call_stack_to_substitute_for_stack[]
= N_("E489: no call stack to substitute for \"<stack>\"");
-static char e_no_script_file_name_to_substitute_for_script[]
+static const char e_no_script_file_name_to_substitute_for_script[]
= N_("E1274: No script file name to substitute for \"<script>\"");
static int quitmore = 0;
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 1cef99297a..6fdd150571 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -1055,7 +1055,7 @@ void ex_break(exarg_T *eap)
void ex_endwhile(exarg_T *eap)
{
cstack_T *const cstack = eap->cstack;
- char *err;
+ const char *err;
int csf;
if (eap->cmdidx == CMD_endwhile) {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index bd7ddbf567..cdbb41c8ae 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2753,7 +2753,7 @@ void text_locked_msg(void)
emsg(_(get_text_locked_msg()));
}
-char *get_text_locked_msg(void)
+const char *get_text_locked_msg(void)
{
if (cmdwin_type != 0) {
return e_cmdwin;
@@ -4274,7 +4274,7 @@ void cmdline_init(void)
/// Check value of 'cedit' and set cedit_key.
/// Returns NULL if value is OK, error message otherwise.
-char *check_cedit(void)
+const char *check_cedit(void)
{
if (*p_cedit == NUL) {
cedit_key = -1;
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index d91e2dfeeb..d341cb20c4 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -182,7 +182,7 @@ typedef struct ff_search_ctx_T {
# include "file_search.c.generated.h"
#endif
-static char e_pathtoolong[] = N_("E854: path too long for completion");
+static const char e_pathtoolong[] = N_("E854: path too long for completion");
/// Initialization routine for vim_findfile().
///
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 684658b4e3..cbb378b4b6 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -134,8 +134,8 @@ static char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions'
# include "fileio.c.generated.h"
#endif
-static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
-static char e_no_matching_autocommands_for_buftype_str_buffer[]
+static const char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
+static const char e_no_matching_autocommands_for_buftype_str_buffer[]
= N_("E676: No matching autocommands for buftype=%s buffer");
void filemess(buf_T *buf, char *name, char *s, int attr)
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 7306131574..2b33f00c67 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -101,7 +101,7 @@ typedef void (*LevelGetter)(fline_T *);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "fold.c.generated.h"
#endif
-static char *e_nofold = N_("E490: No fold found");
+static const char *e_nofold = N_("E490: No fold found");
// While updating the folds lines between invalid_top and invalid_bot have an
// undefined fold level. Only used for the window currently being updated.
diff --git a/src/nvim/gettext.h b/src/nvim/gettext.h
index 6d2a55124e..9d7b2aec32 100644
--- a/src/nvim/gettext.h
+++ b/src/nvim/gettext.h
@@ -3,7 +3,7 @@
#ifdef HAVE_WORKING_LIBINTL
# include <libintl.h>
-# define _(x) gettext((char *)(x))
+# define _(x) gettext(x)
// XXX do we actually need this?
# ifdef gettext_noop
# define N_(x) gettext_noop(x)
@@ -17,7 +17,7 @@
# undef setlocale
# endif
#else
-# define _(x) ((char *)(x))
+# define _(x) (x)
# define N_(x) x
# define NGETTEXT(x, xs, n) ((n) == 1 ? (x) : (xs))
# define bindtextdomain(x, y) // empty
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 571df45e89..7653076e39 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -866,172 +866,172 @@ EXTERN linenr_T spell_redraw_lnum INIT(= 0);
// The error messages that can be shared are included here.
// Excluded are errors that are only used once and debugging messages.
-EXTERN char e_abort[] INIT(= N_("E470: Command aborted"));
-EXTERN char e_afterinit[] INIT(= N_("E905: Cannot set this option after startup"));
-EXTERN char e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job"));
-EXTERN char e_argreq[] INIT(= N_("E471: Argument required"));
-EXTERN char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
-EXTERN char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
-EXTERN char e_curdir[] INIT(= N_("E12: Command not allowed in secure mode in current dir or tag search"));
-EXTERN char e_command_too_recursive[] INIT(= N_("E169: Command too recursive"));
-EXTERN char e_endif[] INIT(= N_("E171: Missing :endif"));
-EXTERN char e_endtry[] INIT(= N_("E600: Missing :endtry"));
-EXTERN char e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
-EXTERN char e_endfor[] INIT(= N_("E170: Missing :endfor"));
-EXTERN char e_while[] INIT(= N_("E588: :endwhile without :while"));
-EXTERN char e_for[] INIT(= N_("E588: :endfor without :for"));
-EXTERN char e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
-EXTERN char e_failed[] INIT(= N_("E472: Command failed"));
-EXTERN char e_internal[] INIT(= N_("E473: Internal error"));
-EXTERN char e_intern2[] INIT(= N_("E685: Internal error: %s"));
-EXTERN char e_interr[] INIT(= N_("Interrupted"));
-EXTERN char e_invarg[] INIT(= N_("E474: Invalid argument"));
-EXTERN char e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
-EXTERN char e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
-EXTERN char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
-EXTERN char e_duparg2[] INIT(= N_("E983: Duplicate argument: %s"));
-EXTERN char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
-EXTERN char e_invrange[] INIT(= N_("E16: Invalid range"));
-EXTERN char e_invcmd[] INIT(= N_("E476: Invalid command"));
-EXTERN char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
-EXTERN char e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
-EXTERN char e_invchan[] INIT(= N_("E900: Invalid channel id"));
-EXTERN char e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job"));
-EXTERN char e_jobtblfull[] INIT(= N_("E901: Job table is full"));
-EXTERN char e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\""));
-EXTERN char e_channotpty[] INIT(= N_("E904: channel is not a pty"));
-EXTERN char e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s"));
-EXTERN char e_invstream[] INIT(= N_("E906: invalid stream for channel"));
-EXTERN char e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'"));
-EXTERN char e_streamkey[] INIT(= N_("E5210: dict key '%s' already set for buffered stream in channel %" PRIu64));
-EXTERN char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
-EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed: %s"));
-EXTERN char e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
-EXTERN char e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
-EXTERN char e_marknotset[] INIT(= N_("E20: Mark not set"));
-EXTERN char e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off"));
-EXTERN char e_nesting[] INIT(= N_("E22: Scripts nested too deep"));
-EXTERN char e_noalt[] INIT(= N_("E23: No alternate file"));
-EXTERN char e_noabbr[] INIT(= N_("E24: No such abbreviation"));
-EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed"));
-EXTERN char e_nogroup[] INIT(= N_("E28: No such highlight group name: %s"));
-EXTERN char e_noinstext[] INIT(= N_("E29: No inserted text yet"));
-EXTERN char e_nolastcmd[] INIT(= N_("E30: No previous command line"));
-EXTERN char e_nomap[] INIT(= N_("E31: No such mapping"));
-EXTERN char e_nomatch[] INIT(= N_("E479: No match"));
-EXTERN char e_nomatch2[] INIT(= N_("E480: No match: %s"));
-EXTERN char e_noname[] INIT(= N_("E32: No file name"));
-EXTERN char e_nopresub[] INIT(= N_("E33: No previous substitute regular expression"));
-EXTERN char e_noprev[] INIT(= N_("E34: No previous command"));
-EXTERN char e_noprevre[] INIT(= N_("E35: No previous regular expression"));
-EXTERN char e_norange[] INIT(= N_("E481: No range allowed"));
-EXTERN char e_noroom[] INIT(= N_("E36: Not enough room"));
-EXTERN char e_notmp[] INIT(= N_("E483: Can't get temp file name"));
-EXTERN char e_notopen[] INIT(= N_("E484: Can't open file %s"));
-EXTERN char e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s"));
-EXTERN char e_notread[] INIT(= N_("E485: Can't read file %s"));
-EXTERN char e_null[] INIT(= N_("E38: Null argument"));
-EXTERN char e_number_exp[] INIT(= N_("E39: Number expected"));
-EXTERN char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s"));
-EXTERN char e_outofmem[] INIT(= N_("E41: Out of memory!"));
-EXTERN char e_patnotf[] INIT(= N_("Pattern not found"));
-EXTERN char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s"));
-EXTERN char e_positive[] INIT(= N_("E487: Argument must be positive"));
-EXTERN char e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory"));
-
-EXTERN char e_no_errors[] INIT(= N_("E42: No Errors"));
-EXTERN char e_loclist[] INIT(= N_("E776: No location list"));
-EXTERN char e_re_damg[] INIT(= N_("E43: Damaged match string"));
-EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
-EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
-EXTERN char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
-EXTERN char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
-EXTERN char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
-EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\""));
-EXTERN char e_stringreq[] INIT(= N_("E928: String required"));
-EXTERN char e_dictreq[] INIT(= N_("E715: Dictionary required"));
-EXTERN char e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64));
-EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
-EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
-EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
-EXTERN char e_listreq[] INIT(= N_("E714: List required"));
-EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
-EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
-EXTERN char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob"));
-EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
-EXTERN char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
-EXTERN char e_secure[] INIT(= N_("E523: Not allowed here"));
-EXTERN char e_textlock[] INIT(= N_("E565: Not allowed to change text or change window"));
-EXTERN char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
-EXTERN char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
-EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
-EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
-EXTERN char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
-EXTERN char e_tagstack[] INIT(= N_("E73: tag stack empty"));
-EXTERN char e_toocompl[] INIT(= N_("E74: Command too complex"));
-EXTERN char e_longname[] INIT(= N_("E75: Name too long"));
-EXTERN char e_toomsbra[] INIT(= N_("E76: Too many ["));
-EXTERN char e_toomany[] INIT(= N_("E77: Too many file names"));
-EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters"));
-EXTERN char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
-EXTERN char e_umark[] INIT(= N_("E78: Unknown mark"));
-EXTERN char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
-EXTERN char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
-EXTERN char e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
-EXTERN char e_write[] INIT(= N_("E80: Error while writing"));
-EXTERN char e_zerocount[] INIT(= N_("E939: Positive count required"));
-EXTERN char e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
-EXTERN char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
-EXTERN char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
-EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer"));
-EXTERN char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
-
-EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
-EXTERN char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
-EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set"));
-EXTERN char e_invalidreg[] INIT(= N_("E850: Invalid register name"));
-EXTERN char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
-EXTERN char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
-EXTERN char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode"));
-EXTERN char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window"));
-EXTERN char e_listarg[] INIT(= N_("E686: Argument of %s must be a List"));
-EXTERN char e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
-EXTERN char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
-EXTERN char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
-EXTERN char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now"));
-
-EXTERN char e_cmdmap_err[] INIT(= N_("E5520: <Cmd> mapping must end with <CR>"));
-EXTERN char e_cmdmap_repeated[]
+EXTERN const char e_abort[] INIT(= N_("E470: Command aborted"));
+EXTERN const char e_afterinit[] INIT(= N_("E905: Cannot set this option after startup"));
+EXTERN const char e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job"));
+EXTERN const char e_argreq[] INIT(= N_("E471: Argument required"));
+EXTERN const char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
+EXTERN const char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
+EXTERN const char e_curdir[] INIT(= N_("E12: Command not allowed in secure mode in current dir or tag search"));
+EXTERN const char e_command_too_recursive[] INIT(= N_("E169: Command too recursive"));
+EXTERN const char e_endif[] INIT(= N_("E171: Missing :endif"));
+EXTERN const char e_endtry[] INIT(= N_("E600: Missing :endtry"));
+EXTERN const char e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
+EXTERN const char e_endfor[] INIT(= N_("E170: Missing :endfor"));
+EXTERN const char e_while[] INIT(= N_("E588: :endwhile without :while"));
+EXTERN const char e_for[] INIT(= N_("E588: :endfor without :for"));
+EXTERN const char e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
+EXTERN const char e_failed[] INIT(= N_("E472: Command failed"));
+EXTERN const char e_internal[] INIT(= N_("E473: Internal error"));
+EXTERN const char e_intern2[] INIT(= N_("E685: Internal error: %s"));
+EXTERN const char e_interr[] INIT(= N_("Interrupted"));
+EXTERN const char e_invarg[] INIT(= N_("E474: Invalid argument"));
+EXTERN const char e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
+EXTERN const char e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
+EXTERN const char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
+EXTERN const char e_duparg2[] INIT(= N_("E983: Duplicate argument: %s"));
+EXTERN const char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
+EXTERN const char e_invrange[] INIT(= N_("E16: Invalid range"));
+EXTERN const char e_invcmd[] INIT(= N_("E476: Invalid command"));
+EXTERN const char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
+EXTERN const char e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
+EXTERN const char e_invchan[] INIT(= N_("E900: Invalid channel id"));
+EXTERN const char e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job"));
+EXTERN const char e_jobtblfull[] INIT(= N_("E901: Job table is full"));
+EXTERN const char e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\""));
+EXTERN const char e_channotpty[] INIT(= N_("E904: channel is not a pty"));
+EXTERN const char e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s"));
+EXTERN const char e_invstream[] INIT(= N_("E906: invalid stream for channel"));
+EXTERN const char e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'"));
+EXTERN const char e_streamkey[] INIT(= N_("E5210: dict key '%s' already set for buffered stream in channel %" PRIu64));
+EXTERN const char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
+EXTERN const char e_fsync[] INIT(= N_("E667: Fsync failed: %s"));
+EXTERN const char e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
+EXTERN const char e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
+EXTERN const char e_marknotset[] INIT(= N_("E20: Mark not set"));
+EXTERN const char e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off"));
+EXTERN const char e_nesting[] INIT(= N_("E22: Scripts nested too deep"));
+EXTERN const char e_noalt[] INIT(= N_("E23: No alternate file"));
+EXTERN const char e_noabbr[] INIT(= N_("E24: No such abbreviation"));
+EXTERN const char e_nobang[] INIT(= N_("E477: No ! allowed"));
+EXTERN const char e_nogroup[] INIT(= N_("E28: No such highlight group name: %s"));
+EXTERN const char e_noinstext[] INIT(= N_("E29: No inserted text yet"));
+EXTERN const char e_nolastcmd[] INIT(= N_("E30: No previous command line"));
+EXTERN const char e_nomap[] INIT(= N_("E31: No such mapping"));
+EXTERN const char e_nomatch[] INIT(= N_("E479: No match"));
+EXTERN const char e_nomatch2[] INIT(= N_("E480: No match: %s"));
+EXTERN const char e_noname[] INIT(= N_("E32: No file name"));
+EXTERN const char e_nopresub[] INIT(= N_("E33: No previous substitute regular expression"));
+EXTERN const char e_noprev[] INIT(= N_("E34: No previous command"));
+EXTERN const char e_noprevre[] INIT(= N_("E35: No previous regular expression"));
+EXTERN const char e_norange[] INIT(= N_("E481: No range allowed"));
+EXTERN const char e_noroom[] INIT(= N_("E36: Not enough room"));
+EXTERN const char e_notmp[] INIT(= N_("E483: Can't get temp file name"));
+EXTERN const char e_notopen[] INIT(= N_("E484: Can't open file %s"));
+EXTERN const char e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s"));
+EXTERN const char e_notread[] INIT(= N_("E485: Can't read file %s"));
+EXTERN const char e_null[] INIT(= N_("E38: Null argument"));
+EXTERN const char e_number_exp[] INIT(= N_("E39: Number expected"));
+EXTERN const char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s"));
+EXTERN const char e_outofmem[] INIT(= N_("E41: Out of memory!"));
+EXTERN const char e_patnotf[] INIT(= N_("Pattern not found"));
+EXTERN const char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s"));
+EXTERN const char e_positive[] INIT(= N_("E487: Argument must be positive"));
+EXTERN const char e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory"));
+
+EXTERN const char e_no_errors[] INIT(= N_("E42: No Errors"));
+EXTERN const char e_loclist[] INIT(= N_("E776: No location list"));
+EXTERN const char e_re_damg[] INIT(= N_("E43: Damaged match string"));
+EXTERN const char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
+EXTERN const char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
+EXTERN const char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
+EXTERN const char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
+EXTERN const char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
+EXTERN const char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\""));
+EXTERN const char e_stringreq[] INIT(= N_("E928: String required"));
+EXTERN const char e_dictreq[] INIT(= N_("E715: Dictionary required"));
+EXTERN const char e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64));
+EXTERN const char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
+EXTERN const char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
+EXTERN const char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
+EXTERN const char e_listreq[] INIT(= N_("E714: List required"));
+EXTERN const char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
+EXTERN const char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
+EXTERN const char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob"));
+EXTERN const char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
+EXTERN const char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
+EXTERN const char e_secure[] INIT(= N_("E523: Not allowed here"));
+EXTERN const char e_textlock[] INIT(= N_("E565: Not allowed to change text or change window"));
+EXTERN const char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
+EXTERN const char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
+EXTERN const char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
+EXTERN const char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
+EXTERN const char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
+EXTERN const char e_tagstack[] INIT(= N_("E73: tag stack empty"));
+EXTERN const char e_toocompl[] INIT(= N_("E74: Command too complex"));
+EXTERN const char e_longname[] INIT(= N_("E75: Name too long"));
+EXTERN const char e_toomsbra[] INIT(= N_("E76: Too many ["));
+EXTERN const char e_toomany[] INIT(= N_("E77: Too many file names"));
+EXTERN const char e_trailing[] INIT(= N_("E488: Trailing characters"));
+EXTERN const char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
+EXTERN const char e_umark[] INIT(= N_("E78: Unknown mark"));
+EXTERN const char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
+EXTERN const char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
+EXTERN const char e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
+EXTERN const char e_write[] INIT(= N_("E80: Error while writing"));
+EXTERN const char e_zerocount[] INIT(= N_("E939: Positive count required"));
+EXTERN const char e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
+EXTERN const char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
+EXTERN const char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
+EXTERN const char e_emptybuf[] INIT(= N_("E749: empty buffer"));
+EXTERN const char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
+
+EXTERN const char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
+EXTERN const char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
+EXTERN const char e_notset[] INIT(= N_("E764: Option '%s' is not set"));
+EXTERN const char e_invalidreg[] INIT(= N_("E850: Invalid register name"));
+EXTERN const char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
+EXTERN const char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
+EXTERN const char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode"));
+EXTERN const char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window"));
+EXTERN const char e_listarg[] INIT(= N_("E686: Argument of %s must be a List"));
+EXTERN const char e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
+EXTERN const char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
+EXTERN const char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
+EXTERN const char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now"));
+
+EXTERN const char e_cmdmap_err[] INIT(= N_("E5520: <Cmd> mapping must end with <CR>"));
+EXTERN const char e_cmdmap_repeated[]
INIT(= N_("E5521: <Cmd> mapping must end with <CR> before second <Cmd>"));
-EXTERN char e_api_error[] INIT(= N_("E5555: API call: %s"));
+EXTERN const char e_api_error[] INIT(= N_("E5555: API call: %s"));
-EXTERN char e_luv_api_disabled[] INIT(= N_("E5560: %s must not be called in a lua loop callback"));
+EXTERN const char e_luv_api_disabled[] INIT(= N_("E5560: %s must not be called in a lua loop callback"));
-EXTERN char e_floatonly[] INIT(= N_("E5601: Cannot close window, only floating window would remain"));
-EXTERN char e_floatexchange[] INIT(= N_("E5602: Cannot exchange or rotate float"));
+EXTERN const char e_floatonly[] INIT(= N_("E5601: Cannot close window, only floating window would remain"));
+EXTERN const char e_floatexchange[] INIT(= N_("E5602: Cannot exchange or rotate float"));
-EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= N_("E1155: Cannot define autocommands for ALL events"));
+EXTERN const char e_cannot_define_autocommands_for_all_events[] INIT(= N_("E1155: Cannot define autocommands for ALL events"));
-EXTERN char e_resulting_text_too_long[] INIT(= N_("E1240: Resulting text too long"));
+EXTERN const char e_resulting_text_too_long[] INIT(= N_("E1240: Resulting text too long"));
-EXTERN char e_line_number_out_of_range[] INIT(= N_("E1247: Line number out of range"));
+EXTERN const char e_line_number_out_of_range[] INIT(= N_("E1247: Line number out of range"));
-EXTERN char e_highlight_group_name_invalid_char[] INIT(= N_("E5248: Invalid character in group name"));
+EXTERN const char e_highlight_group_name_invalid_char[] INIT(= N_("E5248: Invalid character in group name"));
-EXTERN char e_highlight_group_name_too_long[] INIT(= N_("E1249: Highlight group name too long"));
+EXTERN const char e_highlight_group_name_too_long[] INIT(= N_("E1249: Highlight group name too long"));
-EXTERN char e_invalid_line_number_nr[] INIT(= N_("E966: Invalid line number: %ld"));
+EXTERN const char e_invalid_line_number_nr[] INIT(= N_("E966: Invalid line number: %ld"));
-EXTERN char e_undobang_cannot_redo_or_move_branch[]
+EXTERN const char e_undobang_cannot_redo_or_move_branch[]
INIT(= N_("E5767: Cannot use :undo! to redo or move to a different undo branch"));
-EXTERN char e_trustfile[] INIT(= N_("E5570: Cannot update trust file: %s"));
+EXTERN const char e_trustfile[] INIT(= N_("E5570: Cannot update trust file: %s"));
-EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
-EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
+EXTERN const char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
+EXTERN const char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
-EXTERN char line_msg[] INIT(= N_(" line "));
+EXTERN const char line_msg[] INIT(= N_(" line "));
EXTERN FILE *time_fd INIT(= NULL); // where to write startup timing
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 7100146245..50107cdfea 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -187,8 +187,8 @@ typedef enum {
CP_FAST = 32, ///< use fast_breakcheck instead of os_breakcheck
} cp_flags_T;
-static char e_hitend[] = N_("Hit end of paragraph");
-static char e_compldel[] = N_("E840: Completion function deleted text");
+static const char e_hitend[] = N_("Hit end of paragraph");
+static const char e_compldel[] = N_("E840: Completion function deleted text");
// All the current matches are stored in a list.
// "compl_first_match" points to the start of the list.
@@ -2257,7 +2257,7 @@ static void copy_global_to_buflocal_cb(Callback *globcb, Callback *bufcb)
/// Invoked when the 'completefunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-void set_completefunc_option(char **errmsg)
+void set_completefunc_option(const char **errmsg)
{
if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL) {
*errmsg = e_invarg;
@@ -2278,7 +2278,7 @@ void set_buflocal_cfu_callback(buf_T *buf)
/// Invoked when the 'omnifunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-void set_omnifunc_option(buf_T *buf, char **errmsg)
+void set_omnifunc_option(buf_T *buf, const char **errmsg)
{
if (option_set_callback_func(buf->b_p_ofu, &ofu_cb) == FAIL) {
*errmsg = e_invarg;
@@ -2298,7 +2298,7 @@ void set_buflocal_ofu_callback(buf_T *buf)
/// Invoked when the 'thesaurusfunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-void set_thesaurusfunc_option(char **errmsg)
+void set_thesaurusfunc_option(const char **errmsg)
{
int retval;
diff --git a/src/nvim/match.c b/src/nvim/match.c
index 29d4b7c225..ccce78e59d 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -42,7 +42,7 @@
# include "match.c.generated.h"
#endif
-static char *e_invalwindow = N_("E957: Invalid window number");
+static const char *e_invalwindow = N_("E957: Invalid window number");
#define SEARCH_HL_PRIORITY 0
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index c580dc29e6..340a05f29d 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -87,17 +87,17 @@ struct interval {
#endif
// uncrustify:on
-static char e_list_item_nr_is_not_list[]
+static const char e_list_item_nr_is_not_list[]
= N_("E1109: List item %d is not a List");
-static char e_list_item_nr_does_not_contain_3_numbers[]
+static const char e_list_item_nr_does_not_contain_3_numbers[]
= N_("E1110: List item %d does not contain 3 numbers");
-static char e_list_item_nr_range_invalid[]
+static const char e_list_item_nr_range_invalid[]
= N_("E1111: List item %d range invalid");
-static char e_list_item_nr_cell_width_invalid[]
+static const char e_list_item_nr_cell_width_invalid[]
= N_("E1112: List item %d cell width invalid");
-static char e_overlapping_ranges_for_nr[]
+static const char e_overlapping_ranges_for_nr[]
= N_("E1113: Overlapping ranges for 0x%lx");
-static char e_only_values_of_0x80_and_higher_supported[]
+static const char e_only_values_of_0x80_and_higher_supported[]
= N_("E1114: Only values of 0x80 and higher supported");
// To speed up BYTELEN(); keep a lookup table to quickly get the length in
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 4fad926cb0..684bd92390 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -50,8 +50,8 @@
/// The character for each menu mode
static char *menu_mode_chars[] = { "n", "v", "s", "o", "i", "c", "tl", "t" };
-static char e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu");
-static char e_nomenu[] = N_("E329: No menu \"%s\"");
+static const char e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu");
+static const char e_nomenu[] = N_("E329: No menu \"%s\"");
// Return true if "name" is a window toolbar menu name.
static bool menu_is_winbar(const char *const name)
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 6ad1cbd987..66c24fb444 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -117,7 +117,7 @@ static inline void normal_state_init(NormalState *s)
// n_*(): functions called to handle Normal mode commands.
// v_*(): functions called to handle Visual mode commands.
-static char *e_noident = N_("E349: No identifier under cursor");
+static const char *e_noident = N_("E349: No identifier under cursor");
/// Function to be called for a Normal or Visual mode command.
/// The argument is a cmdarg_T.
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index d66ed9abff..d2e9fda7d9 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5628,7 +5628,7 @@ static void op_colon(oparg_T *oap)
static Callback opfunc_cb;
/// Process the 'operatorfunc' option value.
-void set_operatorfunc_option(char **errmsg)
+void set_operatorfunc_option(const char **errmsg)
{
if (option_set_callback_func(p_opfunc, &opfunc_cb) == FAIL) {
*errmsg = e_invarg;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 8fa719c3a9..a5170715d6 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -105,17 +105,17 @@
# include "nvim/arglist.h"
#endif
-static char e_unknown_option[]
+static const char e_unknown_option[]
= N_("E518: Unknown option");
-static char e_not_allowed_in_modeline[]
+static const char e_not_allowed_in_modeline[]
= N_("E520: Not allowed in a modeline");
-static char e_not_allowed_in_modeline_when_modelineexpr_is_off[]
+static const char e_not_allowed_in_modeline_when_modelineexpr_is_off[]
= N_("E992: Not allowed in a modeline when 'modelineexpr' is off");
-static char e_key_code_not_set[]
+static const char e_key_code_not_set[]
= N_("E846: Key code not set");
-static char e_number_required_after_equal[]
+static const char e_number_required_after_equal[]
= N_("E521: Number required after =");
-static char e_preview_window_already_exists[]
+static const char e_preview_window_already_exists[]
= N_("E590: A preview window already exists");
static char *p_term = NULL;
@@ -747,7 +747,7 @@ void ex_set(exarg_T *eap)
}
static void do_set_bool(int opt_idx, int opt_flags, int prefix, int nextchar, const char *varp,
- char **errmsg)
+ const char **errmsg)
{
varnumber_T value;
@@ -777,7 +777,7 @@ static void do_set_bool(int opt_idx, int opt_flags, int prefix, int nextchar, co
}
static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, const set_op_T op,
- const char *varp, char *errbuf, size_t errbuflen, char **errmsg)
+ const char *varp, char *errbuf, size_t errbuflen, const char **errmsg)
{
varnumber_T value;
char *arg = *argp;
@@ -911,7 +911,7 @@ static void munge_string_opt_val(char **varp, char **oldval, char **const origva
/// Part of do_set() for string options.
static void do_set_string(int opt_idx, int opt_flags, char **argp, int nextchar, set_op_T op_arg,
uint32_t flags, char *varp_arg, char *errbuf, size_t errbuflen,
- int *value_checked, char **errmsg)
+ int *value_checked, const char **errmsg)
{
char *arg = *argp;
set_op_T op = op_arg;
@@ -1265,7 +1265,7 @@ static int parse_option_name(char *arg, int *keyp, int *lenp, int *opt_idxp)
}
static int validate_opt_idx(win_T *win, int opt_idx, int opt_flags, uint32_t flags, int prefix,
- char **errmsg)
+ const char **errmsg)
{
// Only bools can have a prefix of 'inv' or 'no'
if (!(flags & P_BOOL) && prefix != 1) {
@@ -1318,7 +1318,7 @@ static int validate_opt_idx(win_T *win, int opt_idx, int opt_flags, uint32_t fla
static void do_set_option_value(int opt_idx, int opt_flags, char **argp, int prefix, int nextchar,
set_op_T op, uint32_t flags, char *varp, char *errbuf,
- size_t errbuflen, char **errmsg)
+ size_t errbuflen, const char **errmsg)
{
int value_checked = false;
if (flags & P_BOOL) { // boolean
@@ -1343,7 +1343,7 @@ static void do_set_option_value(int opt_idx, int opt_flags, char **argp, int pre
}
static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errbuf,
- size_t errbuflen, char **errmsg)
+ size_t errbuflen, const char **errmsg)
{
// 1: nothing, 0: "no", 2: "inv" in front of name
int prefix = get_option_prefix(argp);
@@ -1521,7 +1521,7 @@ int do_set(char *arg, int opt_flags)
}
} else {
char *startarg = arg; // remember for error message
- char *errmsg = NULL;
+ const char *errmsg = NULL;
char errbuf[80];
do_set_option(opt_flags, &arg, &did_show, errbuf, sizeof(errbuf), &errmsg);
@@ -1992,12 +1992,12 @@ static void apply_optionset_autocmd(int opt_idx, long opt_flags, long oldval, lo
/// @param[in] opt_flags OPT_LOCAL and/or OPT_GLOBAL.
///
/// @return NULL on success, error message on error.
-static char *set_bool_option(const int opt_idx, char *const varp, const int value,
- const int opt_flags)
+static const char *set_bool_option(const int opt_idx, char *const varp, const int value,
+ const int opt_flags)
{
int old_value = *(int *)varp;
int old_global_value = 0;
- char *errmsg = NULL;
+ const char *errmsg = NULL;
// Disallow changing some options from secure mode
if ((secure || sandbox != 0)
@@ -2274,10 +2274,10 @@ static char *set_bool_option(const int opt_idx, char *const varp, const int valu
/// @param[in] opt_flags OPT_LOCAL, OPT_GLOBAL or OPT_MODELINE.
///
/// @return NULL on success, error message on error.
-static char *set_num_option(int opt_idx, char *varp, long value, char *errbuf, size_t errbuflen,
- int opt_flags)
+static const char *set_num_option(int opt_idx, char *varp, long value, char *errbuf,
+ size_t errbuflen, int opt_flags)
{
- char *errmsg = NULL;
+ const char *errmsg = NULL;
long old_value = *(long *)varp;
long old_global_value = 0; // only used when setting a local and global option
long old_Rows = Rows; // remember old Rows
@@ -3078,8 +3078,8 @@ vimoption_T *get_option(int opt_idx)
/// on the option).
///
/// @return NULL on success, an untranslated error message on error.
-char *set_option_value(const char *const name, const long number, const char *const string,
- const int opt_flags)
+const char *set_option_value(const char *const name, const long number, const char *const string,
+ const int opt_flags)
FUNC_ATTR_NONNULL_ARG(1)
{
static char errbuf[80];
@@ -3154,7 +3154,7 @@ char *set_option_value(const char *const name, const long number, const char *co
/// @param opt_flags OPT_LOCAL or 0 (both)
void set_option_value_give_err(const char *name, long number, const char *string, int opt_flags)
{
- char *errmsg = set_option_value(name, number, string, opt_flags);
+ const char *errmsg = set_option_value(name, number, string, opt_flags);
if (errmsg != NULL) {
emsg(_(errmsg));
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index bf4ebbb3e2..3372c7b6c6 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -59,13 +59,13 @@
# include "optionstr.c.generated.h"
#endif
-static char e_unclosed_expression_sequence[]
+static const char e_unclosed_expression_sequence[]
= N_("E540: Unclosed expression sequence");
-static char e_unbalanced_groups[]
+static const char e_unbalanced_groups[]
= N_("E542: unbalanced groups");
-static char e_backupext_and_patchmode_are_equal[]
+static const char e_backupext_and_patchmode_are_equal[]
= N_("E589: 'backupext' and 'patchmode' are equal");
-static char e_showbreak_contains_unprintable_or_wide_character[]
+static const char e_showbreak_contains_unprintable_or_wide_character[]
= N_("E595: 'showbreak' contains unprintable or wide character");
static char *(p_ambw_values[]) = { "single", "double", NULL };
@@ -410,8 +410,8 @@ void set_string_option_direct_in_win(win_T *wp, const char *name, int opt_idx, c
/// #OPT_GLOBAL.
///
/// @return NULL on success, an untranslated error message on error.
-char *set_string_option(const int opt_idx, const char *const value, const int opt_flags,
- char *const errbuf, const size_t errbuflen)
+const char *set_string_option(const int opt_idx, const char *const value, const int opt_flags,
+ char *const errbuf, const size_t errbuflen)
FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_WARN_UNUSED_RESULT
{
vimoption_T *opt = get_option(opt_idx);
@@ -442,9 +442,8 @@ char *set_string_option(const int opt_idx, const char *const value, const int op
char *const saved_newval = xstrdup(s);
int value_checked = false;
- char *const errmsg = did_set_string_option(opt_idx, varp, oldval,
- errbuf, errbuflen,
- opt_flags, &value_checked);
+ const char *const errmsg = did_set_string_option(opt_idx, varp, oldval, errbuf, errbuflen,
+ opt_flags, &value_checked);
if (errmsg == NULL) {
did_set_option(opt_idx, opt_flags, true, value_checked);
}
@@ -478,7 +477,7 @@ static bool valid_filetype(const char *val)
/// Handle setting 'mousescroll'.
/// @return error message, NULL if it's OK.
-static char *check_mousescroll(char *string)
+static const char *check_mousescroll(char *string)
{
long vertical = -1;
long horizontal = -1;
@@ -571,7 +570,7 @@ static int check_signcolumn(char *val)
/// Check validity of options with the 'statusline' format.
/// Return an untranslated error message or NULL.
-char *check_stl_option(char *s)
+const char *check_stl_option(char *s)
{
int groupdepth = 0;
static char errbuf[80];
@@ -650,7 +649,7 @@ static bool check_illegal_path_names(char *val, uint32_t flags)
&& strpbrk(val, "*?[|;&<>\r\n") != NULL));
}
-static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, char **errmsg)
+static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, const char **errmsg)
{
char *bkc = p_bkc;
unsigned int *flags = &bkc_flags;
@@ -678,7 +677,7 @@ static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, char **e
}
}
-static void did_set_backupext_or_patchmode(char **errmsg)
+static void did_set_backupext_or_patchmode(const char **errmsg)
{
if (strcmp(*p_bex == '.' ? p_bex + 1 : p_bex,
*p_pm == '.' ? p_pm + 1 : p_pm) == 0) {
@@ -686,7 +685,7 @@ static void did_set_backupext_or_patchmode(char **errmsg)
}
}
-static void did_set_breakindentopt(win_T *win, char **errmsg)
+static void did_set_breakindentopt(win_T *win, const char **errmsg)
{
if (briopt_check(win) == FAIL) {
*errmsg = e_invarg;
@@ -697,7 +696,7 @@ static void did_set_breakindentopt(win_T *win, char **errmsg)
}
}
-static void did_set_isopt(buf_T *buf, bool *did_chartab, char **errmsg)
+static void did_set_isopt(buf_T *buf, bool *did_chartab, const char **errmsg)
{
// 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
// If the new option is invalid, use old value.
@@ -719,14 +718,14 @@ static void did_set_helpfile(void)
}
}
-static void did_set_cursorlineopt(win_T *win, char **varp, char **errmsg)
+static void did_set_cursorlineopt(win_T *win, char **varp, const char **errmsg)
{
if (**varp == NUL || fill_culopt_flags(*varp, win) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_helplang(char **errmsg)
+static void did_set_helplang(const char **errmsg)
{
// Check for "", "ab", "ab,cd", etc.
for (char *s = p_hlg; *s != NUL; s += 3) {
@@ -740,26 +739,27 @@ static void did_set_helplang(char **errmsg)
}
}
-static void did_set_highlight(char **varp, char **errmsg)
+static void did_set_highlight(char **varp, const char **errmsg)
{
if (strcmp(*varp, HIGHLIGHT_INIT) != 0) {
*errmsg = e_unsupportedoption;
}
}
-static void did_set_opt_flags(char *val, char **values, unsigned *flagp, bool list, char **errmsg)
+static void did_set_opt_flags(char *val, char **values, unsigned *flagp, bool list,
+ const char **errmsg)
{
if (opt_strings_flags(val, values, flagp, list) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_opt_strings(char *val, char **values, bool list, char **errmsg)
+static void did_set_opt_strings(char *val, char **values, bool list, const char **errmsg)
{
did_set_opt_flags(val, values, NULL, list, errmsg);
}
-static void did_set_sessionoptions(char *oldval, char **errmsg)
+static void did_set_sessionoptions(char *oldval, const char **errmsg)
{
if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true) != OK) {
*errmsg = e_invarg;
@@ -771,7 +771,7 @@ static void did_set_sessionoptions(char *oldval, char **errmsg)
}
}
-static void did_set_ambiwidth(char **errmsg)
+static void did_set_ambiwidth(const char **errmsg)
{
if (check_opt_strings(p_ambw, p_ambw_values, false) != OK) {
*errmsg = e_invarg;
@@ -780,7 +780,7 @@ static void did_set_ambiwidth(char **errmsg)
}
}
-static void did_set_background(char **errmsg)
+static void did_set_background(const char **errmsg)
{
if (check_opt_strings(p_bg, p_bg_values, false) != OK) {
*errmsg = e_invarg;
@@ -803,21 +803,21 @@ static void did_set_background(char **errmsg)
}
}
-static void did_set_wildmode(char **errmsg)
+static void did_set_wildmode(const char **errmsg)
{
if (check_opt_wim() == FAIL) {
*errmsg = e_invarg;
}
}
-static void did_set_winaltkeys(char **errmsg)
+static void did_set_winaltkeys(const char **errmsg)
{
if (*p_wak == NUL || check_opt_strings(p_wak, p_wak_values, false) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_eventignore(char **errmsg)
+static void did_set_eventignore(const char **errmsg)
{
if (check_ei() == FAIL) {
*errmsg = e_invarg;
@@ -825,7 +825,8 @@ static void did_set_eventignore(char **errmsg)
}
// 'encoding', 'fileencoding' and 'makeencoding'
-static void did_set_encoding(buf_T *buf, char **varp, char **gvarp, int opt_flags, char **errmsg)
+static void did_set_encoding(buf_T *buf, char **varp, char **gvarp, int opt_flags,
+ const char **errmsg)
{
if (gvarp == &p_fenc) {
if (!MODIFIABLE(buf) && opt_flags != OPT_GLOBAL) {
@@ -861,7 +862,7 @@ static void did_set_encoding(buf_T *buf, char **varp, char **gvarp, int opt_flag
}
static void did_set_keymap(buf_T *buf, char **varp, int opt_flags, int *value_checked,
- char **errmsg)
+ const char **errmsg)
{
if (!valid_filetype(*varp)) {
*errmsg = e_invarg;
@@ -908,7 +909,7 @@ static void did_set_keymap(buf_T *buf, char **varp, int opt_flags, int *value_ch
}
static void did_set_fileformat(buf_T *buf, char **varp, const char *oldval, int opt_flags,
- char **errmsg)
+ const char **errmsg)
{
if (!MODIFIABLE(buf) && !(opt_flags & OPT_GLOBAL)) {
*errmsg = e_modifiable;
@@ -926,7 +927,7 @@ static void did_set_fileformat(buf_T *buf, char **varp, const char *oldval, int
}
}
-static void did_set_matchpairs(char **varp, char **errmsg)
+static void did_set_matchpairs(char **varp, const char **errmsg)
{
for (char *p = *varp; *p != NUL; p++) {
int x2 = -1;
@@ -950,7 +951,7 @@ static void did_set_matchpairs(char **varp, char **errmsg)
}
}
-static void did_set_comments(char **varp, char *errbuf, size_t errbuflen, char **errmsg)
+static void did_set_comments(char **varp, char *errbuf, size_t errbuflen, const char **errmsg)
{
for (char *s = *varp; *s;) {
while (*s && *s != ':') {
@@ -979,7 +980,8 @@ static void did_set_comments(char **varp, char *errbuf, size_t errbuflen, char *
}
}
-static void did_set_global_listfillchars(win_T *win, char **varp, int opt_flags, char **errmsg)
+static void did_set_global_listfillchars(win_T *win, char **varp, int opt_flags,
+ const char **errmsg)
{
char **local_ptr = varp == &p_lcs ? &win->w_p_lcs : &win->w_p_fcs;
// only apply the global value to "win" when it does not have a local value
@@ -1004,7 +1006,7 @@ static void did_set_global_listfillchars(win_T *win, char **varp, int opt_flags,
}
}
-static void did_set_verbosefile(char **errmsg)
+static void did_set_verbosefile(const char **errmsg)
{
verbose_stop();
if (*p_vfile != NUL && verbose_open() == FAIL) {
@@ -1015,7 +1017,7 @@ static void did_set_verbosefile(char **errmsg)
static int shada_idx = -1;
static void did_set_shada(vimoption_T **opt, int *opt_idx, bool *free_oldval, char *errbuf,
- size_t errbuflen, char **errmsg)
+ size_t errbuflen, const char **errmsg)
{
// TODO(ZyX-I): Remove this code in the future, alongside with &viminfo
// option.
@@ -1073,7 +1075,7 @@ static void did_set_shada(vimoption_T **opt, int *opt_idx, bool *free_oldval, ch
}
}
-static void did_set_showbreak(char **varp, char **errmsg)
+static void did_set_showbreak(char **varp, const char **errmsg)
{
for (char *s = *varp; *s;) {
if (ptr2cells(s) != 1) {
@@ -1097,14 +1099,14 @@ static void did_set_titleiconstring(char **varp)
did_set_title();
}
-static void did_set_selection(char **errmsg)
+static void did_set_selection(const char **errmsg)
{
if (*p_sel == NUL || check_opt_strings(p_sel, p_sel_values, false) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_keymodel(char **errmsg)
+static void did_set_keymodel(const char **errmsg)
{
if (check_opt_strings(p_km, p_km_values, true) != OK) {
*errmsg = e_invarg;
@@ -1114,7 +1116,7 @@ static void did_set_keymodel(char **errmsg)
km_startsel = (vim_strchr(p_km, 'a') != NULL);
}
-static void did_set_display(char **errmsg)
+static void did_set_display(const char **errmsg)
{
if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, true) != OK) {
*errmsg = e_invarg;
@@ -1124,7 +1126,7 @@ static void did_set_display(char **errmsg)
msg_grid_validate();
}
-static void did_set_spellfile(char **varp, char **errmsg)
+static void did_set_spellfile(char **varp, const char **errmsg)
{
// When there is a window for this buffer in which 'spell'
// is set load the wordlists.
@@ -1136,7 +1138,7 @@ static void did_set_spellfile(char **varp, char **errmsg)
}
}
-static void did_set_spell(char **varp, char **errmsg)
+static void did_set_spell(char **varp, const char **errmsg)
{
// When there is a window for this buffer in which 'spell'
// is set load the wordlists.
@@ -1147,13 +1149,13 @@ static void did_set_spell(char **varp, char **errmsg)
}
}
-static void did_set_spellcapcheck(win_T *win, char **errmsg)
+static void did_set_spellcapcheck(win_T *win, const char **errmsg)
{
// When 'spellcapcheck' is set compile the regexp program.
*errmsg = compile_cap_prog(win->w_s);
}
-static void did_set_spelloptions(win_T *win, char **errmsg)
+static void did_set_spelloptions(win_T *win, const char **errmsg)
{
if (opt_strings_flags(win->w_s->b_p_spo, p_spo_values, &(win->w_s->b_p_spo_flags),
true) != OK) {
@@ -1161,21 +1163,21 @@ static void did_set_spelloptions(win_T *win, char **errmsg)
}
}
-static void did_set_spellsuggest(char **errmsg)
+static void did_set_spellsuggest(const char **errmsg)
{
if (spell_check_sps() != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_mkspellmem(char **errmsg)
+static void did_set_mkspellmem(const char **errmsg)
{
if (spell_check_msm() != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg)
+static void did_set_buftype(buf_T *buf, win_T *win, const char **errmsg)
{
// When 'buftype' is set, check for valid value.
if ((buf->terminal && buf->b_p_bt[0] != 't')
@@ -1193,7 +1195,7 @@ static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg)
}
// 'statusline', 'winbar', 'tabline', 'rulerformat' or 'statuscolumn'
-static void did_set_statusline(win_T *win, char **varp, char **gvarp, char **errmsg)
+static void did_set_statusline(win_T *win, char **varp, char **gvarp, const char **errmsg)
{
if (varp == &p_ruf) { // reset ru_wid first
ru_wid = 0;
@@ -1227,7 +1229,7 @@ static void did_set_statusline(win_T *win, char **varp, char **gvarp, char **err
}
}
-static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, char **errmsg)
+static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, const char **errmsg)
{
// check if it is a valid value for 'complete' -- Acevedo
for (char *s = *varp; *s;) {
@@ -1265,7 +1267,7 @@ static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, char *
}
}
-static void did_set_completeopt(char **errmsg)
+static void did_set_completeopt(const char **errmsg)
{
if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
*errmsg = e_invarg;
@@ -1275,7 +1277,7 @@ static void did_set_completeopt(char **errmsg)
}
#ifdef BACKSLASH_IN_FILENAME
-static void did_set_completeslash(buf_T *buf, char **errmsg)
+static void did_set_completeslash(buf_T *buf, const char **errmsg)
{
if (check_opt_strings(p_csl, p_csl_values, false) != OK
|| check_opt_strings(buf->b_p_csl, p_csl_values, false) != OK) {
@@ -1284,7 +1286,7 @@ static void did_set_completeslash(buf_T *buf, char **errmsg)
}
#endif
-static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, char **errmsg)
+static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, const char **errmsg)
{
if (check_signcolumn(*varp) != OK) {
*errmsg = e_invarg;
@@ -1298,14 +1300,14 @@ static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, char
}
}
-static void did_set_foldcolumn(char **varp, char **errmsg)
+static void did_set_foldcolumn(char **varp, const char **errmsg)
{
if (**varp == NUL || check_opt_strings(*varp, p_fdc_values, false) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_backspace(char **errmsg)
+static void did_set_backspace(const char **errmsg)
{
if (ascii_isdigit(*p_bs)) {
if (*p_bs > '3' || p_bs[1] != NUL) {
@@ -1316,7 +1318,7 @@ static void did_set_backspace(char **errmsg)
}
}
-static void did_set_tagcase(buf_T *buf, int opt_flags, char **errmsg)
+static void did_set_tagcase(buf_T *buf, int opt_flags, const char **errmsg)
{
unsigned int *flags;
char *p;
@@ -1338,14 +1340,14 @@ static void did_set_tagcase(buf_T *buf, int opt_flags, char **errmsg)
}
}
-static void did_set_diffopt(char **errmsg)
+static void did_set_diffopt(const char **errmsg)
{
if (diffopt_changed() == FAIL) {
*errmsg = e_invarg;
}
}
-static void did_set_foldmethod(win_T *win, char **varp, char **errmsg)
+static void did_set_foldmethod(win_T *win, char **varp, const char **errmsg)
{
if (check_opt_strings(*varp, p_fdm_values, false) != OK
|| *win->w_p_fdm == NUL) {
@@ -1358,7 +1360,7 @@ static void did_set_foldmethod(win_T *win, char **varp, char **errmsg)
}
}
-static void did_set_foldmarker(win_T *win, char **varp, char **errmsg)
+static void did_set_foldmarker(win_T *win, char **varp, const char **errmsg)
{
char *p = vim_strchr(*varp, ',');
if (p == NULL) {
@@ -1370,7 +1372,7 @@ static void did_set_foldmarker(win_T *win, char **varp, char **errmsg)
}
}
-static void did_set_commentstring(char **varp, char **errmsg)
+static void did_set_commentstring(char **varp, const char **errmsg)
{
if (**varp != NUL && strstr(*varp, "%s") == NULL) {
*errmsg = N_("E537: 'commentstring' must be empty or contain %s");
@@ -1384,7 +1386,7 @@ static void did_set_foldignore(win_T *win)
}
}
-static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **errmsg)
+static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, const char **errmsg)
{
char *ve = p_ve;
unsigned int *flags = &ve_flags;
@@ -1410,7 +1412,7 @@ static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **
}
}
-static void did_set_lispoptions(char **varp, char **errmsg)
+static void did_set_lispoptions(char **varp, const char **errmsg)
{
if (**varp != NUL && strcmp(*varp, "expr:0") != 0 && strcmp(*varp, "expr:1") != 0) {
*errmsg = e_invarg;
@@ -1418,7 +1420,7 @@ static void did_set_lispoptions(char **varp, char **errmsg)
}
static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_checked,
- bool *value_changed, char **errmsg)
+ bool *value_changed, const char **errmsg)
{
if (!valid_filetype(*varp)) {
*errmsg = e_invarg;
@@ -1432,14 +1434,14 @@ static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_che
*value_checked = true;
}
-static void did_set_winhl(win_T *win, char **errmsg)
+static void did_set_winhl(win_T *win, const char **errmsg)
{
if (!parse_winhl_opt(win)) {
*errmsg = e_invarg;
}
}
-static void did_set_varsoftabstop(buf_T *buf, char **varp, char **errmsg)
+static void did_set_varsoftabstop(buf_T *buf, char **varp, const char **errmsg)
{
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(buf->b_p_vsts_array);
@@ -1465,7 +1467,7 @@ static void did_set_varsoftabstop(buf_T *buf, char **varp, char **errmsg)
}
}
-static void did_set_vartabstop(buf_T *buf, win_T *win, char **varp, char **errmsg)
+static void did_set_vartabstop(buf_T *buf, win_T *win, char **varp, const char **errmsg)
{
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(buf->b_p_vts_array);
@@ -1505,7 +1507,7 @@ static void did_set_optexpr(char **varp)
// handle option that is a list of flags.
static void did_set_option_listflag(char **varp, char *flags, char *errbuf, size_t errbuflen,
- char **errmsg)
+ const char **errmsg)
{
for (char *s = *varp; *s; s++) {
if (vim_strchr(flags, (uint8_t)(*s)) == NULL) {
@@ -1569,11 +1571,11 @@ static void do_spelllang_source(win_T *win)
/// @param value_checked value was checked to be safe, no need to set P_INSECURE
///
/// @return NULL for success, or an untranslated error message for an error
-static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char **varp,
- char *oldval, char *errbuf, size_t errbuflen, int opt_flags,
- int *value_checked)
+static const char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char **varp,
+ char *oldval, char *errbuf, size_t errbuflen,
+ int opt_flags, int *value_checked)
{
- char *errmsg = NULL;
+ const char *errmsg = NULL;
bool did_chartab = false;
vimoption_T *opt = get_option(opt_idx);
bool free_oldval = (opt->flags & P_ALLOCED);
@@ -1881,8 +1883,8 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
return errmsg;
}
-char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf, size_t errbuflen,
- int opt_flags, int *value_checked)
+const char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf,
+ size_t errbuflen, int opt_flags, int *value_checked)
{
return did_set_string_option_for(curbuf, curwin, opt_idx, varp, oldval, errbuf, errbuflen,
opt_flags, value_checked);
@@ -1939,8 +1941,10 @@ int check_ff_value(char *p)
return check_opt_strings(p, p_ff_values, false);
}
-static char e_conflicts_with_value_of_listchars[] = N_("E834: Conflicts with value of 'listchars'");
-static char e_conflicts_with_value_of_fillchars[] = N_("E835: Conflicts with value of 'fillchars'");
+static const char e_conflicts_with_value_of_listchars[]
+ = N_("E834: Conflicts with value of 'listchars'");
+static const char e_conflicts_with_value_of_fillchars[]
+ = N_("E835: Conflicts with value of 'fillchars'");
/// Calls mb_cptr2char_adv(p) and returns the character.
/// If "p" starts with "\x", "\u" or "\U" the hex or unicode value is used.
@@ -1978,7 +1982,7 @@ static int get_encoded_char_adv(const char **p)
/// @param varp either the global or the window-local value.
/// @param apply if false, do not store the flags, only check for errors.
/// @return error message, NULL if it's OK.
-char *set_chars_option(win_T *wp, char **varp, bool apply)
+const char *set_chars_option(win_T *wp, char **varp, bool apply)
{
const char *last_multispace = NULL; // Last occurrence of "multispace:"
const char *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
@@ -2202,7 +2206,7 @@ char *set_chars_option(win_T *wp, char **varp, bool apply)
/// May set different defaults in case character widths change.
///
/// @return an untranslated error message if any of them is invalid, NULL otherwise.
-char *check_chars_options(void)
+const char *check_chars_options(void)
{
if (set_chars_option(curwin, &p_lcs, false) != NULL) {
return e_conflicts_with_value_of_listchars;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 9f6181f986..c17a6366fe 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -244,10 +244,10 @@ typedef struct vgr_args_S {
# include "quickfix.c.generated.h"
#endif
-static char *e_no_more_items = N_("E553: No more items");
-static char *e_current_quickfix_list_was_changed =
+static const char *e_no_more_items = N_("E553: No more items");
+static const char *e_current_quickfix_list_was_changed =
N_("E925: Current quickfix list was changed");
-static char *e_current_location_list_was_changed =
+static const char *e_current_location_list_was_changed =
N_("E926: Current location list was changed");
// Quickfix window check helper macro
@@ -2385,7 +2385,7 @@ static qfline_T *get_nth_valid_entry(qf_list_T *qfl, int errornr, int dir, int *
{
qfline_T *qf_ptr = qfl->qf_ptr;
int qf_idx = qfl->qf_index;
- char *err = e_no_more_items;
+ const char *err = e_no_more_items;
while (errornr--) {
qfline_T *prev_qf_ptr = qf_ptr;
@@ -3885,7 +3885,7 @@ static buf_T *qf_find_buf(qf_info_T *qi)
}
/// Process the 'quickfixtextfunc' option value.
-void qf_process_qftf_option(char **errmsg)
+void qf_process_qftf_option(const char **errmsg)
{
if (option_set_callback_func(p_qftf, &qftf_cb) == FAIL) {
*errmsg = e_invarg;
@@ -7304,7 +7304,7 @@ void f_getqflist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
FUNC_ATTR_NONNULL_ARG(2, 3)
{
- static char *e_invact = N_("E927: Invalid action: '%s'");
+ static const char *e_invact = N_("E927: Invalid action: '%s'");
const char *title = NULL;
char action = ' ';
static int recursive = 0;
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 0b9a9bbdec..4e3a78f10e 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -104,24 +104,24 @@ static int toggle_Magic(int x)
#define MAX_LIMIT (32767L << 16L)
-static char e_missingbracket[] = N_("E769: Missing ] after %s[");
-static char e_reverse_range[] = N_("E944: Reverse range in character class");
-static char e_large_class[] = N_("E945: Range too large in character class");
-static char e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
-static char e_unmatchedp[] = N_("E54: Unmatched %s(");
-static char e_unmatchedpar[] = N_("E55: Unmatched %s)");
-static char e_z_not_allowed[] = N_("E66: \\z( not allowed here");
-static char e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
-static char e_missing_sb[] = N_("E69: Missing ] after %s%%[");
-static char e_empty_sb[] = N_("E70: Empty %s%%[]");
-static char e_recursive[] = N_("E956: Cannot use pattern recursively");
-static char e_regexp_number_after_dot_pos_search_chr[]
+static const char e_missingbracket[] = N_("E769: Missing ] after %s[");
+static const char e_reverse_range[] = N_("E944: Reverse range in character class");
+static const char e_large_class[] = N_("E945: Range too large in character class");
+static const char e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
+static const char e_unmatchedp[] = N_("E54: Unmatched %s(");
+static const char e_unmatchedpar[] = N_("E55: Unmatched %s)");
+static const char e_z_not_allowed[] = N_("E66: \\z( not allowed here");
+static const char e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
+static const char e_missing_sb[] = N_("E69: Missing ] after %s%%[");
+static const char e_empty_sb[] = N_("E70: Empty %s%%[]");
+static const char e_recursive[] = N_("E956: Cannot use pattern recursively");
+static const char e_regexp_number_after_dot_pos_search_chr[]
= N_("E1204: No Number allowed after .: '\\%%%c'");
-static char e_nfa_regexp_missing_value_in_chr[]
+static const char e_nfa_regexp_missing_value_in_chr[]
= N_("E1273: (NFA regexp) missing value in '\\%%%c'");
-static char e_atom_engine_must_be_at_start_of_pattern[]
+static const char e_atom_engine_must_be_at_start_of_pattern[]
= N_("E1281: Atom '\\%%#=%c' must be at the start of the pattern");
-static char e_substitute_nesting_too_deep[] = N_("E1290: substitute nesting too deep");
+static const char e_substitute_nesting_too_deep[] = N_("E1290: substitute nesting too deep");
#define NOT_MULTI 0
#define MULTI_ONE 1
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 950814880b..b02c38fb6c 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -244,10 +244,10 @@ static int nfa_classcodes[] = {
NFA_UPPER, NFA_NUPPER
};
-static char e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
-static char e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
-static char e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %" PRId64);
-static char e_value_too_large[] = N_("E951: \\% value too large");
+static const char e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
+static const char e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
+static const char e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %" PRId64);
+static const char e_value_too_large[] = N_("E951: \\% value too large");
// Since the out pointers in the list are always
// uninitialized, we use the pointers themselves
@@ -1918,7 +1918,7 @@ static int nfa_regatom(void)
case Magic('|'):
case Magic('&'):
case Magic(')'):
- semsg(_(e_misplaced), (int64_t)no_Magic(c)); // -V1037
+ semsg(_(e_misplaced), (char)no_Magic(c)); // -V1037
return FAIL;
case Magic('='):
@@ -1928,7 +1928,7 @@ static int nfa_regatom(void)
case Magic('*'):
case Magic('{'):
// these should follow an atom, not form an atom
- semsg(_(e_misplaced), (int64_t)no_Magic(c));
+ semsg(_(e_misplaced), (char)no_Magic(c));
return FAIL;
case Magic('~'): {
@@ -3274,7 +3274,7 @@ static void nfa_set_code(int c)
}
static FILE *log_fd;
-static uint8_t e_log_open_failed[] =
+static const uint8_t e_log_open_failed[] =
N_("Could not open temporary log file for writing, displaying on stderr... ");
// Print the postfix notation of the current regexp.
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 9108059b4d..6623ba47af 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -3619,9 +3619,9 @@ bool valid_spellfile(const char *val)
return true;
}
-char *did_set_spell_option(bool is_spellfile)
+const char *did_set_spell_option(bool is_spellfile)
{
- char *errmsg = NULL;
+ const char *errmsg = NULL;
if (is_spellfile) {
int l = (int)strlen(curwin->w_s->b_p_spf);
@@ -3646,7 +3646,7 @@ char *did_set_spell_option(bool is_spellfile)
/// Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
/// Return error message when failed, NULL when OK.
-char *compile_cap_prog(synblock_T *synblock)
+const char *compile_cap_prog(synblock_T *synblock)
FUNC_ATTR_NONNULL_ALL
{
regprog_T *rp = synblock->b_cap_prog;
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index aa76dcbd32..b5e0698240 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -322,11 +322,11 @@ enum {
CF_UPPER = 0x02,
};
-static char *e_spell_trunc = N_("E758: Truncated spell file");
-static char *e_illegal_character_in_word = N_("E1280: Illegal character in word");
-static char *e_afftrailing = N_("Trailing text in %s line %d: %s");
-static char *e_affname = N_("Affix name too long in %s line %d: %s");
-static char *msg_compressing = N_("Compressing word tree...");
+static const char *e_spell_trunc = N_("E758: Truncated spell file");
+static const char *e_illegal_character_in_word = N_("E1280: Illegal character in word");
+static const char *e_afftrailing = N_("Trailing text in %s line %d: %s");
+static const char *e_affname = N_("Affix name too long in %s line %d: %s");
+static const char *msg_compressing = N_("Compressing word tree...");
#define MAXLINELEN 500 // Maximum length in bytes of a line in a .aff
// and .dic file.
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 14fef19399..c0bb7d726e 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -58,7 +58,7 @@ static bool did_syntax_onoff = false;
#define SPO_LC_OFF 6 // leading context offset
#define SPO_COUNT 7
-static char e_illegal_arg[] = N_("E390: Illegal argument: %s");
+static const char e_illegal_arg[] = N_("E390: Illegal argument: %s");
// The patterns that are being searched for are stored in a syn_pattern.
// A match item consists of one pattern.
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 2d9d0de951..a9ef884214 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -188,11 +188,11 @@ typedef struct {
# include "tag.c.generated.h"
#endif
-static char *bottommsg = N_("E555: at bottom of tag stack");
-static char *topmsg = N_("E556: at top of tag stack");
-static char *recurmsg = N_("E986: cannot modify the tag stack within tagfunc");
-static char *tfu_inv_ret_msg = N_("E987: invalid return value from tagfunc");
-static char e_window_unexpectedly_close_while_searching_for_tags[]
+static const char *bottommsg = N_("E555: at bottom of tag stack");
+static const char *topmsg = N_("E556: at top of tag stack");
+static const char *recurmsg = N_("E986: cannot modify the tag stack within tagfunc");
+static const char *tfu_inv_ret_msg = N_("E987: invalid return value from tagfunc");
+static const char e_window_unexpectedly_close_while_searching_for_tags[]
= N_("E1299: Window unexpectedly closed while searching for tags");
static char *tagmatchname = NULL; // name of last used tag
@@ -210,7 +210,7 @@ static Callback tfu_cb; // 'tagfunc' callback function
/// Reads the 'tagfunc' option value and convert that to a callback value.
/// Invoked when the 'tagfunc' option is set. The option value can be a name of
/// a function (string), or function(<name>) or funcref(<name>) or a lambda.
-void set_tagfunc_option(char **errmsg)
+void set_tagfunc_option(const char **errmsg)
{
callback_free(&tfu_cb);
callback_free(&curbuf->b_tfu_cb);
diff --git a/src/nvim/testing.c b/src/nvim/testing.c
index 3569856f2c..2b5284e15e 100644
--- a/src/nvim/testing.c
+++ b/src/nvim/testing.c
@@ -34,13 +34,13 @@
# include "testing.c.generated.h"
#endif
-static char e_assert_fails_second_arg[]
+static const char e_assert_fails_second_arg[]
= N_("E856: assert_fails() second argument must be a string or a list with one or two strings");
-static char e_assert_fails_fourth_argument[]
+static const char e_assert_fails_fourth_argument[]
= N_("E1115: assert_fails() fourth argument must be a number");
-static char e_assert_fails_fifth_argument[]
+static const char e_assert_fails_fifth_argument[]
= N_("E1116: assert_fails() fifth argument must be a string");
-static char e_calling_test_garbagecollect_now_while_v_testing_is_not_set[]
+static const char e_calling_test_garbagecollect_now_while_v_testing_is_not_set[]
= N_("E1142: Calling test_garbagecollect_now() while v:testing is not set");
/// Prepare "gap" for an assert error and add the sourcing position.
@@ -507,7 +507,7 @@ void f_assert_fails(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
garray_T ga;
int save_trylevel = trylevel;
const int called_emsg_before = called_emsg;
- char *wrong_arg_msg = NULL;
+ const char *wrong_arg_msg = NULL;
// trylevel must be zero for a ":throw" command to be considered failed
trylevel = 0;
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index ad33ba4667..873970fc39 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -624,7 +624,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
// extra fields for uhp
#define UHP_SAVE_NR 1
-static char e_not_open[] = N_("E828: Cannot open undo file for writing: %s");
+static const char e_not_open[] = N_("E828: Cannot open undo file for writing: %s");
/// Compute the hash for a buffer text into hash[UNDO_HASH_SIZE].
///
diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c
index 6869f7eaf9..b58ccc809b 100644
--- a/src/nvim/usercmd.c
+++ b/src/nvim/usercmd.c
@@ -44,11 +44,11 @@
garray_T ucmds = { 0, 0, sizeof(ucmd_T), 4, NULL };
-static char e_complete_used_without_allowing_arguments[]
+static const char e_complete_used_without_allowing_arguments[]
= N_("E1208: -complete used without allowing arguments");
-static char e_no_such_user_defined_command_str[]
+static const char e_no_such_user_defined_command_str[]
= N_("E184: No such user-defined command: %s");
-static char e_no_such_user_defined_command_in_current_buffer_str[]
+static const char e_no_such_user_defined_command_in_current_buffer_str[]
= N_("E1237: No such user-defined command in current buffer: %s");
/// List of names for completion for ":command" with the EXPAND_ flag.
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 48663c5a20..b41d054ac3 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -96,7 +96,7 @@ typedef enum {
WEE_TRIGGER_LEAVE_AUTOCMDS = 0x10,
} wee_flags_T;
-static char e_cannot_split_window_when_closing_buffer[]
+static const char e_cannot_split_window_when_closing_buffer[]
= N_("E1159: Cannot split a window when closing the buffer");
static char *m_onlyone = N_("Already only one window");
@@ -7422,7 +7422,7 @@ static int int_cmp(const void *a, const void *b)
/// Handle setting 'colorcolumn' or 'textwidth' in window "wp".
///
/// @return error message, NULL if it's OK.
-char *check_colorcolumn(win_T *wp)
+const char *check_colorcolumn(win_T *wp)
{
if (wp->w_buffer == NULL) {
return NULL; // buffer was closed
diff --git a/test/functional/lua/fs_spec.lua b/test/functional/lua/fs_spec.lua
index aeb2e5d9a6..2fcbc9450f 100644
--- a/test/functional/lua/fs_spec.lua
+++ b/test/functional/lua/fs_spec.lua
@@ -271,10 +271,11 @@ describe('vim.fs', function()
eq('C:/Users/jdoe', exec_lua [[ return vim.fs.normalize('C:\\Users\\jdoe') ]])
end)
it('works with ~', function()
- if is_os('win') then
- pending([[$HOME does not exist on Windows ¯\_(ツ)_/¯]])
- end
- eq(os.getenv('HOME') .. '/src/foo', exec_lua [[ return vim.fs.normalize('~/src/foo') ]])
+ eq( exec_lua([[
+ local home = ...
+ return home .. '/src/foo'
+ ]], is_os('win') and vim.fs.normalize(os.getenv('USERPROFILE')) or os.getenv('HOME')
+ ) , exec_lua [[ return vim.fs.normalize('~/src/foo') ]])
end)
it('works with environment variables', function()
local xdg_config_home = test_build_dir .. '/.config'
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 4f401eed8f..9508469a61 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -2721,11 +2721,11 @@ describe('lua stdlib', function()
it('does not cause ml_get errors with invalid visual selection', function()
-- Should be fixed by vim-patch:8.2.4028.
exec_lua [[
- local a = vim.api
- local t = function(s) return a.nvim_replace_termcodes(s, true, true, true) end
- a.nvim_buf_set_lines(0, 0, -1, true, {"a", "b", "c"})
- a.nvim_feedkeys(t "G<C-V>", "txn", false)
- a.nvim_buf_call(a.nvim_create_buf(false, true), function() vim.cmd "redraw" end)
+ local api = vim.api
+ local t = function(s) return api.nvim_replace_termcodes(s, true, true, true) end
+ api.nvim_buf_set_lines(0, 0, -1, true, {"a", "b", "c"})
+ api.nvim_feedkeys(t "G<C-V>", "txn", false)
+ api.nvim_buf_call(api.nvim_create_buf(false, true), function() vim.cmd "redraw" end)
]]
end)
@@ -2800,29 +2800,29 @@ describe('lua stdlib', function()
it('does not cause ml_get errors with invalid visual selection', function()
-- Add lines to the current buffer and make another window looking into an empty buffer.
exec_lua [[
- _G.a = vim.api
- _G.t = function(s) return a.nvim_replace_termcodes(s, true, true, true) end
- _G.win_lines = a.nvim_get_current_win()
+ _G.api = vim.api
+ _G.t = function(s) return api.nvim_replace_termcodes(s, true, true, true) end
+ _G.win_lines = api.nvim_get_current_win()
vim.cmd "new"
- _G.win_empty = a.nvim_get_current_win()
- a.nvim_set_current_win(win_lines)
- a.nvim_buf_set_lines(0, 0, -1, true, {"a", "b", "c"})
+ _G.win_empty = api.nvim_get_current_win()
+ api.nvim_set_current_win(win_lines)
+ api.nvim_buf_set_lines(0, 0, -1, true, {"a", "b", "c"})
]]
-- Start Visual in current window, redraw in other window with fewer lines.
-- Should be fixed by vim-patch:8.2.4018.
exec_lua [[
- a.nvim_feedkeys(t "G<C-V>", "txn", false)
- a.nvim_win_call(win_empty, function() vim.cmd "redraw" end)
+ api.nvim_feedkeys(t "G<C-V>", "txn", false)
+ api.nvim_win_call(win_empty, function() vim.cmd "redraw" end)
]]
-- Start Visual in current window, extend it in other window with more lines.
-- Fixed for win_execute by vim-patch:8.2.4026, but nvim_win_call should also not be affected.
exec_lua [[
- a.nvim_feedkeys(t "<Esc>gg", "txn", false)
- a.nvim_set_current_win(win_empty)
- a.nvim_feedkeys(t "gg<C-V>", "txn", false)
- a.nvim_win_call(win_lines, function() a.nvim_feedkeys(t "G<C-V>", "txn", false) end)
+ api.nvim_feedkeys(t "<Esc>gg", "txn", false)
+ api.nvim_set_current_win(win_empty)
+ api.nvim_feedkeys(t "gg<C-V>", "txn", false)
+ api.nvim_win_call(win_lines, function() api.nvim_feedkeys(t "G<C-V>", "txn", false) end)
vim.cmd "redraw"
]]
end)
@@ -2836,14 +2836,14 @@ describe('lua stdlib', function()
}
screen:attach()
exec_lua [[
- _G.a = vim.api
+ _G.api = vim.api
vim.opt.ruler = true
local lines = {}
for i = 0, 499 do lines[#lines + 1] = tostring(i) end
- a.nvim_buf_set_lines(0, 0, -1, true, lines)
- a.nvim_win_set_cursor(0, {20, 0})
+ api.nvim_buf_set_lines(0, 0, -1, true, lines)
+ api.nvim_win_set_cursor(0, {20, 0})
vim.cmd "split"
- _G.win = a.nvim_get_current_win()
+ _G.win = api.nvim_get_current_win()
vim.cmd "wincmd w | redraw"
]]
screen:expect [[
@@ -2854,7 +2854,7 @@ describe('lua stdlib', function()
|
]]
exec_lua [[
- a.nvim_win_call(win, function() a.nvim_win_set_cursor(0, {100, 0}) end)
+ api.nvim_win_call(win, function() api.nvim_win_set_cursor(0, {100, 0}) end)
vim.cmd "redraw"
]]
screen:expect [[
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 00a35a5c6c..5d967e0340 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -575,12 +575,12 @@ describe("pending scrollback line handling", function()
it("does not crash after setting 'number' #14891", function()
exec_lua [[
- local a = vim.api
- local buf = a.nvim_create_buf(true, true)
- local chan = a.nvim_open_term(buf, {})
- a.nvim_win_set_option(0, "number", true)
- a.nvim_chan_send(chan, ("a\n"):rep(11) .. "a")
- a.nvim_win_set_buf(0, buf)
+ local api = vim.api
+ local buf = api.nvim_create_buf(true, true)
+ local chan = api.nvim_open_term(buf, {})
+ api.nvim_win_set_option(0, "number", true)
+ api.nvim_chan_send(chan, ("a\n"):rep(11) .. "a")
+ api.nvim_win_set_buf(0, buf)
]]
screen:expect [[
{1: 1 }^a |
@@ -607,12 +607,11 @@ describe("pending scrollback line handling", function()
it("does not crash after nvim_buf_call #14891", function()
skip(is_os('win'))
exec_lua [[
- local a = vim.api
- local bufnr = a.nvim_create_buf(false, true)
- a.nvim_buf_call(bufnr, function()
+ local bufnr = vim.api.nvim_create_buf(false, true)
+ vim.api.nvim_buf_call(bufnr, function()
vim.fn.termopen({"echo", ("hi\n"):rep(11)})
end)
- a.nvim_win_set_buf(0, bufnr)
+ vim.api.nvim_win_set_buf(0, bufnr)
vim.cmd("startinsert")
]]
screen:expect [[
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index ea9958b12a..9afce0b3a0 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -948,4 +948,48 @@ int x = INT_MAX;
[16] = '1',
[17] = '0' }, get_fold_levels())
end)
+
+ it('tracks the root range properly (#22911)', function()
+ insert([[
+ int main() {
+ int x = 3;
+ }]])
+
+ local query0 = [[
+ (declaration) @declaration
+ (function_definition) @function
+ ]]
+
+ exec_lua([[
+ vim.treesitter.start(0, 'c')
+ ]])
+
+ local function run_query()
+ return exec_lua([[
+ local query = vim.treesitter.query.parse("c", ...)
+ parser = vim.treesitter.get_parser()
+ tree = parser:parse()[1]
+ res = {}
+ for id, node in query:iter_captures(tree:root()) do
+ table.insert(res, {query.captures[id], node:range()})
+ end
+ return res
+ ]], query0)
+ end
+
+ eq({
+ { 'function', 0, 0, 2, 1 },
+ { 'declaration', 1, 2, 1, 12 }
+ }, run_query())
+
+ helpers.command'normal ggO'
+ insert('int a;')
+
+ eq({
+ { 'declaration', 0, 0, 0, 6 },
+ { 'function', 1, 0, 3, 1 },
+ { 'declaration', 2, 2, 2, 12 }
+ }, run_query())
+
+ end)
end)
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index d03d2f1374..80e5b6230e 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -47,15 +47,15 @@ describe('decorations providers', function()
local function setup_provider(code)
return exec_lua ([[
- local a = vim.api
- _G.ns1 = a.nvim_create_namespace "ns1"
+ local api = vim.api
+ _G.ns1 = api.nvim_create_namespace "ns1"
]] .. (code or [[
beamtrace = {}
local function on_do(kind, ...)
table.insert(beamtrace, {kind, ...})
end
]]) .. [[
- a.nvim_set_decoration_provider(_G.ns1, {
+ api.nvim_set_decoration_provider(_G.ns1, {
on_start = on_do; on_buf = on_do;
on_win = on_do; on_line = on_do;
on_end = on_do; _on_spell_nav = on_do;
@@ -75,8 +75,8 @@ describe('decorations providers', function()
-- rather than append, which used to spin in an infinite loop allocating
-- memory until nvim crashed/was killed.
setup_provider([[
- local ns2 = a.nvim_create_namespace "ns2"
- a.nvim_set_decoration_provider(ns2, {})
+ local ns2 = api.nvim_create_namespace "ns2"
+ api.nvim_set_decoration_provider(ns2, {})
]])
helpers.assert_alive()
end)
@@ -132,12 +132,12 @@ describe('decorations providers', function()
it('can have single provider', function()
insert(mulholland)
setup_provider [[
- local hl = a.nvim_get_hl_id_by_name "ErrorMsg"
- local test_ns = a.nvim_create_namespace "mulholland"
+ local hl = api.nvim_get_hl_id_by_name "ErrorMsg"
+ local test_ns = api.nvim_create_namespace "mulholland"
function on_do(event, ...)
if event == "line" then
local win, buf, line = ...
- a.nvim_buf_set_extmark(buf, test_ns, line, line,
+ api.nvim_buf_set_extmark(buf, test_ns, line, line,
{ end_line = line, end_col = line+1,
hl_group = hl,
ephemeral = true
@@ -172,11 +172,11 @@ describe('decorations providers', function()
]]
setup_provider [[
- local ns = a.nvim_create_namespace "spell"
+ local ns = api.nvim_create_namespace "spell"
beamtrace = {}
local function on_do(kind, ...)
if kind == 'win' or kind == 'spell' then
- a.nvim_buf_set_extmark(0, ns, 0, 0, {
+ api.nvim_buf_set_extmark(0, ns, 0, 0, {
end_row = 2,
end_col = 23,
spell = true,
@@ -330,12 +330,12 @@ describe('decorations providers', function()
]]}
exec_lua [[
- local a = vim.api
- local thewin = a.nvim_get_current_win()
- local ns2 = a.nvim_create_namespace 'ns2'
- a.nvim_set_decoration_provider (ns2, {
+ local api = vim.api
+ local thewin = api.nvim_get_current_win()
+ local ns2 = api.nvim_create_namespace 'ns2'
+ api.nvim_set_decoration_provider (ns2, {
on_win = function (_, win, buf)
- a.nvim_set_hl_ns_fast(win == thewin and _G.ns1 or ns2)
+ api.nvim_set_hl_ns_fast(win == thewin and _G.ns1 or ns2)
end;
})
]]
@@ -436,12 +436,12 @@ describe('decorations providers', function()
it('can have virtual text', function()
insert(mulholland)
setup_provider [[
- local hl = a.nvim_get_hl_id_by_name "ErrorMsg"
- local test_ns = a.nvim_create_namespace "mulholland"
+ local hl = api.nvim_get_hl_id_by_name "ErrorMsg"
+ local test_ns = api.nvim_create_namespace "mulholland"
function on_do(event, ...)
if event == "line" then
local win, buf, line = ...
- a.nvim_buf_set_extmark(buf, test_ns, line, 0, {
+ api.nvim_buf_set_extmark(buf, test_ns, line, 0, {
virt_text = {{'+', 'ErrorMsg'}};
virt_text_pos='overlay';
ephemeral = true;
@@ -465,12 +465,12 @@ describe('decorations providers', function()
it('can have virtual text of the style: right_align', function()
insert(mulholland)
setup_provider [[
- local hl = a.nvim_get_hl_id_by_name "ErrorMsg"
- local test_ns = a.nvim_create_namespace "mulholland"
+ local hl = api.nvim_get_hl_id_by_name "ErrorMsg"
+ local test_ns = api.nvim_create_namespace "mulholland"
function on_do(event, ...)
if event == "line" then
local win, buf, line = ...
- a.nvim_buf_set_extmark(buf, test_ns, line, 0, {
+ api.nvim_buf_set_extmark(buf, test_ns, line, 0, {
virt_text = {{'+'}, {string.rep(' ', line+1), 'ErrorMsg'}};
virt_text_pos='right_align';
ephemeral = true;
@@ -494,12 +494,12 @@ describe('decorations providers', function()
it('can highlight beyond EOL', function()
insert(mulholland)
setup_provider [[
- local test_ns = a.nvim_create_namespace "veberod"
+ local test_ns = api.nvim_create_namespace "veberod"
function on_do(event, ...)
if event == "line" then
local win, buf, line = ...
- if string.find(a.nvim_buf_get_lines(buf, line, line+1, true)[1], "buf") then
- a.nvim_buf_set_extmark(buf, test_ns, line, 0, {
+ if string.find(api.nvim_buf_get_lines(buf, line, line+1, true)[1], "buf") then
+ api.nvim_buf_set_extmark(buf, test_ns, line, 0, {
end_line = line+1;
hl_group = 'DiffAdd';
hl_eol = true;
@@ -534,9 +534,9 @@ describe('decorations providers', function()
local function on_do(kind, winid, bufnr, topline, botline_guess)
if kind == 'win' then
if topline < 100 and botline_guess > 100 then
- vim.api.nvim_buf_set_extmark(bufnr, ns1, 99, -1, { sign_text = 'X' })
+ api.nvim_buf_set_extmark(bufnr, ns1, 99, -1, { sign_text = 'X' })
else
- vim.api.nvim_buf_clear_namespace(bufnr, ns1, 0, -1)
+ api.nvim_buf_clear_namespace(bufnr, ns1, 0, -1)
end
end
end
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 890678e363..f88954c16b 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -65,20 +65,20 @@ describe('float window', function()
it('closed immediately by autocmd #11383', function()
eq('Window was closed immediately',
pcall_err(exec_lua, [[
- local a = vim.api
+ local api = vim.api
local function crashes(contents)
- local buf = a.nvim_create_buf(false, true)
- local floatwin = a.nvim_open_win(buf, true, {
+ local buf = api.nvim_create_buf(false, true)
+ local floatwin = api.nvim_open_win(buf, true, {
relative = 'cursor';
style = 'minimal';
row = 0; col = 0;
height = #contents;
width = 10;
})
- a.nvim_buf_set_lines(buf, 0, -1, true, contents)
+ api.nvim_buf_set_lines(buf, 0, -1, true, contents)
local winnr = vim.fn.win_id2win(floatwin)
- a.nvim_command('wincmd p')
- a.nvim_command('autocmd CursorMoved * ++once '..winnr..'wincmd c')
+ api.nvim_command('wincmd p')
+ api.nvim_command('autocmd CursorMoved * ++once '..winnr..'wincmd c')
return buf, floatwin
end
crashes{'foo'}