Repository navigation
Expand file tree
/
Copy patheditor.lua
More file actions
194 lines (181 loc) · 5.57 KB
/
Copy patheditor.lua
File metadata and controls
194 lines (181 loc) · 5.57 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
local editor = {}
editor["sindrets/diffview.nvim"] = {
lazy = true,
cmd = { "DiffviewOpen", "DiffviewClose" },
config = require("modules.configs.editor.diffview"),
dependencies = { "nvim-tree/nvim-web-devicons" },
}
editor["nvim-mini/mini.align"] = {
lazy = true,
event = { "CursorHold", "CursorHoldI" },
-- Also load on the first alignment key: before the first idle, `gea` was a native `ge` motion
-- followed by `a` (append). Keep in sync with the mappings in configs/editor/align.lua.
keys = {
{ "gea", mode = { "n", "x" }, desc = "edit: Align" },
{ "geA", mode = { "n", "x" }, desc = "edit: Align with preview" },
},
config = require("modules.configs.editor.align"),
}
editor["nvim-mini/mini.cursorword"] = {
lazy = true,
event = { "BufReadPost", "BufAdd", "BufNewFile" },
config = require("modules.configs.editor.cursorword"),
}
editor["nvim-mini/mini.surround"] = {
lazy = true,
event = { "BufReadPost", "BufNewFile" },
version = false,
config = require("modules.configs.editor.surround"),
}
editor["folke/flash.nvim"] = {
lazy = true,
event = "VeryLazy",
config = require("modules.configs.editor.flash"),
}
editor["olimorris/persisted.nvim"] = {
lazy = true,
cmd = "Persisted",
config = require("modules.configs.editor.persisted"),
}
editor["lambdalisue/vim-suda"] = {
lazy = true,
cmd = { "SudaRead", "SudaWrite" },
init = require("modules.configs.editor.suda"),
}
editor["brenoprata10/nvim-highlight-colors"] = {
lazy = true,
event = "VeryLazy",
config = require("modules.configs.editor.highlight-colors"),
}
editor["MagicDuck/grug-far.nvim"] = {
lazy = true,
cmd = "GrugFar",
config = require("modules.configs.editor.grug-far"),
}
----------------------------------------------------------------------
-- :treesitter related plugins --
----------------------------------------------------------------------
editor["jmbuhr/otter.nvim"] = {
lazy = true,
ft = { "toml", "markdown", "quarto", "org", "norg" },
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
local filetypes = { "toml", "markdown", "quarto", "org", "norg" }
local group = vim.api.nvim_create_augroup("EmbedToml", {})
local function activate(buf)
vim.api.nvim_buf_call(buf, function()
require("otter").activate()
end)
end
-- Embedded languages otter supports, as Treesitter currently injects them
local function embedded_languages(buf)
local parser = vim.treesitter.get_parser(buf, nil, { error = false })
if not parser then
return {}
end
parser:parse(true)
local languages = {}
for lang in pairs(parser:children()) do
if lang ~= parser:lang() and _G.OtterConfig.extensions[lang] then
languages[#languages + 1] = lang
end
end
table.sort(languages)
return languages
end
vim.api.nvim_create_autocmd("FileType", {
pattern = filetypes,
group = group,
callback = function(args)
activate(args.buf)
end,
})
-- otter only covers the languages present when it activated; re-activate when an edit adds or
-- changes them. activate() reuses the buffer's otter-ls client but never deletes the otter
-- buffer of a language that is gone, so drop those first.
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
group = group,
callback = function(args)
if not vim.tbl_contains(filetypes, vim.bo[args.buf].filetype) then
return
end
local raft = require("otter.keeper").rafts[args.buf]
local active = raft and vim.deepcopy(raft.languages) or {}
table.sort(active)
local languages = embedded_languages(args.buf)
if vim.deep_equal(active, languages) then
return
end
for _, lang in ipairs(active) do
local otter_buf = raft.buffers[lang]
if not vim.tbl_contains(languages, lang) and otter_buf and vim.api.nvim_buf_is_valid(otter_buf) then
vim.api.nvim_buf_delete(otter_buf, { force = true })
end
end
activate(args.buf)
end,
})
end,
}
editor["nemanjamalesija/smart-paste.nvim"] = {
lazy = true,
-- TextYankPost loads it at the first yank or delete, before a paste can need it. Not lazy `keys`:
-- replaying `p` would drop the count and register of the first paste.
event = { "CursorHold", "CursorHoldI", "TextYankPost" },
config = require("modules.configs.editor.smart-paste"),
}
editor["charliie-dev/hmts.nvim"] = {
lazy = true,
branch = "main",
ft = "nix",
dependencies = { "nvim-treesitter/nvim-treesitter" },
}
editor["bezhermoso/tree-sitter-ghostty"] = {
lazy = true,
ft = "ghostty",
build = "make nvim_install",
}
editor["danymat/neogen"] = {
lazy = true,
cmd = "Neogen",
config = require("modules.configs.editor.neogen"),
}
editor["nvim-treesitter/nvim-treesitter"] = {
-- lazy = true,
lazy = false,
-- event = "BufReadPre",
branch = "main",
build = ":TSUpdate",
config = require("modules.configs.editor.treesitter"),
dependencies = {
{
"Hdoc1509/gh-actions.nvim",
config = function()
require("gh-actions.tree-sitter").setup()
end,
},
},
}
editor["nvim-mini/mini.ai"] = {
lazy = false,
version = "*",
config = require("modules.configs.editor.ai_textobj"),
}
editor["nvim-treesitter/nvim-treesitter-textobjects"] = {
lazy = false,
branch = "main",
config = require("modules.configs.editor.ts-textobjects"),
}
editor["windwp/nvim-ts-autotag"] = {
lazy = false,
config = require("modules.configs.editor.ts-autotag"),
}
editor["HiPhish/rainbow-delimiters.nvim"] = {
lazy = false,
config = require("modules.configs.editor.rainbow_delims"),
}
editor["nvim-treesitter/nvim-treesitter-context"] = {
lazy = false,
config = require("modules.configs.editor.ts-context"),
}
return editor