From aa5717f00fd14430c80939a68d7107c26de6e554 Mon Sep 17 00:00:00 2001 From: Mohammad Reza Karimi Date: Tue, 20 Jan 2026 15:55:27 -0500 Subject: first commit --- plugin/14_commands.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 plugin/14_commands.lua (limited to 'plugin/14_commands.lua') 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", +}) -- cgit v1.2.3-71-gdd5e