diff options
Diffstat (limited to 'plugin/14_commands.lua')
| -rw-r--r-- | plugin/14_commands.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plugin/14_commands.lua b/plugin/14_commands.lua new file mode 100644 index 0000000..c1f248a --- /dev/null +++ b/plugin/14_commands.lua @@ -0,0 +1,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", +}) |
