aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/remote/define.vim6
-rw-r--r--runtime/doc/autocmd.txt4
-rw-r--r--runtime/doc/diagnostic.txt2
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--runtime/filetype.vim4
-rw-r--r--runtime/lua/vim/lsp/handlers.lua4
-rw-r--r--runtime/lua/vim/treesitter/query.lua38
7 files changed, 39 insertions, 20 deletions
diff --git a/runtime/autoload/remote/define.vim b/runtime/autoload/remote/define.vim
index 2aec96e365..82e5164d85 100644
--- a/runtime/autoload/remote/define.vim
+++ b/runtime/autoload/remote/define.vim
@@ -240,7 +240,11 @@ function! s:GetAutocmdPrefix(name, opts)
endif
if has_key(a:opts, 'nested') && a:opts.nested
- call add(rv, 'nested')
+ call add(rv, '++nested')
+ endif
+
+ if has_key(a:opts, 'once') && a:opts.once
+ call add(rv, '++once')
endif
return join(rv, ' ')
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 879a34bcaa..242631d98c 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -824,6 +824,10 @@ RemoteReply When a reply from a Vim that functions as
Note that even if an autocommand is defined,
the reply should be read with |remote_read()|
to consume it.
+ *SearchWrapped*
+SearchWrapped After making a search with |n| or |N| if the
+ search wraps around the document back to
+ the start/finish respectively.
*SessionLoadPost*
SessionLoadPost After loading the session file created using
the |:mksession| command.
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index d02510a829..0893f1f343 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -41,6 +41,7 @@ requires a namespace.
*diagnostic-structure*
A diagnostic is a Lua table with the following keys:
+ bufnr: Buffer number
lnum: The starting line of the diagnostic
end_lnum: The final line of the diagnostic
col: The starting column of the diagnostic
@@ -48,6 +49,7 @@ A diagnostic is a Lua table with the following keys:
severity: The severity of the diagnostic |vim.diagnostic.severity|
message: The diagnostic text
source: The source of the diagnostic
+ user_data: Arbitrary data plugins or users can add
Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
rows and columns). |api-indexing|
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 956cb3e624..bc59ea785e 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -180,6 +180,7 @@ Commands:
|:match| can be invoked before highlight group is defined
Events:
+ |SearchWrapped|
|Signal|
|TabNewEntered|
|TermClose|
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 3e57ae7f0f..b93263eb6d 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -786,6 +786,10 @@ au BufNewFile,BufRead *.hb setf hb
" Httest
au BufNewFile,BufRead *.htt,*.htb setf httest
+" i3 (and sway)
+au BufNewFile,BufRead */i3/config,*/sway/config setf i3config
+au BufNewFile,BufRead */.i3/config,*/.sway/config setf i3config
+
" Icon
au BufNewFile,BufRead *.icn setf icon
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 22089aaaa6..c974d1a6b4 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -285,7 +285,7 @@ local function location_handler(_, result, ctx, _)
util.jump_to_location(result[1])
if #result > 1 then
- util.set_qflist(util.locations_to_items(result))
+ vim.fn.setqflist({}, ' ', {title = 'LSP locations', items = util.locations_to_items(result)})
api.nvim_command("copen")
end
else
@@ -379,7 +379,7 @@ local make_call_hierarchy_handler = function(direction)
})
end
end
- util.set_qflist(items)
+ vim.fn.setqflist({}, ' ', {title = 'LSP call hierarchy', items = items})
api.nvim_command("copen")
end
end
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index b8255e61ed..ebed502c92 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -164,22 +164,36 @@ function M.parse_query(lang, query)
return self
end
--- TODO(vigoux): support multiline nodes too
-
--- Gets the text corresponding to a given node
---
---@param node the node
----@param bsource The buffer or string from which the node is extracted
+---@param source The buffer or string from which the node is extracted
function M.get_node_text(node, source)
local start_row, start_col, start_byte = node:start()
local end_row, end_col, end_byte = node:end_()
if type(source) == "number" then
- if start_row ~= end_row then
+ local lines
+ local eof_row = a.nvim_buf_line_count(source)
+ if start_row >= eof_row then
return nil
end
- local line = a.nvim_buf_get_lines(source, start_row, start_row+1, true)[1]
- return string.sub(line, start_col+1, end_col)
+
+ if end_col == 0 then
+ lines = a.nvim_buf_get_lines(source, start_row, end_row, true)
+ end_col = -1
+ else
+ lines = a.nvim_buf_get_lines(source, start_row, end_row + 1, true)
+ end
+
+ if #lines == 1 then
+ lines[1] = string.sub(lines[1], start_col+1, end_col)
+ else
+ lines[1] = string.sub(lines[1], start_col+1)
+ lines[#lines] = string.sub(lines[#lines], 1, end_col)
+ end
+
+ return table.concat(lines, "\n")
elseif type(source) == "string" then
return source:sub(start_byte+1, end_byte)
end
@@ -211,11 +225,6 @@ local predicate_handlers = {
["lua-match?"] = function(match, _, source, predicate)
local node = match[predicate[2]]
local regex = predicate[3]
- local start_row, _, end_row, _ = node:range()
- if start_row ~= end_row then
- return false
- end
-
return string.find(M.get_node_text(node, source), regex)
end,
@@ -239,13 +248,8 @@ local predicate_handlers = {
return function(match, _, source, pred)
local node = match[pred[2]]
- local start_row, start_col, end_row, end_col = node:range()
- if start_row ~= end_row then
- return false
- end
-
local regex = compiled_vim_regexes[pred[3]]
- return regex:match_line(source, start_row, start_col, end_col)
+ return regex:match_str(M.get_node_text(node, source))
end
end)(),