aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--runtime/doc/api.txt20
-rw-r--r--runtime/doc/lsp.txt60
-rw-r--r--runtime/doc/lua.txt14
-rw-r--r--runtime/doc/options.txt6
-rw-r--r--runtime/doc/treesitter.txt3
-rw-r--r--runtime/filetype.vim34
-rw-r--r--runtime/lua/vim/lsp.lua51
-rw-r--r--runtime/lua/vim/lsp/handlers.lua1
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua18
-rw-r--r--runtime/lua/vim/treesitter/query.lua19
-rw-r--r--runtime/nvim.appdata.xml1
-rw-r--r--runtime/scripts.vim4
-rw-r--r--src/nvim/api/buffer.c42
-rw-r--r--src/nvim/api/private/helpers.c37
-rw-r--r--src/nvim/api/vim.c42
-rw-r--r--src/nvim/decoration.c2
-rw-r--r--src/nvim/ex_docmd.c19
-rw-r--r--src/nvim/ex_getln.c13
-rw-r--r--src/nvim/extmark.c9
-rw-r--r--src/nvim/lua/executor.c74
-rw-r--r--src/nvim/lua/vim.lua171
-rw-r--r--src/nvim/main.c1
-rw-r--r--src/nvim/message.c34
-rw-r--r--src/nvim/message.h9
-rw-r--r--src/nvim/normal.c29
-rw-r--r--src/nvim/option.c39
-rw-r--r--src/nvim/po/af.po7
-rw-r--r--src/nvim/po/ca.po4
-rw-r--r--src/nvim/po/cs.cp1250.po4
-rw-r--r--src/nvim/po/cs.po4
-rw-r--r--src/nvim/po/da.po3
-rw-r--r--src/nvim/po/de.po4
-rw-r--r--src/nvim/po/en_GB.po4
-rw-r--r--src/nvim/po/eo.po3
-rw-r--r--src/nvim/po/es.po4
-rw-r--r--src/nvim/po/fi.po7
-rw-r--r--src/nvim/po/fr.po3
-rw-r--r--src/nvim/po/ga.po3
-rw-r--r--src/nvim/po/it.po4
-rw-r--r--src/nvim/po/ja.euc-jp.po3
-rw-r--r--src/nvim/po/ja.po3
-rw-r--r--src/nvim/po/ko.UTF-8.po4
-rw-r--r--src/nvim/po/nb.po4
-rw-r--r--src/nvim/po/nl.po4
-rw-r--r--src/nvim/po/no.po4
-rw-r--r--src/nvim/po/pl.UTF-8.po4
-rw-r--r--src/nvim/po/pt_BR.po4
-rw-r--r--src/nvim/po/ru.po4
-rw-r--r--src/nvim/po/sk.cp1250.po4
-rw-r--r--src/nvim/po/sk.po4
-rw-r--r--src/nvim/po/sr.po3
-rw-r--r--src/nvim/po/sv.po4
-rw-r--r--src/nvim/po/uk.po253
-rw-r--r--src/nvim/po/vi.po4
-rw-r--r--src/nvim/po/zh_CN.UTF-8.po4
-rw-r--r--src/nvim/po/zh_TW.UTF-8.po4
-rw-r--r--src/nvim/spell.c11
-rw-r--r--src/nvim/testdir/test_filetype.vim23
-rw-r--r--src/nvim/testdir/test_fold.vim35
-rw-r--r--src/nvim/testdir/test_highlight.vim14
-rw-r--r--src/nvim/vim.h1
-rw-r--r--test/functional/api/extmark_spec.lua34
-rw-r--r--test/functional/api/vim_spec.lua73
-rw-r--r--test/functional/lua/command_line_completion_spec.lua171
-rw-r--r--test/functional/plugin/lsp_spec.lua19
-rw-r--r--test/functional/treesitter/parser_spec.lua35
-rw-r--r--test/functional/ui/sign_spec.lua105
-rw-r--r--test/functional/viml/completion_spec.lua43
-rw-r--r--third-party/CMakeLists.txt8
70 files changed, 1370 insertions, 324 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c179db0c46..64433e67e7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -36,6 +36,7 @@ Developer guidelines
make distclean
make # Nvim build system uses ninja automatically, if available.
```
+- [Improve documentation][wiki-contribute-help]
Pull requests (PRs)
---------------------
@@ -235,3 +236,4 @@ as context, use the `-W` argument as well.
[Clang report]: https://neovim.io/doc/reports/clang/
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
[master error list]: https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json
+[wiki-contribute-help]: https://github.com/neovim/neovim/wiki/contribute-%3Ahelp
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 12e39fdbac..dd3469372e 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -663,6 +663,17 @@ nvim_del_var({name}) *nvim_del_var()*
Parameters: ~
{name} Variable name
+nvim_echo({chunks}, {history}, {opts}) *nvim_echo()*
+ Echo a message.
+
+ Parameters: ~
+ {chunks} A list of [text, hl_group] arrays, each
+ representing a text chunk with specified
+ highlight. `hl_group` element can be omitted
+ for no highlight.
+ {history} if true, add to |message-history|.
+ {opts} Optional parameters. Reserved for future use.
+
nvim_err_write({str}) *nvim_err_write()*
Writes a message to the Vim error buffer. Does not append
"\n", the message is buffered (won't display) until a linefeed
@@ -2152,6 +2163,15 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
mark will only be used for the current redraw
cycle, and not be permantently stored in the
buffer.
+ • right_gravity : boolean that indicates the
+ direction the extmark will be shifted in when
+ new text is inserted (true for right, false
+ for left). defaults to true.
+ • end_right_gravity : boolean that indicates the
+ direction the extmark end position (if it
+ exists) will be shifted in when new text is
+ inserted (true for right, false for left).
+ Defaults to false.
Return: ~
Id of the created/updated extmark
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 193593be13..06666c3a27 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -639,8 +639,9 @@ client() *vim.lsp.client*
automatically escalate and force shutdown.
• is_stopped() Checks whether a client is stopped. Returns:
true if the client is fully stopped.
- • on_attach(client, bufnr) Runs the on_attach function from the
- client's config if it was defined. Useful for buffer-local setup.
+ • on_attach(client, bufnr) Runs the on_attach function from
+ the client's config if it was defined. Useful for
+ buffer-local setup.
• Members
• {id} (number): The id allocated to the client.
@@ -678,6 +679,14 @@ get_active_clients() *vim.lsp.get_active_clients()*
Return: ~
Table of |vim.lsp.client| objects
+ *vim.lsp.get_buffers_by_client_id()*
+get_buffers_by_client_id({client_id})
+ Parameters: ~
+ {client_id} client id
+
+ Return: ~
+ list of buffer ids
+
get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
Gets a client by id, or nil if the id is invalid. The returned
client may not yet be fully initialized.
@@ -776,8 +785,9 @@ start_client({config}) *vim.lsp.start_client()*
{handlers} Map of language server method names to
|lsp-handler|
{settings} Map with language server specific
- settings. These are returned to the language server if
- requested via `workspace/configuration`. Keys are
+ settings. These are returned to the
+ language server if requested via
+ `workspace/configuration` . Keys are
case-sensitive.
{init_options} Values to pass in the initialization
request as `initializationOptions` .
@@ -815,7 +825,14 @@ start_client({config}) *vim.lsp.start_client()*
`capabilities.offsetEncoding` was sent
to it. You can only modify the
`client.offset_encoding` here before
- any notifications are sent.
+ any notifications are sent. Most
+ language servers expect to be sent
+ client specified settings after
+ initialization. Neovim does not make
+ this assumption. A
+ `workspace/didChangeConfiguration`
+ notification should be sent to the
+ server during on_init.
{on_exit} Callback (code, signal, client_id)
invoked on client exit.
• code: exit code of the process
@@ -1342,6 +1359,10 @@ set_signs({diagnostics}, {bufnr}, {client_id}, {sign_ns}, {opts})
{sign_ns} number|nil
{opts} table Configuration for signs. Keys:
• priority: Set the priority of the signs.
+ • severity_limit (DiagnosticSeverity):
+ • Limit severity of diagnostics found.
+ E.g. "Warning" means { "Error",
+ "Warning" } will be valid.
*vim.lsp.diagnostic.set_underline()*
set_underline({diagnostics}, {bufnr}, {client_id}, {diagnostic_ns}, {opts})
@@ -1420,7 +1441,16 @@ show_line_diagnostics({opts}, {bufnr}, {line_nr}, {client_id})
{client_id} number|nil the client id
Return: ~
- {popup_bufnr, win_id}
+ table {popup_bufnr, win_id}
+
+
+==============================================================================
+Lua module: vim.lsp.handlers *lsp-handlers*
+
+ *vim.lsp.handlers.progress_callback()*
+progress_callback({_}, {_}, {params}, {client_id})
+ See also: ~
+ https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
==============================================================================
@@ -1615,6 +1645,9 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
See also: ~
|softtabstop|
+get_progress_messages() *vim.lsp.util.get_progress_messages()*
+ TODO: Documentation
+
jump_to_location({location}) *vim.lsp.util.jump_to_location()*
Jumps to a location.
@@ -1636,6 +1669,19 @@ locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
Return: ~
(table) list of items
+lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()*
+ Helper function to return nested values in language server
+ settings
+
+ Parameters: ~
+ {settings} a table of language server settings
+ {section} a string indicating the field of the settings
+ table
+
+ Return: ~
+ (table or string) The value of settings accessed via
+ section
+
*vim.lsp.util.make_floating_popup_options()*
make_floating_popup_options({width}, {height}, {opts})
Creates a table with sensible default options for a floating
@@ -1716,7 +1762,7 @@ make_workspace_params({added}, {removed})
Create the workspace params
Parameters: ~
- {added}
+ {added}
{removed}
*vim.lsp.util.open_floating_preview()*
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 92898cfad1..0bbed56662 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -1265,14 +1265,12 @@ validate({opt}) *vim.validate()*
vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}}
=> NOP (success)
-<
->
- vim.validate{arg1={1, 'table'}}
- => error('arg1: expected table, got number')
-<
->
- vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
- => error('arg1: expected even number, got 3')
+
+ vim.validate{arg1={1, 'table'}}
+ => error('arg1: expected table, got number')
+
+ vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
+ => error('arg1: expected even number, got 3')
<
Parameters: ~
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2a757bbed9..a497efa47e 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5536,6 +5536,12 @@ A jump table for the options with a short description can be found at |Q_op|.
"auto" only when there is a sign to display
"auto:[1-9]" resize to accommodate multiple signs up to the
given number (maximum 9), e.g. "auto:4"
+ "auto:[1-8]-[2-9]"
+ resize to accommodate multiple signs up to the
+ given maximum number (maximum 9) while keeping
+ at least the given minimum (maximum 8) fixed
+ space. The minimum number should always be less
+ than the maximum number, e.g. "auto:2-5"
"no" never
"yes" always
"yes:[1-9]" always, with fixed space for signs up to the given
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 911e7b8b47..1696d3b9ba 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -195,7 +195,8 @@ query:iter_captures({node}, {bufnr}, {start_row}, {end_row})
text of the buffer. {start_row} and {end_row} can be used to limit
matches inside a row range (this is typically used with root node
as the node, i e to get syntax highlight matches in the current
- viewport)
+ viewport). When omitted the start and end row values are used from
+ the given node.
The iterator returns three values, a numeric id identifying the capture,
the captured node, and metadata from any directives processing the match.
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 9104519451..53fd66c4df 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -585,6 +585,9 @@ au BufNewFile,BufRead *.fan,*.fwt setf fan
" Factor
au BufNewFile,BufRead *.factor setf factor
+" Fennel
+autocmd BufRead,BufNewFile *.fnl setf fennel
+
" Fetchmail RC file
au BufNewFile,BufRead .fetchmailrc setf fetchmail
@@ -1169,9 +1172,10 @@ au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
" Password file
au BufNewFile,BufRead */etc/passwd,*/etc/passwd-,*/etc/passwd.edit,*/etc/shadow,*/etc/shadow-,*/etc/shadow.edit,*/var/backups/passwd.bak,*/var/backups/shadow.bak setf passwd
-" Pascal (also *.p)
+" Pascal (also *.p, *.pp, *.inc)
au BufNewFile,BufRead *.pas setf pascal
+" Pascal or Puppet manifest
au BufNewFile,BufRead *.pp call dist#ft#FTpp()
" Delphi or Lazarus program file
@@ -1262,7 +1266,7 @@ au BufNewFile,BufRead *.pov setf pov
" Povray configuration
au BufNewFile,BufRead .povrayrc setf povini
-" Povray, PHP or assembly
+" Povray, Pascal, PHP or assembly
au BufNewFile,BufRead *.inc call dist#ft#FTinc()
" Printcap and Termcap
@@ -1271,13 +1275,19 @@ au BufNewFile,BufRead *printcap
au BufNewFile,BufRead *termcap
\ let b:ptcap_type = "term" | setf ptcap
-" PCCTS / ANTRL
-"au BufNewFile,BufRead *.g setf antrl
+" PCCTS / ANTLR
+"au BufNewFile,BufRead *.g setf antlr
au BufNewFile,BufRead *.g setf pccts
" PPWizard
au BufNewFile,BufRead *.it,*.ih setf ppwiz
+" Puppet
+au BufNewFile,BufRead Puppetfile setf ruby
+
+" Embedded Puppet
+au BufNewFile,BufRead *.epp setf epuppet
+
" Obj 3D file format
" TODO: is there a way to avoid MS-Windows Object files?
au BufNewFile,BufRead *.obj setf obj
@@ -1427,8 +1437,8 @@ au BufNewFile,BufRead *.rb,*.rbw setf ruby
" RubyGems
au BufNewFile,BufRead *.gemspec setf ruby
-" Rust
-au BufNewFile,BufRead *.rs setf rust
+" RBS (Ruby Signature)
+au BufNewFile,BufRead *.rbs setf rbs
" Rackup
au BufNewFile,BufRead *.ru setf ruby
@@ -1442,6 +1452,9 @@ au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby
" Rantfile and Rakefile is like Ruby
au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby
+" Rust
+au BufNewFile,BufRead *.rs setf rust
+
" S-lang (or shader language, or SmallLisp)
au BufNewFile,BufRead *.sl setf slang
@@ -1733,8 +1746,13 @@ au BufNewFile,BufRead *.tli setf tli
" Telix Salt
au BufNewFile,BufRead *.slt setf tsalt
-" Tera Term Language
-au BufRead,BufNewFile *.ttl setf teraterm
+" Tera Term Language or Turtle
+au BufRead,BufNewFile *.ttl
+ \ if getline(1) =~ '^@\?\(prefix\|base\)' |
+ \ setf turtle |
+ \ else |
+ \ setf teraterm |
+ \ endif
" Terminfo
au BufNewFile,BufRead *.ti setf terminfo
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 9e05eeae89..a6f118abde 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -121,6 +121,9 @@ local active_clients = {}
local all_buffer_active_clients = {}
local uninitialized_clients = {}
+-- Tracks all buffers attached to a client.
+local all_client_active_buffers = {}
+
--@private
--- Invokes a function for each LSP client attached to the buffer {bufnr}.
---
@@ -226,6 +229,7 @@ local function validate_client_config(config)
on_error = { config.on_error, "f", true };
on_exit = { config.on_exit, "f", true };
on_init = { config.on_init, "f", true };
+ settings = { config.settings, "t", true };
before_init = { config.before_init, "f", true };
offset_encoding = { config.offset_encoding, "s", true };
flags = { config.flags, "t", true };
@@ -399,6 +403,10 @@ end
---
--@param handlers Map of language server method names to |lsp-handler|
---
+--@param settings Map with language server specific settings. These are
+--- returned to the language server if requested via `workspace/configuration`.
+--- Keys are case-sensitive.
+---
--@param init_options Values to pass in the initialization request
--- as `initializationOptions`. See `initialize` in the LSP spec.
---
@@ -425,7 +433,10 @@ end
--- the server may send. For example, clangd sends
--- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was
--- sent to it. You can only modify the `client.offset_encoding` here before
---- any notifications are sent.
+--- any notifications are sent. Most language servers expect to be sent client specified settings after
+--- initialization. Neovim does not make this assumption. A
+--- `workspace/didChangeConfiguration` notification should be sent
+--- to the server during on_init.
---
--@param on_exit Callback (code, signal, client_id) invoked on client
--- exit.
@@ -458,6 +469,7 @@ function lsp.start_client(config)
local cmd, cmd_args, offset_encoding = cleaned_config.cmd, cleaned_config.cmd_args, cleaned_config.offset_encoding
config.flags = config.flags or {}
+ config.settings = config.settings or {}
local client_id = next_client_id()
@@ -879,9 +891,7 @@ end
function lsp._text_document_did_save_handler(bufnr)
bufnr = resolve_bufnr(bufnr)
local uri = vim.uri_from_bufnr(bufnr)
- local text = once(function()
- return table.concat(nvim_buf_get_lines(bufnr, 0, -1, false), '\n')
- end)
+ local text = once(buf_get_full_text)
for_each_buffer_client(bufnr, function(client, _client_id)
if client.resolved_capabilities.text_document_save then
local included_text
@@ -924,7 +934,7 @@ function lsp.buf_attach_client(bufnr, client_id)
on_lines = text_document_did_change_handler;
on_detach = function()
local params = { textDocument = { uri = uri; } }
- for_each_buffer_client(bufnr, function(client, _client_id)
+ for_each_buffer_client(bufnr, function(client, _)
if client.resolved_capabilities.text_document_open_close then
client.notify('textDocument/didClose', params)
end
@@ -938,6 +948,13 @@ function lsp.buf_attach_client(bufnr, client_id)
utf_sizes = true;
})
end
+
+ if not all_client_active_buffers[client_id] then
+ all_client_active_buffers[client_id] = {}
+ end
+
+ table.insert(all_client_active_buffers[client_id], bufnr)
+
if buffer_client_ids[client_id] then return end
-- This is our first time attaching this client to this buffer.
buffer_client_ids[client_id] = true
@@ -969,6 +986,19 @@ function lsp.get_client_by_id(client_id)
return active_clients[client_id] or uninitialized_clients[client_id]
end
+--- Returns list of buffers attached to client_id.
+--
+--@param client_id client id
+--@returns list of buffer ids
+function lsp.get_buffers_by_client_id(client_id)
+ local active_client_buffers = all_client_active_buffers[client_id]
+ if active_client_buffers then
+ return active_client_buffers
+ else
+ return {}
+ end
+end
+
--- Stops a client(s).
---
--- You can also use the `stop()` function on a |vim.lsp.client| object.
@@ -986,12 +1016,23 @@ end
function lsp.stop_client(client_id, force)
local ids = type(client_id) == 'table' and client_id or {client_id}
for _, id in ipairs(ids) do
+ local resolved_client_id
if type(id) == 'table' and id.stop ~= nil then
id.stop(force)
+ resolved_client_id = id.id
elseif active_clients[id] then
active_clients[id].stop(force)
+ resolved_client_id = id
elseif uninitialized_clients[id] then
uninitialized_clients[id].stop(true)
+ resolved_client_id = id
+ end
+ if resolved_client_id then
+ local client_buffers = lsp.get_buffers_by_client_id(resolved_client_id)
+ for idx = 1, #client_buffers do
+ lsp.diagnostic.clear(client_buffers[idx], resolved_client_id)
+ end
+ all_client_active_buffers[resolved_client_id] = nil
end
end
end
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index b4a1eff316..7eac3febd9 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -162,6 +162,7 @@ M['workspace/configuration'] = function(err, _, params, client_id)
local client = vim.lsp.get_client_by_id(client_id)
if not client then
err_message("LSP[id=", client_id, "] client has shut down after sending the message")
+ return
end
if err then error(vim.inspect(err)) end
if not params.items then
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 9c620c422c..c864fe5878 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -425,23 +425,21 @@ function LanguageTree:register_cbs(cbs)
end
end
-local function region_contains(region, range)
- for _, node in ipairs(region) do
- local start_row, start_col, end_row, end_col = node:range()
- local start_fits = start_row < range[1] or (start_row == range[1] and start_col <= range[2])
- local end_fits = end_row > range[3] or (end_row == range[3] and end_col >= range[4])
+local function tree_contains(tree, range)
+ local start_row, start_col, end_row, end_col = tree:root():range()
+ local start_fits = start_row < range[1] or (start_row == range[1] and start_col <= range[2])
+ local end_fits = end_row > range[3] or (end_row == range[3] and end_col >= range[4])
- if start_fits and end_fits then
- return true
- end
+ if start_fits and end_fits then
+ return true
end
return false
end
function LanguageTree:contains(range)
- for _, region in pairs(self._regions) do
- if region_contains(region, range) then
+ for _, tree in pairs(self._trees) do
+ if tree_contains(tree, range) then
return true
end
end
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 5a27d740a2..e49f54681d 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -340,6 +340,19 @@ function Query:apply_directives(match, pattern, source, metadata)
end
end
+
+--- Returns the start and stop value if set else the node's range.
+-- When the node's range is used, the stop is incremented by 1
+-- to make the search inclusive.
+local function value_or_node_range(start, stop, node)
+ if start == nil and stop == nil then
+ local node_start, _, node_stop, _ = node:range()
+ return node_start, node_stop + 1 -- Make stop inclusive
+ end
+
+ return start, stop
+end
+
--- Iterates of the captures of self on a given range.
--
-- @param node The node under witch the search will occur
@@ -353,6 +366,9 @@ function Query:iter_captures(node, source, start, stop)
if type(source) == "number" and source == 0 then
source = vim.api.nvim_get_current_buf()
end
+
+ start, stop = value_or_node_range(start, stop, node)
+
local raw_iter = node:_rawquery(self.query, true, start, stop)
local function iter()
local capture, captured_node, match = raw_iter()
@@ -385,6 +401,9 @@ function Query:iter_matches(node, source, start, stop)
if type(source) == "number" and source == 0 then
source = vim.api.nvim_get_current_buf()
end
+
+ start, stop = value_or_node_range(start, stop, node)
+
local raw_iter = node:_rawquery(self.query, false, start, stop)
local function iter()
local pattern, match = raw_iter()
diff --git a/runtime/nvim.appdata.xml b/runtime/nvim.appdata.xml
index 025de1b5a9..e99c76a930 100644
--- a/runtime/nvim.appdata.xml
+++ b/runtime/nvim.appdata.xml
@@ -26,6 +26,7 @@
</screenshots>
<releases>
+ <release date="2020-08-04" version="0.4.4"/>
<release date="2019-11-06" version="0.4.3"/>
<release date="2019-09-15" version="0.4.2"/>
<release date="2019-09-15" version="0.4.1"/>
diff --git a/runtime/scripts.vim b/runtime/scripts.vim
index 536993d485..3b3409bf4b 100644
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -186,6 +186,10 @@ if s:line1 =~# "^#!"
elseif s:name =~# 'instantfpc\>'
set ft=pascal
+ " Fennel
+ elseif s:name =~# 'fennel\>'
+ set ft=fennel
+
endif
unlet s:name
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index d68c144f4f..67f4f92bf6 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1399,6 +1399,13 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id,
/// callbacks. The mark will only be used for the current
/// redraw cycle, and not be permantently stored in the
/// buffer.
+/// - right_gravity : boolean that indicates the direction
+/// the extmark will be shifted in when new text is inserted
+/// (true for right, false for left). defaults to true.
+/// - end_right_gravity : boolean that indicates the direction
+/// the extmark end position (if it exists) will be shifted
+/// in when new text is inserted (true for right, false
+/// for left). Defaults to false.
/// @param[out] err Error details, if any
/// @return Id of the created/updated extmark
Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
@@ -1439,6 +1446,10 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
DecorPriority priority = DECOR_PRIORITY_BASE;
colnr_T col2 = 0;
VirtText virt_text = KV_INITIAL_VALUE;
+ bool right_gravity = true;
+ bool end_right_gravity = false;
+ bool end_gravity_set = false;
+
for (size_t i = 0; i < opts.size; i++) {
String k = opts.items[i].key;
Object *v = &opts.items[i].value;
@@ -1521,12 +1532,35 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
goto error;
}
priority = (DecorPriority)v->data.integer;
+ } else if (strequal("right_gravity", k.data)) {
+ if (v->type != kObjectTypeBoolean) {
+ api_set_error(err, kErrorTypeValidation,
+ "right_gravity must be a boolean");
+ goto error;
+ }
+ right_gravity = v->data.boolean;
+ } else if (strequal("end_right_gravity", k.data)) {
+ if (v->type != kObjectTypeBoolean) {
+ api_set_error(err, kErrorTypeValidation,
+ "end_right_gravity must be a boolean");
+ goto error;
+ }
+ end_right_gravity = v->data.boolean;
+ end_gravity_set = true;
} else {
api_set_error(err, kErrorTypeValidation, "unexpected key: %s", k.data);
goto error;
}
}
+ // Only error out if they try to set end_right_gravity without
+ // setting end_col or end_line
+ if (line2 == -1 && col2 == 0 && end_gravity_set) {
+ api_set_error(err, kErrorTypeValidation,
+ "cannot set end_right_gravity "
+ "without setting end_line or end_col");
+ }
+
if (col2 >= 0) {
if (line2 >= 0 && line2 < buf->b_ml.ml_line_count) {
len = STRLEN(ml_get_buf(buf, (linenr_T)line2 + 1, false));
@@ -1571,7 +1605,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
}
id = extmark_set(buf, (uint64_t)ns_id, id, (int)line, (colnr_T)col,
- line2, col2, decor, kExtmarkNoUndo);
+ line2, col2, decor, right_gravity,
+ end_right_gravity, kExtmarkNoUndo);
}
return (Integer)id;
@@ -1686,7 +1721,7 @@ Integer nvim_buf_add_highlight(Buffer buffer,
extmark_set(buf, ns_id, 0,
(int)line, (colnr_T)col_start,
end_line, (colnr_T)col_end,
- decor_hl(hl_id), kExtmarkNoUndo);
+ decor_hl(hl_id), true, false, kExtmarkNoUndo);
return src_id;
}
@@ -1795,7 +1830,8 @@ Integer nvim_buf_set_virtual_text(Buffer buffer,
Decoration *decor = xcalloc(1, sizeof(*decor));
decor->virt_text = virt_text;
- extmark_set(buf, ns_id, 0, (int)line, 0, -1, -1, decor, kExtmarkNoUndo);
+ extmark_set(buf, ns_id, 0, (int)line, 0, -1, -1, decor, true,
+ false, kExtmarkNoUndo);
return src_id;
}
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 8f224e8c78..7cee569989 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -1645,6 +1645,43 @@ bool api_object_to_bool(Object obj, const char *what,
}
}
+HlMessage parse_hl_msg(Array chunks, Error *err)
+{
+ HlMessage hl_msg = KV_INITIAL_VALUE;
+ for (size_t i = 0; i < chunks.size; i++) {
+ if (chunks.items[i].type != kObjectTypeArray) {
+ api_set_error(err, kErrorTypeValidation, "Chunk is not an array");
+ goto free_exit;
+ }
+ Array chunk = chunks.items[i].data.array;
+ if (chunk.size == 0 || chunk.size > 2
+ || chunk.items[0].type != kObjectTypeString
+ || (chunk.size == 2 && chunk.items[1].type != kObjectTypeString)) {
+ api_set_error(err, kErrorTypeValidation,
+ "Chunk is not an array with one or two strings");
+ goto free_exit;
+ }
+
+ String str = copy_string(chunk.items[0].data.string);
+
+ int attr = 0;
+ if (chunk.size == 2) {
+ String hl = chunk.items[1].data.string;
+ if (hl.size > 0) {
+ int hl_id = syn_check_group((char_u *)hl.data, (int)hl.size);
+ attr = hl_id > 0 ? syn_id2attr(hl_id) : 0;
+ }
+ }
+ kv_push(hl_msg, ((HlMessageChunk){ .text = str, .attr = attr }));
+ }
+
+ return hl_msg;
+
+free_exit:
+ clear_hl_msg(&hl_msg);
+ return hl_msg;
+}
+
const char *describe_ns(NS ns_id)
{
String name;
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 1e972e01be..09895a2119 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -990,6 +990,48 @@ void nvim_set_option(uint64_t channel_id, String name, Object value, Error *err)
set_option_to(channel_id, NULL, SREQ_GLOBAL, name, value, err);
}
+/// Echo a message.
+///
+/// @param chunks A list of [text, hl_group] arrays, each representing a
+/// text chunk with specified highlight. `hl_group` element
+/// can be omitted for no highlight.
+/// @param history if true, add to |message-history|.
+/// @param opts Optional parameters. Reserved for future use.
+void nvim_echo(Array chunks, Boolean history, Dictionary opts, Error *err)
+ FUNC_API_SINCE(7)
+{
+ HlMessage hl_msg = parse_hl_msg(chunks, err);
+ if (ERROR_SET(err)) {
+ goto error;
+ }
+
+ if (opts.size > 0) {
+ api_set_error(err, kErrorTypeValidation, "opts dict isn't empty");
+ goto error;
+ }
+
+ no_wait_return++;
+ msg_start();
+ msg_clr_eos();
+ bool need_clear = false;
+ for (uint32_t i = 0; i < kv_size(hl_msg); i++) {
+ HlMessageChunk chunk = kv_A(hl_msg, i);
+ msg_multiline_attr((const char *)chunk.text.data, chunk.attr,
+ false, &need_clear);
+ }
+ if (history) {
+ msg_ext_set_kind("echomsg");
+ add_hl_msg_hist(hl_msg);
+ } else {
+ msg_ext_set_kind("echo");
+ }
+ no_wait_return--;
+ msg_end();
+
+error:
+ clear_hl_msg(&hl_msg);
+}
+
/// Writes a message to the Vim output buffer. Does not append "\n", the
/// message is buffered (won't display) until a linefeed is written.
///
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index e6a616c927..f3ee42fab1 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -69,7 +69,7 @@ void bufhl_add_hl_pos_offset(buf_T *buf,
}
(void)extmark_set(buf, (uint64_t)src_id, 0,
(int)lnum-1, hl_start, (int)lnum-1+end_off, hl_end,
- decor, kExtmarkNoUndo);
+ decor, true, false, kExtmarkNoUndo);
}
}
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ccf7dd0f68..18683c54d3 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3041,9 +3041,10 @@ const char * set_one_cmd_context(
p = arg + 1;
arg = (const char *)skip_cmd_arg((char_u *)arg, false);
- /* Still touching the command after '+'? */
- if (*arg == NUL)
+ // Still touching the command after '+'?
+ if (*arg == NUL) {
return p;
+ }
// Skip space(s) after +command to get to the real argument.
arg = (const char *)skipwhite((const char_u *)arg);
@@ -3680,6 +3681,10 @@ const char * set_one_cmd_context(
xp->xp_pattern = (char_u *)arg;
break;
+ case CMD_lua:
+ xp->xp_context = EXPAND_LUA;
+ break;
+
default:
break;
}
@@ -3968,7 +3973,7 @@ static linenr_T get_address(exarg_T *eap,
break;
default:
- if (ascii_isdigit(*cmd)) { // absolute line number
+ if (ascii_isdigit(*cmd)) { // absolute line number
lnum = getdigits_long(&cmd, false, 0);
}
}
@@ -5187,6 +5192,7 @@ static const char *command_complete[] =
#ifdef HAVE_WORKING_LIBINTL
[EXPAND_LOCALES] = "locale",
#endif
+ [EXPAND_LUA] = "lua",
[EXPAND_MAPCLEAR] = "mapclear",
[EXPAND_MAPPINGS] = "mapping",
[EXPAND_MENUS] = "menu",
@@ -5400,8 +5406,8 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def,
size_t vallen = 0;
size_t attrlen = len;
- /* Look for the attribute name - which is the part before any '=' */
- for (i = 0; i < (int)len; ++i) {
+ // Look for the attribute name - which is the part before any '='
+ for (i = 0; i < (int)len; i++) {
if (attr[i] == '=') {
val = &attr[i + 1];
vallen = len - i - 1;
@@ -7503,8 +7509,9 @@ static void ex_read(exarg_T *eap)
}
if (*eap->arg == NUL) {
- if (check_fname() == FAIL) /* check for no file name */
+ if (check_fname() == FAIL) { // check for no file name
return;
+ }
i = readfile(curbuf->b_ffname, curbuf->b_fname,
eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);
} else {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2aa66f6a8c..8d10e98259 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -69,6 +69,7 @@
#include "nvim/lib/kvec.h"
#include "nvim/api/private/helpers.h"
#include "nvim/highlight_defs.h"
+#include "nvim/lua/executor.h"
#include "nvim/viml/parser/parser.h"
#include "nvim/viml/parser/expressions.h"
@@ -3945,6 +3946,12 @@ nextwild (
p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
use_options, type);
xfree(p1);
+
+ // xp->xp_pattern might have been modified by ExpandOne (for example,
+ // in lua completion), so recompute the pattern index and length
+ i = (int)(xp->xp_pattern - ccline.cmdbuff);
+ xp->xp_pattern_len = (size_t)ccline.cmdpos - (size_t)i;
+
// Longest match: make sure it is not shorter, happens with :help.
if (p2 != NULL && type == WILD_LONGEST) {
for (j = 0; (size_t)j < xp->xp_pattern_len; j++) {
@@ -3960,7 +3967,7 @@ nextwild (
}
if (p2 != NULL && !got_int) {
- difflen = (int)STRLEN(p2) - (int)xp->xp_pattern_len;
+ difflen = (int)STRLEN(p2) - (int)(xp->xp_pattern_len);
if (ccline.cmdlen + difflen + 4 > ccline.cmdbufflen) {
realloc_cmdbuff(ccline.cmdlen + difflen + 4);
xp->xp_pattern = ccline.cmdbuff + i;
@@ -5106,6 +5113,10 @@ ExpandFromContext (
if (xp->xp_context == EXPAND_PACKADD) {
return ExpandPackAddDir(pat, num_file, file);
}
+ if (xp->xp_context == EXPAND_LUA) {
+ ILOG("PAT %s", pat);
+ return nlua_expand_pat(xp, pat, num_file, file);
+ }
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog == NULL)
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c
index b2d8532cd7..cacbeddb32 100644
--- a/src/nvim/extmark.c
+++ b/src/nvim/extmark.c
@@ -71,7 +71,8 @@ static ExtmarkNs *buf_ns_ref(buf_T *buf, uint64_t ns_id, bool put) {
/// @returns the mark id
uint64_t extmark_set(buf_T *buf, uint64_t ns_id, uint64_t id,
int row, colnr_T col, int end_row, colnr_T end_col,
- Decoration *decor, ExtmarkOp op)
+ Decoration *decor, bool right_gravity,
+ bool end_right_gravity, ExtmarkOp op)
{
ExtmarkNs *ns = buf_ns_ref(buf, ns_id, true);
assert(ns != NULL);
@@ -109,10 +110,10 @@ uint64_t extmark_set(buf_T *buf, uint64_t ns_id, uint64_t id,
if (end_row > -1) {
mark = marktree_put_pair(buf->b_marktree,
- row, col, true,
- end_row, end_col, false);
+ row, col, right_gravity,
+ end_row, end_col, end_right_gravity);
} else {
- mark = marktree_put(buf->b_marktree, row, col, true);
+ mark = marktree_put(buf->b_marktree, row, col, right_gravity);
}
revised:
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 3219c02068..310b194c8c 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1292,6 +1292,80 @@ static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
lua_setfield(lstate, -2, "_ts_parse_query");
}
+int nlua_expand_pat(expand_T *xp,
+ char_u *pat,
+ int *num_results,
+ char_u ***results)
+{
+ lua_State *const lstate = nlua_enter();
+ int ret = OK;
+
+ // [ vim ]
+ lua_getglobal(lstate, "vim");
+
+ // [ vim, vim._expand_pat ]
+ lua_getfield(lstate, -1, "_expand_pat");
+ luaL_checktype(lstate, -1, LUA_TFUNCTION);
+
+ // [ vim, vim._log_keystroke, buf ]
+ lua_pushlstring(lstate, (const char *)pat, STRLEN(pat));
+
+ if (lua_pcall(lstate, 1, 2, 0) != 0) {
+ nlua_error(
+ lstate,
+ _("Error executing vim._expand_pat: %.*s"));
+ return FAIL;
+ }
+
+ Error err = ERROR_INIT;
+
+ *num_results = 0;
+ *results = NULL;
+
+ int prefix_len = (int)nlua_pop_Integer(lstate, &err);
+ if (ERROR_SET(&err)) {
+ ret = FAIL;
+ goto cleanup;
+ }
+
+ Array completions = nlua_pop_Array(lstate, &err);
+ if (ERROR_SET(&err)) {
+ ret = FAIL;
+ goto cleanup_array;
+ }
+
+ garray_T result_array;
+ ga_init(&result_array, (int)sizeof(char *), 80);
+ for (size_t i = 0; i < completions.size; i++) {
+ Object v = completions.items[i];
+
+ if (v.type != kObjectTypeString) {
+ ret = FAIL;
+ goto cleanup_array;
+ }
+
+ GA_APPEND(
+ char_u *,
+ &result_array,
+ vim_strsave((char_u *)v.data.string.data));
+ }
+
+ xp->xp_pattern += prefix_len;
+ *results = result_array.ga_data;
+ *num_results = result_array.ga_len;
+
+cleanup_array:
+ api_free_array(completions);
+
+cleanup:
+
+ if (ret == FAIL) {
+ ga_clear(&result_array);
+ }
+
+ return ret;
+}
+
static int nlua_regex(lua_State *lstate)
{
Error err = ERROR_INIT;
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index b20fbbf038..dbf4f6014c 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -121,10 +121,17 @@ function vim._load_package(name)
end
for _,trail in ipairs(vim._so_trails) do
- local path = "lua/"..trail:gsub('?',basename)
+ local path = "lua"..trail:gsub('?', basename) -- so_trails contains a leading slash
local found = vim.api.nvim_get_runtime_file(path, false)
if #found > 0 then
- local f, err = package.loadlib(found[1])
+ -- Making function name in Lua 5.1 (see src/loadlib.c:mkfuncname) is
+ -- a) strip prefix up to and including the first dash, if any
+ -- b) replace all dots by underscores
+ -- c) prepend "luaopen_"
+ -- So "foo-bar.baz" should result in "luaopen_bar_baz"
+ local dash = name:find("-", 1, true)
+ local modname = dash and name:sub(dash + 1) or name
+ local f, err = package.loadlib(found[1], "luaopen_"..modname:gsub("%.", "_"))
return f or error(err)
end
end
@@ -527,4 +534,164 @@ function vim._log_keystroke(char)
end
end
+--- Generate a list of possible completions for the string.
+--- String starts with ^ and then has the pattern.
+---
+--- 1. Can we get it to just return things in the global namespace with that name prefix
+--- 2. Can we get it to return things from global namespace even with `print(` in front.
+function vim._expand_pat(pat, env)
+ env = env or _G
+
+ pat = string.sub(pat, 2, #pat)
+
+ if pat == '' then
+ local result = vim.tbl_keys(env)
+ table.sort(result)
+ return result, 0
+ end
+
+ -- TODO: We can handle spaces in [] ONLY.
+ -- We should probably do that at some point, just for cooler completion.
+ -- TODO: We can suggest the variable names to go in []
+ -- This would be difficult as well.
+ -- Probably just need to do a smarter match than just `:match`
+
+ -- Get the last part of the pattern
+ local last_part = pat:match("[%w.:_%[%]'\"]+$")
+ if not last_part then return {}, 0 end
+
+ local parts, search_index = vim._expand_pat_get_parts(last_part)
+
+ local match_part = string.sub(last_part, search_index, #last_part)
+ local prefix_match_pat = string.sub(pat, 1, #pat - #match_part) or ''
+
+ local final_env = env
+
+ for _, part in ipairs(parts) do
+ if type(final_env) ~= 'table' then
+ return {}, 0
+ end
+ local key
+
+ -- Normally, we just have a string
+ -- Just attempt to get the string directly from the environment
+ if type(part) == "string" then
+ key = part
+ else
+ -- However, sometimes you want to use a variable, and complete on it
+ -- With this, you have the power.
+
+ -- MY_VAR = "api"
+ -- vim[MY_VAR]
+ -- -> _G[MY_VAR] -> "api"
+ local result_key = part[1]
+ if not result_key then
+ return {}, 0
+ end
+
+ local result = rawget(env, result_key)
+
+ if result == nil then
+ return {}, 0
+ end
+
+ key = result
+ end
+ local field = rawget(final_env, key)
+ if field == nil then
+ local mt = getmetatable(final_env)
+ if mt and type(mt.__index) == "table" then
+ field = rawget(mt.__index, key)
+ end
+ end
+ final_env = field
+
+ if not final_env then
+ return {}, 0
+ end
+ end
+
+ local keys = {}
+ local function insert_keys(obj)
+ for k,_ in pairs(obj) do
+ if type(k) == "string" and string.sub(k,1,string.len(match_part)) == match_part then
+ table.insert(keys,k)
+ end
+ end
+ end
+
+ if type(final_env) == "table" then
+ insert_keys(final_env)
+ end
+ local mt = getmetatable(final_env)
+ if mt and type(mt.__index) == "table" then
+ insert_keys(mt.__index)
+ end
+
+ table.sort(keys)
+
+ return keys, #prefix_match_pat
+end
+
+vim._expand_pat_get_parts = function(lua_string)
+ local parts = {}
+
+ local accumulator, search_index = '', 1
+ local in_brackets, bracket_end = false, -1
+ local string_char = nil
+ for idx = 1, #lua_string do
+ local s = lua_string:sub(idx, idx)
+
+ if not in_brackets and (s == "." or s == ":") then
+ table.insert(parts, accumulator)
+ accumulator = ''
+
+ search_index = idx + 1
+ elseif s == "[" then
+ in_brackets = true
+
+ table.insert(parts, accumulator)
+ accumulator = ''
+
+ search_index = idx + 1
+ elseif in_brackets then
+ if idx == bracket_end then
+ in_brackets = false
+ search_index = idx + 1
+
+ if string_char == "VAR" then
+ table.insert(parts, { accumulator })
+ accumulator = ''
+
+ string_char = nil
+ end
+ elseif not string_char then
+ bracket_end = string.find(lua_string, ']', idx, true)
+
+ if s == '"' or s == "'" then
+ string_char = s
+ elseif s ~= ' ' then
+ string_char = "VAR"
+ accumulator = s
+ end
+ elseif string_char then
+ if string_char ~= s then
+ accumulator = accumulator .. s
+ else
+ table.insert(parts, accumulator)
+ accumulator = ''
+
+ string_char = nil
+ end
+ end
+ else
+ accumulator = accumulator .. s
+ end
+ end
+
+ parts = vim.tbl_filter(function(val) return #val > 0 end, parts)
+
+ return parts, search_index
+end
+
return module
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 8bf745966e..9f71df3a46 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -2044,7 +2044,6 @@ static void usage(void)
mch_msg(_(" -u <config> Use this config file\n"));
mch_msg(_(" -v, --version Print version information\n"));
mch_msg(_(" -V[N][file] Verbose [level][file]\n"));
- mch_msg(_(" -Z Restricted mode\n"));
mch_msg("\n");
mch_msg(_(" --api-info Write msgpack-encoded API metadata to stdout\n"));
mch_msg(_(" --embed Use stdin/stdout as a msgpack-rpc channel\n"));
diff --git a/src/nvim/message.c b/src/nvim/message.c
index f94529c687..ba7a667a60 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -890,6 +890,40 @@ char_u *msg_may_trunc(int force, char_u *s)
return s;
}
+void clear_hl_msg(HlMessage *hl_msg)
+{
+ for (size_t i = 0; i < kv_size(*hl_msg); i++) {
+ xfree(kv_A(*hl_msg, i).text.data);
+ }
+ kv_destroy(*hl_msg);
+ *hl_msg = (HlMessage)KV_INITIAL_VALUE;
+}
+
+#define LINE_BUFFER_SIZE 4096
+
+void add_hl_msg_hist(HlMessage hl_msg)
+{
+ // TODO(notomo): support multi highlighted message history
+ size_t pos = 0;
+ char buf[LINE_BUFFER_SIZE];
+ for (uint32_t i = 0; i < kv_size(hl_msg); i++) {
+ HlMessageChunk chunk = kv_A(hl_msg, i);
+ for (uint32_t j = 0; j < chunk.text.size; j++) {
+ if (pos == LINE_BUFFER_SIZE - 1) {
+ buf[pos] = NUL;
+ add_msg_hist((const char *)buf, -1, MSG_HIST, true);
+ pos = 0;
+ continue;
+ }
+ buf[pos++] = chunk.text.data[j];
+ }
+ }
+ if (pos != 0) {
+ buf[pos] = NUL;
+ add_msg_hist((const char *)buf, -1, MSG_HIST, true);
+ }
+}
+
/// @param[in] len Length of s or -1.
static void add_msg_hist(const char *s, int len, int attr, bool multiline)
{
diff --git a/src/nvim/message.h b/src/nvim/message.h
index fdb9bc96ca..377c725fa1 100644
--- a/src/nvim/message.h
+++ b/src/nvim/message.h
@@ -8,6 +8,8 @@
#include "nvim/macros.h"
#include "nvim/types.h"
#include "nvim/grid_defs.h"
+#include "nvim/api/private/defs.h"
+#include "nvim/lib/kvec.h"
/*
* Types of dialogs passed to do_dialog().
@@ -75,6 +77,13 @@
/// Like #MSG_PUTS_ATTR, but if middle part of long messages will be replaced
#define MSG_PUTS_LONG_ATTR(s, a) msg_puts_long_attr((char_u *)(s), (a))
+typedef struct {
+ String text;
+ int attr;
+} HlMessageChunk;
+
+typedef kvec_t(HlMessageChunk) HlMessage;
+
/// Message history for `:messages`
typedef struct msg_hist {
struct msg_hist *next; ///< Next message.
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 4e955667dc..8f22243348 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -3978,16 +3978,19 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
curwin->w_curswant -= width2;
} else {
// to previous line
+
+ // Move to the start of a closed fold. Don't do that when
+ // 'foldopen' contains "all": it will open in a moment.
+ if (!(fdo_flags & FDO_ALL)) {
+ (void)hasFolding(curwin->w_cursor.lnum,
+ &curwin->w_cursor.lnum, NULL);
+ }
if (curwin->w_cursor.lnum == 1) {
retval = false;
break;
}
- --curwin->w_cursor.lnum;
- /* Move to the start of a closed fold. Don't do that when
- * 'foldopen' contains "all": it will open in a moment. */
- if (!(fdo_flags & FDO_ALL))
- (void)hasFolding(curwin->w_cursor.lnum,
- &curwin->w_cursor.lnum, NULL);
+ curwin->w_cursor.lnum--;
+
linelen = linetabsize(get_cursor_line_ptr());
if (linelen > width1) {
int w = (((linelen - width1 - 1) / width2) + 1) * width2;
@@ -6708,11 +6711,8 @@ static void nv_g_cmd(cmdarg_T *cap)
*/
case 'j':
case K_DOWN:
- /* with 'nowrap' it works just like the normal "j" command; also when
- * in a closed fold */
- if (!curwin->w_p_wrap
- || hasFolding(curwin->w_cursor.lnum, NULL, NULL)
- ) {
+ // with 'nowrap' it works just like the normal "j" command.
+ if (!curwin->w_p_wrap) {
oap->motion_type = kMTLineWise;
i = cursor_down(cap->count1, oap->op_type == OP_NOP);
} else
@@ -6723,11 +6723,8 @@ static void nv_g_cmd(cmdarg_T *cap)
case 'k':
case K_UP:
- /* with 'nowrap' it works just like the normal "k" command; also when
- * in a closed fold */
- if (!curwin->w_p_wrap
- || hasFolding(curwin->w_cursor.lnum, NULL, NULL)
- ) {
+ // with 'nowrap' it works just like the normal "k" command.
+ if (!curwin->w_p_wrap) {
oap->motion_type = kMTLineWise;
i = cursor_up(cap->count1, oap->op_type == OP_NOP);
} else
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 47b9e9bb07..74bf6f0590 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2913,7 +2913,7 @@ ambw_end:
#endif
} else if (varp == &curwin->w_p_scl) {
// 'signcolumn'
- if (check_opt_strings(*varp, p_scl_values, false) != OK) {
+ if (check_signcolumn(*varp) != OK) {
errmsg = e_invarg;
}
// When changing the 'signcolumn' to or from 'number', recompute the
@@ -3232,6 +3232,34 @@ static int int_cmp(const void *a, const void *b)
return *(const int *)a - *(const int *)b;
}
+/// Handle setting 'signcolumn' for value 'val'
+///
+/// @return OK when the value is valid, FAIL otherwise
+int check_signcolumn(char_u *val)
+{
+ // check for basic match
+ if (check_opt_strings(val, p_scl_values, false) == OK) {
+ return OK;
+ }
+
+ // check for 'auto:<NUMBER>-<NUMBER>'
+ if (STRLEN(val) == 8
+ && !STRNCMP(val, "auto:", 5)
+ && ascii_isdigit(val[5])
+ && val[6] == '-'
+ && ascii_isdigit(val[7])
+ ) {
+ int min = val[5] - '0';
+ int max = val[7] - '0';
+ if (min < 1 || max < 2 || min > 8 || max > 9 || min >= max) {
+ return FAIL;
+ }
+ return OK;
+ }
+
+ return FAIL;
+}
+
/// Handle setting 'colorcolumn' or 'textwidth' in window "wp".
///
/// @return error message, NULL if it's OK.
@@ -7095,7 +7123,7 @@ int csh_like_shell(void)
/// buffer signs and on user configuration.
int win_signcol_count(win_T *wp)
{
- int maximum = 1, needed_signcols;
+ int minimum = 0, maximum = 1, needed_signcols;
const char *scl = (const char *)wp->w_p_scl;
// Note: It checks "no" or "number" in 'signcolumn' option
@@ -7119,9 +7147,14 @@ int win_signcol_count(win_T *wp)
if (!strncmp(scl, "auto:", 5)) {
// Variable depending on a configuration
maximum = scl[5] - '0';
+ // auto:<NUM>-<NUM>
+ if (strlen(scl) == 8 && *(scl + 6) == '-') {
+ minimum = maximum;
+ maximum = scl[7] - '0';
+ }
}
- return MIN(maximum, needed_signcols);
+ return MAX(minimum, MIN(maximum, needed_signcols));
}
/// Get window or buffer local options
diff --git a/src/nvim/po/af.po b/src/nvim/po/af.po
index fa6674469c..db44f50a46 100644
--- a/src/nvim/po/af.po
+++ b/src/nvim/po/af.po
@@ -3290,10 +3290,6 @@ msgstr "-o[N]\t\tMaak N vensters oop (verstek: een vir elke ler)"
#~ msgid " -V[N][file] Verbose [level][file]\n"
#~ msgstr ""
-#, fuzzy
-#~ msgid " -Z Restricted mode\n"
-#~ msgstr " vir twee modusse "
-
#~ msgid " --api-info Write msgpack-encoded API metadata to stdout\n"
#~ msgstr ""
@@ -7473,9 +7469,6 @@ msgstr "E446: Geen lernaam onder loper"
#~ msgid "-b\t\t\tBinary mode"
#~ msgstr "-b\t\t\tBinre modus"
-#~ msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-#~ msgstr "-Z\t\t\tBeperkte modus (soos \"rvim\")"
-
#~ msgid "-R\t\t\tReadonly mode (like \"view\")"
#~ msgstr "-R\t\t\tLeesalleen modus (soos \"view\")"
diff --git a/src/nvim/po/ca.po b/src/nvim/po/ca.po
index be4206f36e..6c4d6ddd22 100644
--- a/src/nvim/po/ca.po
+++ b/src/nvim/po/ca.po
@@ -3469,10 +3469,6 @@ msgstr "-y\t\t\tMode senzill (com \"evim\", sense modes)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tMode noms lectura (com \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tMode restringit (com \"rvim)"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tNo permet modificar (escriure) fitxers"
diff --git a/src/nvim/po/cs.cp1250.po b/src/nvim/po/cs.cp1250.po
index 5b9f3d3a58..859039eb87 100644
--- a/src/nvim/po/cs.cp1250.po
+++ b/src/nvim/po/cs.cp1250.po
@@ -3547,10 +3547,6 @@ msgstr "-v\t\t\tSnadn reim (stejn jako \"evim\", dn mdy )"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tReim pouze_pro_ten (jako \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tOmezen reim (stejn jako \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tZmny (ukldn soubor) zakzny"
diff --git a/src/nvim/po/cs.po b/src/nvim/po/cs.po
index 31a90dc514..4d9ad58836 100644
--- a/src/nvim/po/cs.po
+++ b/src/nvim/po/cs.po
@@ -3547,10 +3547,6 @@ msgstr "-v\t\t\tSnadn reim (stejn jako \"evim\", dn mdy )"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tReim pouze_pro_ten (jako \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tOmezen reim (stejn jako \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tZmny (ukldn soubor) zakzny"
diff --git a/src/nvim/po/da.po b/src/nvim/po/da.po
index f35272810b..7a75425019 100644
--- a/src/nvim/po/da.po
+++ b/src/nvim/po/da.po
@@ -3015,9 +3015,6 @@ msgstr "-y\t\t\tEasy-tilstand (ligesom \"evim\", tilstandsløs)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tSkrivebeskyttet tilstand (ligesom \"view\")"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tRestriktiv tilstand (ligesom \"rvim\")"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tÆndringer (skrivning af filer) ikke tilladt"
diff --git a/src/nvim/po/de.po b/src/nvim/po/de.po
index a2e04965e5..740e9e5f6a 100644
--- a/src/nvim/po/de.po
+++ b/src/nvim/po/de.po
@@ -2895,10 +2895,6 @@ msgstr "-y\t\t\tLeichter Modus (wie \"evim\", ohne Modi)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tModus ohne Schreibrechte (wie \"view\")"
-#: ../main.c:2186
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tEingeschrnkter Modus (wie \"rvim\")"
-
#: ../main.c:2187
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tnderungen (beim Schreiben von Dateien) sind nicht erlaubt"
diff --git a/src/nvim/po/en_GB.po b/src/nvim/po/en_GB.po
index 7919fc8946..66cdba6f92 100644
--- a/src/nvim/po/en_GB.po
+++ b/src/nvim/po/en_GB.po
@@ -3368,10 +3368,6 @@ msgstr ""
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr ""
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr ""
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr ""
diff --git a/src/nvim/po/eo.po b/src/nvim/po/eo.po
index 99c46c7275..5480e6a4d8 100644
--- a/src/nvim/po/eo.po
+++ b/src/nvim/po/eo.po
@@ -2989,9 +2989,6 @@ msgstr "-y\t\t\tFacila reĝimo (kiel \"evim\", senreĝima)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tNurlegebla reĝimo (kiel \"view\")"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tLimigita reĝimo (kiel \"rvim\")"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tŜanĝoj (skribo al dosieroj) nepermeseblaj"
diff --git a/src/nvim/po/es.po b/src/nvim/po/es.po
index eeea27610d..064484d1a4 100644
--- a/src/nvim/po/es.po
+++ b/src/nvim/po/es.po
@@ -3524,10 +3524,6 @@ msgstr "-y\t\t\tModo fácil (como \"evim\", sin modo)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tModo de solo lectura (como \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tModo restringido (como \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tModificación de archivos desactivada"
diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po
index 4489139cfb..5986a57488 100644
--- a/src/nvim/po/fi.po
+++ b/src/nvim/po/fi.po
@@ -3249,10 +3249,6 @@ msgstr ""
#~ msgstr " kahta tilaa varten "
#, fuzzy
-#~ msgid " -Z Restricted mode\n"
-#~ msgstr " kahta tilaa varten "
-
-#, fuzzy
#~ msgid " -m Modifications (writing files) not allowed\n"
#~ msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois käytöstä"
@@ -6961,9 +6957,6 @@ msgstr "Lista tai luku tarvitaan"
#~ msgid "-b\t\t\tBinary mode"
#~ msgstr "-b\t\t\tBinääritila"
-#~ msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-#~ msgstr "-Z\t\t\tRajoitettu tila (kuten rvimillä)"
-
#~ msgid "-R\t\t\tReadonly mode (like \"view\")"
#~ msgstr "-R\t\t\tKirjoitussuojattu tila (kuten view'lla)"
diff --git a/src/nvim/po/fr.po b/src/nvim/po/fr.po
index bb60649c91..5f1ca2fec5 100644
--- a/src/nvim/po/fr.po
+++ b/src/nvim/po/fr.po
@@ -3231,9 +3231,6 @@ msgstr "-y\t\tMode facile (comme \"evim\", vim sans modes)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\tMode lecture seule (comme \"view\")"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\tMode restreint (comme \"rvim\")"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\tInterdire l'enregistrement des fichiers"
diff --git a/src/nvim/po/ga.po b/src/nvim/po/ga.po
index 1104b31c32..bad01d592a 100644
--- a/src/nvim/po/ga.po
+++ b/src/nvim/po/ga.po
@@ -3022,9 +3022,6 @@ msgstr "-y\t\t\tMd asca (mar \"evim\", gan mhid)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tMd inlite amhin (mar \"view\")"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tMd srianta (mar \"rvim\")"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tN cheadatear athruithe (.i. scrobh na gcomhad)"
diff --git a/src/nvim/po/it.po b/src/nvim/po/it.po
index 511f910b71..dfabc4bee0 100644
--- a/src/nvim/po/it.po
+++ b/src/nvim/po/it.po
@@ -3510,10 +3510,6 @@ msgstr "-y\t\t\tModalit Facile (come \"evim\", senza modalit)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tModalit Sola Lettura (come \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tModalit Ristretta (come \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tRiscritture del file non permesse"
diff --git a/src/nvim/po/ja.euc-jp.po b/src/nvim/po/ja.euc-jp.po
index 523e9ca4e3..e2cf68f016 100644
--- a/src/nvim/po/ja.euc-jp.po
+++ b/src/nvim/po/ja.euc-jp.po
@@ -3024,9 +3024,6 @@ msgstr "-y\t\t\t⡼ (\"evim\" Ʊ⡼̵)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tɹѥ⡼ (\"view\" Ʊ)"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\t¥⡼ (\"rvim\" Ʊ)"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tѹ (ե¸) Ǥʤ褦ˤ"
diff --git a/src/nvim/po/ja.po b/src/nvim/po/ja.po
index 5a69d0c5bf..85a45cd171 100644
--- a/src/nvim/po/ja.po
+++ b/src/nvim/po/ja.po
@@ -3024,9 +3024,6 @@ msgstr "-y\t\t\tイージーモード (\"evim\" と同じ、モード無)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\t読込専用モード (\"view\" と同じ)"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\t制限モード (\"rvim\" と同じ)"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\t変更 (ファイル保存時) をできないようにする"
diff --git a/src/nvim/po/ko.UTF-8.po b/src/nvim/po/ko.UTF-8.po
index 128b238f8b..b99c22caeb 100644
--- a/src/nvim/po/ko.UTF-8.po
+++ b/src/nvim/po/ko.UTF-8.po
@@ -3438,10 +3438,6 @@ msgstr "-y\t\t\t쉬운 상태 (\"evim\"과 같음, modeless)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\t읽기 전용 상태 (\"view\"와 같음)"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\t제한된 상태 (\"rvim\"과 같음)"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\t수정(파일 쓰기)이 허용되지 않음"
diff --git a/src/nvim/po/nb.po b/src/nvim/po/nb.po
index 34617ccf18..2285d755cf 100644
--- a/src/nvim/po/nb.po
+++ b/src/nvim/po/nb.po
@@ -3452,10 +3452,6 @@ msgstr "-y\t\t\tLett modus (som \"evim\", uten modus)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tSkrivebeskyttet modus (som \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tBegrenset modus (som \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tModifisering (lagring av filer) ikke tillatt"
diff --git a/src/nvim/po/nl.po b/src/nvim/po/nl.po
index 30f34508f5..00d113c83c 100644
--- a/src/nvim/po/nl.po
+++ b/src/nvim/po/nl.po
@@ -3449,10 +3449,6 @@ msgstr "-y\t\t\tEenvoudige modus (zoals \"evim\", zonder modus)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tAlleen-lezen modus (zoals \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tBeperkte modus (zoals \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tAanpassingen (bestanden opslaan) niet toegestaan"
diff --git a/src/nvim/po/no.po b/src/nvim/po/no.po
index 34617ccf18..2285d755cf 100644
--- a/src/nvim/po/no.po
+++ b/src/nvim/po/no.po
@@ -3452,10 +3452,6 @@ msgstr "-y\t\t\tLett modus (som \"evim\", uten modus)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tSkrivebeskyttet modus (som \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tBegrenset modus (som \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tModifisering (lagring av filer) ikke tillatt"
diff --git a/src/nvim/po/pl.UTF-8.po b/src/nvim/po/pl.UTF-8.po
index f5c452e924..5f1779d1bd 100644
--- a/src/nvim/po/pl.UTF-8.po
+++ b/src/nvim/po/pl.UTF-8.po
@@ -3417,10 +3417,6 @@ msgstr "-y\t\t\tTryb łatwy (jak \"evim\", bez trybów)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tTryb wyłącznie do odczytu (jak \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tTryb ograniczenia (jak \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tModyfikacje (zapisywanie plików) niedozwolone"
diff --git a/src/nvim/po/pt_BR.po b/src/nvim/po/pt_BR.po
index 4f39cb5bdb..533d916de1 100644
--- a/src/nvim/po/pt_BR.po
+++ b/src/nvim/po/pt_BR.po
@@ -6229,10 +6229,6 @@ msgstr "-y\t\t\tModo fácil (como \"evim\", o Vim não modal)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tmodo somente-leitura (como \"view\")"
-#: ../main.c:2186
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tmodo restrito (como \"rvim\")"
-
#: ../main.c:2187
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tNo permitir alteraes (gravao de arquivos)"
diff --git a/src/nvim/po/ru.po b/src/nvim/po/ru.po
index 62f892d257..3a96ece2fb 100644
--- a/src/nvim/po/ru.po
+++ b/src/nvim/po/ru.po
@@ -3442,10 +3442,6 @@ msgstr "-y\t\t\tПростой режим (как \"evim\", безрежимны
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tТолько для чтения (как \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tОграниченный режим (как \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tБез возможности сохранения изменений (записи файлов)"
diff --git a/src/nvim/po/sk.cp1250.po b/src/nvim/po/sk.cp1250.po
index ced343bf6b..ff95c68a12 100644
--- a/src/nvim/po/sk.cp1250.po
+++ b/src/nvim/po/sk.cp1250.po
@@ -3450,10 +3450,6 @@ msgstr "-y\t\t\tJednoduch md (rovnak ako \"evim\", bezmdov)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tMd iba pre tanie (ako \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tObmedzen md (rovnak ako \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tZmeny (ukladanie sborov) zakzan"
diff --git a/src/nvim/po/sk.po b/src/nvim/po/sk.po
index 66b3d5abb1..d35622726f 100644
--- a/src/nvim/po/sk.po
+++ b/src/nvim/po/sk.po
@@ -3450,10 +3450,6 @@ msgstr "-y\t\t\tJednoduch md (rovnak ako \"evim\", bezmdov)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tMd iba pre tanie (ako \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tObmedzen md (rovnak ako \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tZmeny (ukladanie sborov) zakzan"
diff --git a/src/nvim/po/sr.po b/src/nvim/po/sr.po
index 4c157658e5..a93a2ec584 100644
--- a/src/nvim/po/sr.po
+++ b/src/nvim/po/sr.po
@@ -3028,9 +3028,6 @@ msgstr "-y\t\t\tEasy режим (као \"evim\", безрежимни)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tReadonly режим (као \"view\")"
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tRestricted режим (као \"rvim\")"
-
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tИзмене (уписивање датотека) нису дозвољене"
diff --git a/src/nvim/po/sv.po b/src/nvim/po/sv.po
index db7bada888..d50c9d695d 100644
--- a/src/nvim/po/sv.po
+++ b/src/nvim/po/sv.po
@@ -5735,10 +5735,6 @@ msgstr "-y\t\t\tLtt lge (som \"evim\", lgesls)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tSkrivskyddat lge (som \"view\")"
-#: ../main.c:2186
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tBegrnsat lge (som \"rvim\")"
-
#: ../main.c:2187
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tModifieringar (skriva filer) inte tilltet"
diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po
index 604e425bd0..f0ae154648 100644
--- a/src/nvim/po/uk.po
+++ b/src/nvim/po/uk.po
@@ -14,7 +14,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vim 7.4\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-08-23 18:45+0300\n"
+"POT-Creation-Date: 2021-01-18 17:46+0200\n"
"PO-Revision-Date: 2020-08-23 20:19+0300\n"
"Last-Translator: Анатолій Сахнік <sakhnik@gmail.com>\n"
"Language-Team: Ukrainian\n"
@@ -23,6 +23,67 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+msgid "--Deleted--"
+msgstr "--Знищено--"
+
+#, c-format
+msgid "auto-removing autocommand: %s <buffer=%d>"
+msgstr "Автоматичне знищення автокоманди: %s <буфер=%d>"
+
+#, c-format
+msgid "E367: No such group: \"%s\""
+msgstr "E367: Немає такої групи: «%s»"
+
+msgid "E936: Cannot delete the current group"
+msgstr "E936: Не вдалося знищити цю групу"
+
+msgid "W19: Deleting augroup that is still in use"
+msgstr "W19: Знищення автогрупи, яка все ще використовується"
+
+#, c-format
+msgid "E215: Illegal character after *: %s"
+msgstr "E215: Недозволений символ після *: %s"
+
+#, c-format
+msgid "E216: No such event: %s"
+msgstr "E216: Немає такої події: %s"
+
+#, c-format
+msgid "E216: No such group or event: %s"
+msgstr "E216: Немає такої групи чи події: %s"
+
+msgid ""
+"\n"
+"--- Autocommands ---"
+msgstr ""
+"\n"
+"--- Автокоманди ---"
+
+#, c-format
+msgid "E680: <buffer=%d>: invalid buffer number "
+msgstr "E680: <буфер=%d>: некоректний номер буфера "
+
+msgid "E217: Can't execute autocommands for ALL events"
+msgstr "E217: Не можу виконувати автокоманди для УСІХ подій"
+
+msgid "No matching autocommands"
+msgstr "Немає відповідних автокоманд"
+
+msgid "E218: autocommand nesting too deep"
+msgstr "E218: Забагато вкладених автокоманд"
+
+#, c-format
+msgid "%s Autocommands for \"%s\""
+msgstr "%s Автокоманди для «%s»"
+
+#, c-format
+msgid "Executing %s"
+msgstr "Виконується %s"
+
+#, c-format
+msgid "autocommand %s"
+msgstr "автокоманда %s"
+
msgid "[Location List]"
msgstr "[Список місць]"
@@ -95,9 +156,15 @@ msgid ""
"E89: No write since last change for buffer %<PRId64> (add ! to override)"
msgstr "E89: Буфер %<PRId64> має зміни (! щоб не зважати)"
+msgid "E948: Job still running (add ! to end the job)"
+msgstr "E948: Задача все ще виконується (! щоб закінчити)"
+
msgid "E37: No write since last change (add ! to override)"
msgstr "E37: Зміни не було записано (! щоб не зважати)"
+msgid "E948: Job still running"
+msgstr "E948: Задача все ще виконується"
+
msgid "E37: No write since last change"
msgstr "E37: Не записано після останніх змін"
@@ -465,6 +532,10 @@ msgid "E957: Invalid window number"
msgstr "E957: Некоректний номер вікна"
#, c-format
+msgid "E940: Cannot lock or unlock variable %s"
+msgstr "E940: Неможливо заблокувати чи розблокувати змінну %s"
+
+#, c-format
msgid "E734: Wrong variable type for %s="
msgstr "E734: Неправильний тип змінної для %s="
@@ -544,10 +615,6 @@ msgstr "E690: Пропущено «in» після :for"
msgid "E108: No such variable: \"%s\""
msgstr "E108: Змінної немає: «%s»"
-#, c-format
-msgid "E940: Cannot lock or unlock variable %s"
-msgstr "E940: Неможливо заблокувати чи розблокувати змінну %s"
-
msgid "E109: Missing ':' after '?'"
msgstr "E109: Бракує ':' після '?'"
@@ -950,9 +1017,6 @@ msgstr "E684: Індекс списку поза межами: %<PRId64>"
msgid "E686: Argument of %s must be a List"
msgstr "E686: Аргумент у %s має бути списком"
-msgid "E928: String required"
-msgstr "E928: Потрібен String"
-
#, c-format
msgid "Error converting the call result: %s"
msgstr "Не вдалося перетворити результат виклику: %s"
@@ -1591,6 +1655,10 @@ msgid "Close \"%s\"?"
msgstr "Закрити «%s»?"
#, c-format
+msgid "E947: Job still running in buffer \"%s\""
+msgstr "E947: Задача все ще запущена у буфері «%s»"
+
+#, c-format
msgid "E162: No write since last change for buffer \"%s\""
msgstr "E162: Буфер «%s» має незбережені зміни"
@@ -1615,18 +1683,6 @@ msgid "E666: compiler not supported: %s"
msgstr "E666: Компілятор не підтримується: %s"
#, c-format
-msgid "Searching for \"%s\" in \"%s\""
-msgstr "Пошук «%s» в «%s»"
-
-#, c-format
-msgid "Searching for \"%s\""
-msgstr "Пошук «%s»"
-
-#, c-format
-msgid "not found in '%s': \"%s\""
-msgstr "не знайдено в '%s': «%s»"
-
-#, c-format
msgid ":source error parsing command %s"
msgstr ":source помилка розбору команди %s"
@@ -1702,12 +1758,16 @@ msgstr "Режим Ex. Для повернення до нормального
msgid "E501: At end-of-file"
msgstr "E501: Кінець файлу"
-msgid "E169: Command too recursive"
-msgstr "E169: Команда занадто рекурсивна"
+#, c-format
+msgid "Executing: %s"
+msgstr "Виконується: %s"
msgid "line %"
msgstr "рядок %"
+msgid "E169: Command too recursive"
+msgstr "E169: Команда занадто рекурсивна"
+
#, c-format
msgid "E605: Exception not caught: %s"
msgstr "E605: Виняткова ситуація не оброблена: %s"
@@ -1724,9 +1784,6 @@ msgstr "E464: Неоднозначний вжиток команди корис
msgid "E492: Not an editor command"
msgstr "E492: Це не команда редактора"
-msgid "E981: Command not allowed in restricted mode"
-msgstr "E981: Команду не дозволено у обмеженому режимі"
-
msgid "E493: Backwards range given"
msgstr "E493: Інтервал задано навиворіт"
@@ -1736,6 +1793,11 @@ msgstr "Інтервал задано навиворіт, щоб помінят
msgid "E494: Use w or w>>"
msgstr "E494: Спробуйте w або w>>"
+msgid ""
+"INTERNAL: Cannot use EX_DFLALL with ADDR_NONE, ADDR_UNSIGNED or ADDR_QUICKFIX"
+msgstr ""
+"ВНУТРІШНЄ: Не можна вживати EX_DFLALL з ADDR_NONE, ADDR_UNSIGNED чи ADDR_QUICKFIX"
+
msgid "E943: Command table needs to be updated, run 'make'"
msgstr "E943: Потрібно поновити таблицю команд, запустіть 'make'"
@@ -1762,10 +1824,10 @@ msgstr "E174: Команда вже існує, ! щоб замінити її:
msgid ""
"\n"
-" Name Args Address Complete Definition"
+" Name Args Address Complete Definition"
msgstr ""
"\n"
-" Назва Арг. Адреса Доповнення Визначення"
+" Назва Арг. Адреса Доповнення Визначення"
msgid "No user-defined commands found"
msgstr "Не знайдено команд користувача"
@@ -2077,12 +2139,12 @@ msgstr "E347: У шляху пошуку більше немає файлів «
msgid "E812: Autocommands changed buffer or buffer name"
msgstr "E812: Автокоманди змінили буфер чи його назву"
-msgid "Illegal file name"
-msgstr "Недозволена назва файлу"
-
msgid "is a directory"
msgstr "каталог"
+msgid "Illegal file name"
+msgstr "Недозволена назва файлу"
+
msgid "is not a file"
msgstr "не файл"
@@ -2104,9 +2166,6 @@ msgstr "E201: Автокоманди *ReadPre не повинні змінюва
msgid "E202: Conversion made file unreadable!"
msgstr "E202: Конвертація унеможливила читання файлу!"
-msgid "[fifo/socket]"
-msgstr "[канал/сокет]"
-
msgid "[fifo]"
msgstr "[канал]"
@@ -2353,67 +2412,6 @@ msgstr "E462: Не вдалося підготувати «%s», щоб пере
msgid "E321: Could not reload \"%s\""
msgstr "E321: Не вдалося перечитати «%s»"
-msgid "--Deleted--"
-msgstr "--Знищено--"
-
-#, c-format
-msgid "auto-removing autocommand: %s <buffer=%d>"
-msgstr "Автоматичне знищення автокоманди: %s <буфер=%d>"
-
-#, c-format
-msgid "E367: No such group: \"%s\""
-msgstr "E367: Немає такої групи: «%s»"
-
-msgid "E936: Cannot delete the current group"
-msgstr "E936: Не вдалося знищити цю групу"
-
-msgid "W19: Deleting augroup that is still in use"
-msgstr "W19: Знищення автогрупи, яка все ще використовується"
-
-#, c-format
-msgid "E215: Illegal character after *: %s"
-msgstr "E215: Недозволений символ після *: %s"
-
-#, c-format
-msgid "E216: No such event: %s"
-msgstr "E216: Немає такої події: %s"
-
-#, c-format
-msgid "E216: No such group or event: %s"
-msgstr "E216: Немає такої групи чи події: %s"
-
-msgid ""
-"\n"
-"--- Autocommands ---"
-msgstr ""
-"\n"
-"--- Автокоманди ---"
-
-#, c-format
-msgid "E680: <buffer=%d>: invalid buffer number "
-msgstr "E680: <буфер=%d>: некоректний номер буфера "
-
-msgid "E217: Can't execute autocommands for ALL events"
-msgstr "E217: Не можу виконувати автокоманди для УСІХ подій"
-
-msgid "No matching autocommands"
-msgstr "Немає відповідних автокоманд"
-
-msgid "E218: autocommand nesting too deep"
-msgstr "E218: Забагато вкладених автокоманд"
-
-#, c-format
-msgid "%s Autocommands for \"%s\""
-msgstr "%s Автокоманди для «%s»"
-
-#, c-format
-msgid "Executing %s"
-msgstr "Виконується %s"
-
-#, c-format
-msgid "autocommand %s"
-msgstr "автокоманда %s"
-
msgid "E219: Missing {."
msgstr "E219: Бракує {."
@@ -2519,9 +2517,6 @@ msgstr "E685: Внутрішня помилка: %s"
msgid "Interrupted"
msgstr "Перервано"
-msgid "E14: Invalid address"
-msgstr "E14: Неправильна адреса"
-
msgid "E474: Invalid argument"
msgstr "E474: Некоректний аргумент"
@@ -2719,6 +2714,9 @@ msgstr "E45: Встановлено опцію 'readonly' (! щоб не зва
msgid "E46: Cannot change read-only variable \"%.*s\""
msgstr "E46: Змінна тільки для читання: «%.*s»"
+msgid "E928: String required"
+msgstr "E928: Потрібен String"
+
msgid "E715: Dictionary required"
msgstr "E715: Потрібен словник"
@@ -2727,8 +2725,8 @@ msgid "E118: Too many arguments for function: %s"
msgstr "E118: Забагато аргументів для функції: %s"
#, c-format
-msgid "E716: Key not present in Dictionary: %s"
-msgstr "E716: Немає такого ключа у словнику: %s"
+msgid "E716: Key not present in Dictionary: \"%s\""
+msgstr "E716: Немає такого ключа у словнику: «%s»"
msgid "E714: List required"
msgstr "E714: Потрібен список"
@@ -3158,6 +3156,10 @@ msgid "E5106: Error while creating shared module: %.*s"
msgstr "E5106: Помилка створення розділюваного модуля: %.*s"
#, c-format
+msgid "E5106: Error while creating inspect module: %.*s"
+msgstr "E5106: Помилка створення модуля inspect: %.*s"
+
+#, c-format
msgid "E5106: Error while creating vim module: %.*s"
msgstr "E5106: Помилка створення модуля vim: %.*s"
@@ -3165,10 +3167,6 @@ msgid "E970: Failed to initialize lua interpreter"
msgstr "E970: Не вдалося ініціалізувати інтерпретатор lua"
#, c-format
-msgid "E5117: Error while updating package paths: %.*s"
-msgstr "E5117: Помилка оновлення шляхів пакунку: %.*s"
-
-#, c-format
msgid "E5114: Error while converting print argument #%i: %.*s"
msgstr "E5114: Не вдалося перетворити аргумент #%i друку: %.*s"
@@ -3256,6 +3254,10 @@ msgid "pre-vimrc command line"
msgstr "команди перед vimrc"
#, c-format
+msgid "Conflicting configs: \"%s\" \"%s\""
+msgstr "Суперечливі конфігурації: «%s» «%s»"
+
+#, c-format
msgid "E282: Cannot read from \"%s\""
msgstr "E282: Не вдалося прочитати з «%s»"
@@ -3367,9 +3369,6 @@ msgstr " -v, --version Надрукувати інформацію пр
msgid " -V[N][file] Verbose [level][file]\n"
msgstr " -V[N][файл] Більше повідомлень [рівень][файл]\n"
-msgid " -Z Restricted mode\n"
-msgstr " -Z Обмежений режим\n"
-
msgid " --api-info Write msgpack-encoded API metadata to stdout\n"
msgstr ""
" --api-info Записати метадані API, серіалізовані у msgpack, у "
@@ -4005,8 +4004,7 @@ msgstr ""
"Введіть :qa! і натисність <Enter> щоб відкинути всі зміни і вийти Nvim"
msgid "Type :qa and press <Enter> to exit Nvim"
-msgstr ""
-"Введіть :qa і натисність <Enter> щоб вийти з Nvim"
+msgstr "Введіть :qa і натисність <Enter> щоб вийти з Nvim"
#, c-format
msgid "1 line %sed 1 time"
@@ -4071,10 +4069,10 @@ msgstr "E353: У регістрі %s нічого немає"
msgid ""
"\n"
-"--- Registers ---"
+"Type Name Content"
msgstr ""
"\n"
-"--- Регістри ---"
+"Тип Наз. Вміст "
msgid ""
"E883: search pattern and expression register may not contain two or more "
@@ -4187,9 +4185,6 @@ msgstr "E537: 'commentstring' має бути порожньою чи місти
msgid "E540: Unclosed expression sequence"
msgstr "E540: Послідовність виразів не завершено"
-msgid "E541: too many items"
-msgstr "E541: Забагато елементів"
-
msgid "E542: unbalanced groups"
msgstr "E542: Групи не збалансовано"
@@ -4277,6 +4272,9 @@ msgstr ""
msgid "E5677: Error writing input to shell-command: %s"
msgstr "E5677: Не вдалося записати на вхід команди оболонки: %s"
+msgid "%a %b %d %H:%M:%S %Y"
+msgstr "%H:%M:%S %a, %d %B %Y р."
+
#, c-format
msgid "E447: Can't find file \"%s\" in path"
msgstr "E447: Файл «%s» не знайдено у шляху пошуку"
@@ -4284,8 +4282,11 @@ msgstr "E447: Файл «%s» не знайдено у шляху пошуку"
msgid "E553: No more items"
msgstr "E553: Немає більше елементів"
+msgid "E925: Current quickfix list was changed"
+msgstr "E925: Поточний список quickfix змінився"
+
msgid "E926: Current location list was changed"
-msgstr "E926: Цей список місць було змінено"
+msgstr "E926: Поточний список місць змінився"
#, c-format
msgid "E372: Too many %%%c in format string"
@@ -4319,9 +4320,6 @@ msgstr "E379: Пропущена чи порожня назва каталогу
msgid "E924: Current window was closed"
msgstr "E924: Активне вікно було закрито"
-msgid "E925: Current quickfix was changed"
-msgstr "E925: Цей quickfix було змінено"
-
#, c-format
msgid "(%d of %d)%s%s: "
msgstr "(%d з %d)%s%s: "
@@ -4349,6 +4347,9 @@ msgstr "E683: Пропущено назву файлу чи некоректни
msgid "Cannot open file \"%s\""
msgstr "Не вдалося відкрити файл «%s»"
+msgid "cannot have both a list and a \"what\" argument"
+msgstr "не можна задавати одночасно список і аргумент «що»"
+
msgid "E681: Buffer is not loaded"
msgstr "E681: Буфер не завантажено"
@@ -4469,6 +4470,18 @@ msgstr ""
msgid "Switching to backtracking RE engine for pattern: "
msgstr "Перемикання до простого рушія регулярних виразів: "
+#, c-format
+msgid "Searching for \"%s\" in \"%s\""
+msgstr "Пошук «%s» в «%s»"
+
+#, c-format
+msgid "Searching for \"%s\""
+msgstr "Пошук «%s»"
+
+#, c-format
+msgid "not found in '%s': \"%s\""
+msgstr "не знайдено в '%s': «%s»"
+
msgid " TERMINAL"
msgstr " ТЕРМІНАЛ"
@@ -5252,6 +5265,9 @@ msgstr "синхронізується по коментарях стилю С"
msgid "no syncing"
msgstr "без синхронізації"
+msgid "syncing starts at the first line"
+msgstr "синхронізація починається з першого рядка"
+
msgid "syncing starts "
msgstr "починається синхронізація за "
@@ -5283,6 +5299,9 @@ msgstr ""
msgid "E392: No such syntax cluster: %s"
msgstr "E392: Немає такого синтаксичного кластера: %s"
+msgid "from the first line"
+msgstr "з першого рядка"
+
msgid "minimal "
msgstr "мінімальний "
diff --git a/src/nvim/po/vi.po b/src/nvim/po/vi.po
index a954ea6e34..c693f910d8 100644
--- a/src/nvim/po/vi.po
+++ b/src/nvim/po/vi.po
@@ -3479,10 +3479,6 @@ msgstr "-y\t\t\tChế độ đơn giản (giống \"evim\", không có chế đ
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\tChế độ chỉ đọc (giống \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\tChế độ hạn chế (giống \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\tKhông có khả năng ghi nhớ thay đổi (ghi nhớ tập tin)"
diff --git a/src/nvim/po/zh_CN.UTF-8.po b/src/nvim/po/zh_CN.UTF-8.po
index 542157002a..1e329443ce 100644
--- a/src/nvim/po/zh_CN.UTF-8.po
+++ b/src/nvim/po/zh_CN.UTF-8.po
@@ -3427,10 +3427,6 @@ msgstr "-y\t\t\t容易模式 (同 \"evim\",无模式)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\t只读模式 (同 \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\t限制模式 (同 \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\t不可修改(写入文件)"
diff --git a/src/nvim/po/zh_TW.UTF-8.po b/src/nvim/po/zh_TW.UTF-8.po
index 6a11b5e669..c97f31ddcf 100644
--- a/src/nvim/po/zh_TW.UTF-8.po
+++ b/src/nvim/po/zh_TW.UTF-8.po
@@ -3482,10 +3482,6 @@ msgstr "-y\t\t\t簡易模式 (同 \"evim\", modeless)"
msgid "-R\t\t\tReadonly mode (like \"view\")"
msgstr "-R\t\t\t唯讀模式 (同 \"view\")"
-#: ../main.c:2208
-msgid "-Z\t\t\tRestricted mode (like \"rvim\")"
-msgstr "-Z\t\t\t限制模式 (同 \"rvim\")"
-
#: ../main.c:2209
msgid "-m\t\t\tModifications (writing files) not allowed"
msgstr "-m\t\t\t不可修改 (寫入檔案)"
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 5714f5e425..6425c9fed5 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -3123,6 +3123,7 @@ spell_find_suggest (
static bool expr_busy = false;
int c;
langp_T *lp;
+ bool did_intern = false;
// Set the info in "*su".
memset(su, 0, sizeof(suginfo_T));
@@ -3206,14 +3207,16 @@ spell_find_suggest (
spell_suggest_expr(su, buf + 5);
expr_busy = false;
}
- } else if (STRNCMP(buf, "file:", 5) == 0)
+ } else if (STRNCMP(buf, "file:", 5) == 0) {
// Use list of suggestions in a file.
spell_suggest_file(su, buf + 5);
- else {
- // Use internal method.
+ } else if (!did_intern) {
+ // Use internal method once.
spell_suggest_intern(su, interactive);
- if (sps_flags & SPS_DOUBLE)
+ if (sps_flags & SPS_DOUBLE) {
do_combine = true;
+ }
+ did_intern = true;
}
}
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 180170fe9a..f9f0ade1f6 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -159,6 +159,7 @@ let s:filename_checks = {
\ 'elinks': ['elinks.conf'],
\ 'elm': ['file.elm'],
\ 'elmfilt': ['filter-rules'],
+ \ 'epuppet': ['file.epp'],
\ 'erlang': ['file.erl', 'file.hrl', 'file.yaws'],
\ 'eruby': ['file.erb', 'file.rhtml'],
\ 'esmtprc': ['anyesmtprc'],
@@ -171,6 +172,7 @@ let s:filename_checks = {
\ 'factor': ['file.factor'],
\ 'falcon': ['file.fal'],
\ 'fan': ['file.fan', 'file.fwt'],
+ \ 'fennel': ['file.fnl'],
\ 'fetchmail': ['.fetchmailrc'],
\ 'fgl': ['file.4gl', 'file.4gh', 'file.m4gl'],
\ 'focexec': ['file.fex', 'file.focexec'],
@@ -374,6 +376,7 @@ let s:filename_checks = {
\ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg'],
\ 'radiance': ['file.rad', 'file.mat'],
\ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'],
+ \ 'rbs': ['file.rbs'],
\ 'rc': ['file.rc', 'file.rch'],
\ 'rcs': ['file,v'],
\ 'readline': ['.inputrc', 'inputrc'],
@@ -390,7 +393,7 @@ let s:filename_checks = {
\ 'rpl': ['file.rpl'],
\ 'rst': ['file.rst'],
\ 'rtf': ['file.rtf'],
- \ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake'],
+ \ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile'],
\ 'rust': ['file.rs'],
\ 'samba': ['smb.conf'],
\ 'sas': ['file.sas'],
@@ -622,6 +625,7 @@ let s:script_checks = {
\ ['// -*- C++ -*-']],
\ 'yaml': [['%YAML 1.2']],
\ 'pascal': [['#!/path/instantfpc']],
+ \ 'fennel': [['#!/path/fennel']],
\ }
" Various forms of "env" optional arguments.
@@ -692,6 +696,23 @@ func Test_ts_file()
filetype off
endfunc
+func Test_ttl_file()
+ filetype on
+
+ call writefile(['@base <http://example.org/> .'], 'Xfile.ttl')
+ split Xfile.ttl
+ call assert_equal('turtle', &filetype)
+ bwipe!
+
+ call writefile(['looks like Tera Term Language'], 'Xfile.ttl')
+ split Xfile.ttl
+ call assert_equal('teraterm', &filetype)
+ bwipe!
+
+ call delete('Xfile.ttl')
+ filetype off
+endfunc
+
func Test_pp_file()
filetype on
diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim
index 88ce64b9eb..2d058e8e32 100644
--- a/src/nvim/testdir/test_fold.vim
+++ b/src/nvim/testdir/test_fold.vim
@@ -822,4 +822,39 @@ func Test_fold_create_delete()
bwipe!
endfunc
+func Test_fold_relative_move()
+ enew!
+ set fdm=indent sw=2 wrap tw=80
+
+ let content = [ ' foo', ' bar', ' baz',
+ \ repeat('x', &columns + 1),
+ \ ' foo', ' bar', ' baz'
+ \ ]
+ call append(0, content)
+
+ normal zM
+
+ call cursor(3, 1)
+ call assert_true(foldclosed(line('.')))
+ normal gj
+ call assert_equal(2, winline())
+
+ call cursor(2, 1)
+ call assert_true(foldclosed(line('.')))
+ normal 2gj
+ call assert_equal(3, winline())
+
+ call cursor(5, 1)
+ call assert_true(foldclosed(line('.')))
+ normal gk
+ call assert_equal(3, winline())
+
+ call cursor(6, 1)
+ call assert_true(foldclosed(line('.')))
+ normal 2gk
+ call assert_equal(2, winline())
+
+ set fdm& sw& wrap& tw&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_highlight.vim b/src/nvim/testdir/test_highlight.vim
index 8f6834c2ab..4cc4d775d1 100644
--- a/src/nvim/testdir/test_highlight.vim
+++ b/src/nvim/testdir/test_highlight.vim
@@ -2,6 +2,7 @@
source view_util.vim
source screendump.vim
+source check.vim
func Test_highlight()
" basic test if ":highlight" doesn't crash
@@ -610,3 +611,16 @@ func Test_1_highlight_Normalgroup_exists()
call assert_match('hi Normal\s*font=.*', hlNormal)
endif
endfunc
+
+" Test for using RGB color values in a highlight group
+func Test_xxlast_highlight_RGB_color()
+ CheckCanRunGui
+ gui -f
+ hi MySearch guifg=#110000 guibg=#001100 guisp=#000011
+ call assert_equal('#110000', synIDattr(synIDtrans(hlID('MySearch')), 'fg#'))
+ call assert_equal('#001100', synIDattr(synIDtrans(hlID('MySearch')), 'bg#'))
+ call assert_equal('#000011', synIDattr(synIDtrans(hlID('MySearch')), 'sp#'))
+ hi clear
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 01f20cf29a..e70749795b 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -159,6 +159,7 @@ enum {
EXPAND_MAPCLEAR,
EXPAND_ARGLIST,
EXPAND_CHECKHEALTH,
+ EXPAND_LUA,
};
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua
index ab913ba4a4..d2b555ee5b 100644
--- a/test/functional/api/extmark_spec.lua
+++ b/test/functional/api/extmark_spec.lua
@@ -1389,6 +1389,40 @@ describe('API/extmarks', function()
undo]],false)
eq(2, meths.eval('1+1')) -- did not crash
end)
+
+ it('works with left and right gravity', function()
+ -- right gravity should move with inserted text, while
+ -- left gravity should stay in place.
+ curbufmeths.set_extmark(ns, 0, 5, {right_gravity = false})
+ curbufmeths.set_extmark(ns, 0, 5, {right_gravity = true})
+ feed([[Aasdfasdf]])
+
+ eq({ {1, 0, 5}, {2, 0, 13} },
+ curbufmeths.get_extmarks(ns, 0, -1, {}))
+
+ -- but both move when text is inserted before
+ feed([[<esc>Iasdf<esc>]])
+ -- eq({}, curbufmeths.get_lines(0, -1, true))
+ eq({ {1, 0, 9}, {2, 0, 17} },
+ curbufmeths.get_extmarks(ns, 0, -1, {}))
+
+ -- clear text
+ curbufmeths.set_text(0, 0, 0, 17, {})
+
+ -- handles set_text correctly as well
+ eq({ {1, 0, 0}, {2, 0, 0} },
+ meths.buf_get_extmarks(0, ns, 0, -1, {}))
+ curbufmeths.set_text(0, 0, 0, 0, {'asdfasdf'})
+ eq({ {1, 0, 0}, {2, 0, 8} },
+ curbufmeths.get_extmarks(ns, 0, -1, {}))
+
+ feed('u')
+ -- handles pasting
+ meths.exec([[let @a='asdfasdf']], false)
+ feed([["ap]])
+ eq({ {1, 0, 0}, {2, 0, 8} },
+ meths.buf_get_extmarks(0, ns, 0, -1, {}))
+ end)
end)
describe('Extmarks buffer api with many marks', function()
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 30128e9c40..3ff3efb8c9 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -2002,4 +2002,77 @@ describe('API', function()
}, meths.get_option_info'showcmd')
end)
end)
+
+ describe('nvim_echo', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(40, 8)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [0] = {bold=true, foreground=Screen.colors.Blue},
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen},
+ [2] = {bold = true, reverse = true},
+ [3] = {foreground = Screen.colors.Brown, bold = true}, -- Statement
+ [4] = {foreground = Screen.colors.SlateBlue}, -- Special
+ })
+ command('highlight Statement gui=bold guifg=Brown')
+ command('highlight Special guifg=SlateBlue')
+ end)
+
+ it('should clear cmdline message before echo', function()
+ feed(':call nvim_echo([["msg"]], v:false, {})<CR>')
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ msg |
+ ]]}
+ end)
+
+ it('can show highlighted line', function()
+ nvim_async("echo", {{"msg_a"}, {"msg_b", "Statement"}, {"msg_c", "Special"}}, true, {})
+ screen:expect{grid=[[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ msg_a{3:msg_b}{4:msg_c} |
+ ]]}
+ end)
+
+ it('can show highlighted multiline', function()
+ nvim_async("echo", {{"msg_a\nmsg_a", "Statement"}, {"msg_b", "Special"}}, true, {})
+ screen:expect{grid=[[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {2: }|
+ {3:msg_a} |
+ {3:msg_a}{4:msg_b} |
+ {1:Press ENTER or type command to continue}^ |
+ ]]}
+ end)
+
+ it('can save message history', function()
+ nvim('command', 'set cmdheight=2') -- suppress Press ENTER
+ nvim("echo", {{"msg\nmsg"}, {"msg"}}, true, {})
+ eq("msg\nmsgmsg", meths.exec('messages', true))
+ end)
+
+ it('can disable saving message history', function()
+ nvim('command', 'set cmdheight=2') -- suppress Press ENTER
+ nvim_async("echo", {{"msg\nmsg"}, {"msg"}}, false, {})
+ eq("", meths.exec("messages", true))
+ end)
+ end)
end)
diff --git a/test/functional/lua/command_line_completion_spec.lua b/test/functional/lua/command_line_completion_spec.lua
new file mode 100644
index 0000000000..3ba7e1589f
--- /dev/null
+++ b/test/functional/lua/command_line_completion_spec.lua
@@ -0,0 +1,171 @@
+local helpers = require('test.functional.helpers')(after_each)
+
+local clear = helpers.clear
+local eq = helpers.eq
+local exec_lua = helpers.exec_lua
+
+local get_completions = function(input, env)
+ return exec_lua("return {vim._expand_pat(...)}", '^' .. input, env)
+end
+
+local get_compl_parts = function(parts)
+ return exec_lua("return {vim._expand_pat_get_parts(...)}", parts)
+end
+
+before_each(clear)
+
+describe('nlua_expand_pat', function()
+ it('should complete exact matches', function()
+ eq({{'exact'}, 0}, get_completions('exact', { exact = true }))
+ end)
+
+ it('should return empty table when nothing matches', function()
+ eq({{}, 0}, get_completions('foo', { bar = true }))
+ end)
+
+ it('should return nice completions with function call prefix', function()
+ eq({{'FOO'}, 6}, get_completions('print(F', { FOO = true, bawr = true }))
+ end)
+
+ it('should return keys for nested dictionaries', function()
+ eq(
+ {{
+ 'nvim_buf_set_lines',
+ 'nvim_buf_set_option'
+ }, 8
+ },
+ get_completions('vim.api.nvim_buf_', {
+ vim = {
+ api = {
+ nvim_buf_set_lines = true,
+ nvim_buf_set_option = true,
+ nvim_win_doesnt_match = true,
+ },
+ other_key = true,
+ }
+ })
+ )
+ end)
+
+ it('it should work with colons', function()
+ eq(
+ {{
+ 'bawr',
+ 'baz',
+ }, 8
+ },
+ get_completions('MyClass:b', {
+ MyClass = {
+ baz = true,
+ bawr = true,
+ foo = false,
+ }
+ })
+ )
+ end)
+
+ it('should return keys for string reffed dictionaries', function()
+ eq(
+ {{
+ 'nvim_buf_set_lines',
+ 'nvim_buf_set_option'
+ }, 11
+ },
+ get_completions('vim["api"].nvim_buf_', {
+ vim = {
+ api = {
+ nvim_buf_set_lines = true,
+ nvim_buf_set_option = true,
+ nvim_win_doesnt_match = true,
+ },
+ other_key = true,
+ }
+ })
+ )
+ end)
+
+ it('should return keys for string reffed dictionaries', function()
+ eq(
+ {{
+ 'nvim_buf_set_lines',
+ 'nvim_buf_set_option'
+ }, 21
+ },
+ get_completions('vim["nested"]["api"].nvim_buf_', {
+ vim = {
+ nested = {
+ api = {
+ nvim_buf_set_lines = true,
+ nvim_buf_set_option = true,
+ nvim_win_doesnt_match = true,
+ },
+ },
+ other_key = true,
+ }
+ })
+ )
+ end)
+
+ it('should be able to interpolate globals', function()
+ eq(
+ {{
+ 'nvim_buf_set_lines',
+ 'nvim_buf_set_option'
+ }, 12
+ },
+ get_completions('vim[MY_VAR].nvim_buf_', {
+ MY_VAR = "api",
+ vim = {
+ api = {
+ nvim_buf_set_lines = true,
+ nvim_buf_set_option = true,
+ nvim_win_doesnt_match = true,
+ },
+ other_key = true,
+ }
+ })
+ )
+ end)
+
+ it('should return everything if the input is of length 0', function()
+ eq({{"other", "vim"}, 0}, get_completions('', { vim = true, other = true }))
+ end)
+
+ describe('get_parts', function()
+ it('should return an empty list for no separators', function()
+ eq({{}, 1}, get_compl_parts("vim"))
+ end)
+
+ it('just the first item before a period', function()
+ eq({{"vim"}, 5}, get_compl_parts("vim.ap"))
+ end)
+
+ it('should return multiple parts just for period', function()
+ eq({{"vim", "api"}, 9}, get_compl_parts("vim.api.nvim_buf"))
+ end)
+
+ it('should be OK with colons', function()
+ eq({{"vim", "api"}, 9}, get_compl_parts("vim:api.nvim_buf"))
+ end)
+
+ it('should work for just one string ref', function()
+ eq({{"vim", "api"}, 12}, get_compl_parts("vim['api'].nvim_buf"))
+ end)
+
+ it('should work for just one string ref, with double quote', function()
+ eq({{"vim", "api"}, 12}, get_compl_parts('vim["api"].nvim_buf'))
+ end)
+
+ it('should allows back-to-back string ref', function()
+ eq({{"vim", "nested", "api"}, 22}, get_compl_parts('vim["nested"]["api"].nvim_buf'))
+ end)
+
+ it('should allows back-to-back string ref with spaces before and after', function()
+ eq({{"vim", "nested", "api"}, 25}, get_compl_parts('vim[ "nested" ]["api"].nvim_buf'))
+ end)
+
+ it('should allow VAR style loolup', function()
+ eq({{"vim", {"NESTED"}, "api"}, 20}, get_compl_parts('vim[NESTED]["api"].nvim_buf'))
+ end)
+ end)
+end)
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index e8caa05260..981e2a96a8 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -193,6 +193,12 @@ describe('LSP', function()
end)
describe('basic_init test', function()
+ after_each(function()
+ stop()
+ exec_lua("lsp.stop_client(lsp.get_active_clients())")
+ exec_lua("lsp._vim_exit_handler()")
+ end)
+
it('should run correctly', function()
local expected_callbacks = {
{NIL, "test", {}, 1};
@@ -303,6 +309,19 @@ describe('LSP', function()
end;
}
end)
+ it('workspace/configuration returns NIL per section if client was started without config.settings', function()
+ clear()
+ fake_lsp_server_setup('workspace/configuration no settings')
+ eq({ NIL, NIL, }, exec_lua [[
+ local params = {
+ items = {
+ {section = 'foo'},
+ {section = 'bar'},
+ }
+ }
+ return vim.lsp.handlers['workspace/configuration'](nil, nil, params, TEST_RPC_CLIENT_ID)
+ ]])
+ end)
it('should verify capabilities sent', function()
local expected_callbacks = {
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 520574c08a..f99362fbdf 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -245,7 +245,7 @@ void ui_refresh(void)
parser = vim.treesitter.get_parser(0, "c")
tree = parser:parse()[1]
res = {}
- for pattern, match in cquery:iter_matches(tree:root(), 0, 0, 1) do
+ for pattern, match in cquery:iter_matches(tree:root(), 0) do
-- can't transmit node over RPC. just check the name and range
local mrepr = {}
for cid,node in pairs(match) do
@@ -289,7 +289,7 @@ void ui_refresh(void)
local query = query.parse_query("c", ...)
local nodes = {}
- for _, node in query:iter_captures(parser:parse()[1]:root(), 0, 0, 19) do
+ for _, node in query:iter_captures(parser:parse()[1]:root(), 0) do
table.insert(nodes, {node:range()})
end
@@ -365,7 +365,7 @@ void ui_refresh(void)
query = vim.treesitter.parse_query("c", "(declaration) @decl")
local nodes = {}
- for _, node in query:iter_captures(parser:parse()[1]:root(), 0, 0, 19) do
+ for _, node in query:iter_captures(parser:parse()[1]:root(), 0) do
table.insert(nodes, node)
end
@@ -412,7 +412,7 @@ void ui_refresh(void)
local nodes = {}
local query = vim.treesitter.parse_query("c", '((identifier) @id (eq? @id "foo"))')
- for _, node in query:iter_captures(parser:parse()[1]:root(), str, 0, 2) do
+ for _, node in query:iter_captures(parser:parse()[1]:root(), str) do
table.insert(nodes, { node:range() })
end
@@ -421,6 +421,29 @@ void ui_refresh(void)
eq({ {0, 10, 0, 13} }, ret)
end)
+ it("should use node range when omitted", function()
+ local txt = [[
+ int foo = 42;
+ int bar = 13;
+ ]]
+
+ local ret = exec_lua([[
+ local str = ...
+ local parser = vim.treesitter.get_string_parser(str, "c")
+
+ local nodes = {}
+ local query = vim.treesitter.parse_query("c", '((identifier) @foo)')
+ local first_child = parser:parse()[1]:root():child(1)
+
+ for _, node in query:iter_captures(first_child, str) do
+ table.insert(nodes, { node:range() })
+ end
+
+ return nodes]], txt)
+
+ eq({ {1, 10, 1, 13} }, ret)
+ end)
+
describe("when creating a language tree", function()
local function get_ranges()
return exec_lua([[
@@ -539,7 +562,7 @@ int x = INT_MAX;
query = vim.treesitter.parse_query("c", '((number_literal) @number (#set! "key" "value"))')
parser = vim.treesitter.get_parser(0, "c")
- for pattern, match, metadata in query:iter_matches(parser:parse()[1]:root(), 0, 0, 1) do
+ for pattern, match, metadata in query:iter_matches(parser:parse()[1]:root(), 0) do
result = metadata.key
end
@@ -562,7 +585,7 @@ int x = INT_MAX;
query = vim.treesitter.parse_query("c", '((number_literal) @number (#set! @number "key" "value"))')
parser = vim.treesitter.get_parser(0, "c")
- for pattern, match, metadata in query:iter_matches(parser:parse()[1]:root(), 0, 0, 1) do
+ for pattern, match, metadata in query:iter_matches(parser:parse()[1]:root(), 0) do
result = metadata[pattern].key
end
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index d1b8de5e4e..1937102782 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -266,6 +266,111 @@ describe('Signs', function()
]]}
end)
+ it('auto-resize sign column with minimum size (#13783)', function()
+ feed('ia<cr>b<cr>c<cr><esc>')
+ command('set number')
+ -- sign column should always accommodate at the minimum size
+ command('set signcolumn=auto:1-3')
+ screen:expect([[
+ {2: }{6: 1 }a |
+ {2: }{6: 2 }b |
+ {2: }{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- should support up to 8 signs at minimum
+ command('set signcolumn=auto:8-9')
+ screen:expect([[
+ {2: }{6: 1 }a |
+ {2: }{6: 2 }b |
+ {2: }{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- should keep the same sign size when signs are not exceeding
+ -- the minimum
+ command('set signcolumn=auto:2-5')
+ command('sign define pietSearch text=>> texthl=Search')
+ command('sign place 1 line=1 name=pietSearch buffer=1')
+ screen:expect([[
+ {1:>>}{2: }{6: 1 }a |
+ {2: }{6: 2 }b |
+ {2: }{6: 3 }c |
+ {2: }{6: 4 }^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- should resize itself when signs are exceeding minimum but
+ -- not over the maximum
+ command('sign place 2 line=1 name=pietSearch buffer=1')
+ command('sign place 3 line=1 name=pietSearch buffer=1')
+ command('sign place 4 line=1 name=pietSearch buffer=1')
+ screen:expect([[
+ {1:>>>>>>>>}{6: 1 }a |
+ {2: }{6: 2 }b |
+ {2: }{6: 3 }c |
+ {2: }{6:^ 4 } |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ -- should keep the column at maximum size when signs are
+ -- exceeding the maximum
+ command('sign place 5 line=1 name=pietSearch buffer=1')
+ command('sign place 6 line=1 name=pietSearch buffer=1')
+ command('sign place 7 line=1 name=pietSearch buffer=1')
+ command('sign place 8 line=1 name=pietSearch buffer=1')
+ screen:expect([[
+ {1:>>>>>>>>>>}{6: 1 }a |
+ {2: }{6: 2 }b |
+ {2: }{6: 3 }c |
+ {2: ^ }{6: 4 } |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
it('ignores signs with no icon and text when calculting the signcolumn width', function()
feed('ia<cr>b<cr>c<cr><esc>')
command('set number')
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 01fc50289d..a4241fe5aa 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
local clear, feed = helpers.clear, helpers.feed
local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq
local feed_command, source, expect = helpers.feed_command, helpers.source, helpers.expect
+local funcs = helpers.funcs
local curbufmeths = helpers.curbufmeths
local command = helpers.command
local meths = helpers.meths
@@ -26,6 +27,7 @@ describe('completion', function()
[7] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[8] = {reverse = true},
[9] = {bold = true, reverse = true},
+ [10] = {foreground = Screen.colors.Grey0, background = Screen.colors.Yellow},
})
end)
@@ -895,8 +897,47 @@ describe('completion', function()
]])
end)
- describe('from the commandline window', function()
+ describe('lua completion', function()
+ it('expands when there is only one match', function()
+ feed(':lua CURRENT_TESTING_VAR = 1<CR>')
+ feed(':lua CURRENT_TESTING_<TAB>')
+ screen:expect{grid=[[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ :lua CURRENT_TESTING_VAR^ |
+ ]]}
+ end)
+ it('expands when there is only one match', function()
+ feed(':lua CURRENT_TESTING_FOO = 1<CR>')
+ feed(':lua CURRENT_TESTING_BAR = 1<CR>')
+ feed(':lua CURRENT_TESTING_<TAB>')
+ screen:expect{ grid = [[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {10:CURRENT_TESTING_BAR}{9: CURRENT_TESTING_FOO }|
+ :lua CURRENT_TESTING_BAR^ |
+ ]], unchanged = true }
+ end)
+
+ it('provides completion from `getcompletion()`', function()
+ eq({'vim'}, funcs.getcompletion('vi', 'lua'))
+ eq({'api'}, funcs.getcompletion('vim.ap', 'lua'))
+ eq({'tbl_filter'}, funcs.getcompletion('vim.tbl_fil', 'lua'))
+ eq({'vim'}, funcs.getcompletion('print(vi', 'lua'))
+ end)
+ end)
+
+ describe('from the commandline window', function()
it('is cleared after CTRL-C', function ()
feed('q:')
feed('ifoo faa fee f')
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 5af5eb0a49..aab8eb4464 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -196,11 +196,11 @@ set(GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47
set(LIBICONV_URL https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz)
set(LIBICONV_SHA256 ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178)
-set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/6002fcd.tar.gz)
-set(TREESITTER_C_SHA256 46f8d44fa886d9ddb92571bb6fa8b175992c8758eca749cb1217464e512b6e97)
+set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/99151b1.tar.gz)
+set(TREESITTER_C_SHA256 950386f9ba77fb6a7e992198d4f219c34238a2bbc005c5f53c4212d0f8772b06)
-set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/0.17.3.zip)
-set(TREESITTER_SHA256 19068b6663f5a4cacd5d805fa437419e3c29eb615ed9523e438b400b79f39c20)
+set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/0.18.0.zip)
+set(TREESITTER_SHA256 ac53b7708ca47161dac7f8e852bd61accb8527d45b7ad72e29e12e8e72dbe440)
if(USE_BUNDLED_UNIBILIUM)
include(BuildUnibilium)