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
|
local command = vim.api.nvim_create_user_command
local complete_plugin_names = function(arg, _, _)
local inactive_plugs_starting_with_arg = vim.tbl_filter(
function(p) return p.active == false and vim.startswith(p.spec.name, arg) end,
vim.pack.get()
)
return vim.tbl_map(function(p) return p.spec.name end, inactive_plugs_starting_with_arg)
end
command(
"DiffOrig",
[[
vert new
setlocal buftype=nofile
read ++edit #
0d_
diffthis
wincmd p
diffthis
]],
{ desc = "DiffOrig (see `:h DiffOrig`)" }
)
command("Pup", function(_) vim.pack.update() end, { desc = "Update packages" })
command(
"Pdel",
function(opts) vim.pack.del(vim.split(opts.args, " ")) end,
{ nargs = "*", complete = complete_plugin_names }
)
command(
"LspLog",
function() vim.cmd.tabnew(vim.lsp.log.get_filename()) end,
{ desc = "Opens the Nvim LSP client log." }
)
command("Align", function(_)
-- TODO
end, {
nargs = "*",
range = true,
desc = "align selection with respect to a substring",
})
|