summaryrefslogtreecommitdiff
path: root/stowables-dotlocal/share/nvim/site/pack/manual/start/nvim-surround-v2.1.7/lua/nvim-surround/annotations.lua
blob: b8172c0151fa25da252eaff41c25d7b51e7e597e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--[====================================================================================================================[
                                                   Basic Definitions
--]====================================================================================================================]

---@alias text string[] A list of lines of text in the buffer
---@alias position integer[] A 1-indexed position in the buffer
---@alias delimiter string[] The text representation of a delimiter
---@alias delimiter_pair delimiter[] A pair of delimiters
---@alias add_func fun(char: string|nil): delimiter_pair|nil
---@alias find_func fun(char: string|nil): selection|nil
---@alias delete_func fun(char: string|nil): selections|nil
---@alias change_table { target: delete_func, replacement: add_func|nil }

---@class selection
---@field first_pos position
---@field last_pos position

---@class selections
---@field left selection|nil
---@field right selection|nil

--[====================================================================================================================[
                                                    Internal Options
--]====================================================================================================================]

-- TODO: Come up with a better name for `change_table`?
---@class surround
---@field add add_func
---@field find find_func
---@field delete delete_func
---@field change change_table

---@class options
---@field keymaps table<string, string>
---@field surrounds table<string, surround>
---@field aliases table<string, string|string[]>
---@field highlight { duration: integer }
---@field move_cursor false|"begin"|"end"
---@field indent_lines function

--[====================================================================================================================[
                                                 User-provided options
--]====================================================================================================================]

---@alias user_add false|string[]|string[][]|add_func
---@alias user_find false|string|find_func
---@alias user_delete false|string|delete_func
---@alias user_change false|{ target: user_delete, replacement: user_add|nil }

---@class user_surround
---@field add? user_add
---@field find? user_find
---@field delete? user_delete
---@field change? user_change

---@class user_options
---@field keymaps? table<string, false|string>
---@field surrounds? table<string, false|user_surround>
---@field aliases? table<string, false|string|string[]>
---@field highlight? { duration: false|integer }
---@field move_cursor? false|"begin"|"end"
---@field indent_lines? false|function