mirror of
https://github.com/neovim/neovim.git
synced 2026-05-23 21:30:11 +00:00
docs: misc, rename "tabpage"
Co-authored-by: michael-grunder <michael.grunder@gmail.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev> Co-authored-by: Felipe Matarazzo <felipemps@protonmail.com>
This commit is contained in:
@@ -362,17 +362,20 @@ end
|
||||
--- Buffer number (nil or 0 for current buffer)
|
||||
--- @field bufnr integer?
|
||||
---
|
||||
--- 0-indexed (row, col) tuple. Defaults to cursor position in the
|
||||
--- current window. Required if {bufnr} is not the current buffer
|
||||
--- 0-indexed (row, col) tuple. Required if {bufnr} is not the current buffer
|
||||
--- (default: window-local cursor)
|
||||
--- @field pos [integer, integer]?
|
||||
---
|
||||
--- Parser language. (default: from buffer filetype)
|
||||
--- Parser language.
|
||||
--- (default: from 'filetype')
|
||||
--- @field lang string?
|
||||
---
|
||||
--- Ignore injected languages (default true)
|
||||
--- Ignore injected languages
|
||||
--- (default: true)
|
||||
--- @field ignore_injections boolean?
|
||||
---
|
||||
--- Include anonymous nodes (default false)
|
||||
--- Include anonymous nodes
|
||||
--- (default: false)
|
||||
--- @field include_anonymous boolean?
|
||||
|
||||
--- Returns the smallest named node at the given position
|
||||
@@ -512,15 +515,17 @@ end
|
||||
--- @class vim.treesitter.select.Opts
|
||||
--- @inlinedoc
|
||||
---
|
||||
--- Number of selections to make in the given direction (default 1)
|
||||
--- Expand or adjust the selection this many times.
|
||||
--- (default: 1)
|
||||
--- @field count integer?
|
||||
|
||||
--- Starts or adjusts a |Visual| selection at cursor, based on tree nodes.
|
||||
---@param direction 'parent'|'child'|'next'|'prev'|'extend_next'|'extend_prev' Direction to select
|
||||
--- towards
|
||||
--- Starts or adjusts a |Visual| selection at cursor, based on tree nodes. The `target` parameter
|
||||
--- decides the selection behavior.
|
||||
---
|
||||
---@param target 'parent'|'child'|'next'|'prev'|'extend_next'|'extend_prev' Decides the selection behavior.
|
||||
---@param opts vim.treesitter.select.Opts?
|
||||
function M.select(direction, opts)
|
||||
vim.validate('direction', direction, 'string')
|
||||
function M.select(target, opts)
|
||||
vim.validate('target', target, 'string')
|
||||
vim.validate('opts', opts, 'table', true)
|
||||
opts = opts or {}
|
||||
if opts.count then
|
||||
@@ -528,22 +533,20 @@ function M.select(direction, opts)
|
||||
end
|
||||
local count = opts.count or 1
|
||||
|
||||
if direction == 'parent' then
|
||||
if target == 'parent' then
|
||||
return M._select.select_parent(count)
|
||||
elseif direction == 'child' then
|
||||
elseif target == 'child' then
|
||||
return M._select.select_child(count)
|
||||
elseif direction == 'next' then
|
||||
elseif target == 'next' then
|
||||
return M._select.select_next(count)
|
||||
elseif direction == 'prev' then
|
||||
elseif target == 'prev' then
|
||||
return M._select.select_prev(count)
|
||||
elseif direction == 'extend_next' then
|
||||
elseif target == 'extend_next' then
|
||||
return M._select.select_grow_next(count)
|
||||
elseif direction == 'extend_prev' then
|
||||
elseif target == 'extend_prev' then
|
||||
return M._select.select_grow_prev(count)
|
||||
else
|
||||
vim.validate('direction', direction, function()
|
||||
return false, 'Invalid direction'
|
||||
end)
|
||||
error(('Invalid target: %s'):format(target))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user