Something like IDEA
's Find Actions
or Vscode
's Show All Commands
or Obsidian
's Open Commands
.
Find more usecase: CommandUsecases
Change visible terminal's working directory to the buffer's directory
using your favorate plugin manager, for example lazy.nvim
{
"LintaoAmons/easy-commands.nvim",
event = "VeryLazy",
-- use tag option to stay stable. This plugin is continues updating and adding more commands into it, pin to a tag should keep you stay where you are comfortable with.
-- tag = "v0.8.0"
}
@type EasyCommand.Command[]
{
"LintaoAmons/easy-commands.nvim",
event = "VeryLazy",
config = function()
require("easy-commands").setup({
disabledCommands = { "CopyFilename" }, -- You can disable the commands you don't want
aliases = { -- You can have a alias to a specific command
{ from = "GitListCommits", to = "GitLog"},
},
-- It always welcome to send me back your good commands and usecases
---@type EasyCommand.Command[]
myCommands = {
-- You can add your own commands
{
name = "MyCommand",
callback = 'lua vim.print("easy command user command")',
description = "A demo command definition",
},
-- You can overwrite the current implementation
{
name = "EasyCommand",
callback = 'lua vim.print("Overwrite easy-command builtin command")',
description = "The default implementation is overwrited",
},
-- You can use the utils provided by the plugin to build your own command
{
name = "JqQuery",
callback = function()
local sys = require("easy-commands.impl.util.base.sys")
local editor = require("easy-commands.impl.util.editor")
vim.ui.input(
{ prompt = 'Query pattern, e.g. `.[] | .["@message"].message`' },
function(pattern)
local absPath = editor.buf.read.get_buf_abs_path()
local stdout, _, stderr = sys.run_sync({ "jq", pattern, absPath }, ".")
local result = stdout or stderr
editor.split_and_write(result, { vertical = true })
end
)
end,
description = "use `jq` to query current json file",
},
},
})
end,
}
InspectCommand
to check all the commands that provided by easy-commands.FindCommands
(Provided by easy-commands) or Telescope commands
to find the commands you need.This plugin didn't provide any default keybindings, you can just add keybindings in any way you like.
Here's a ref of my way: https://github.com/LintaoAmons/CoolStuffes/blob/main/lazyvim/.config/nvim/lua/config/keymaps.lua
You are very welcome to create a PR to share your personal useful command back
Don't hesitate to ask me anything about the codebase if you want to contribute.
You can contact with me by drop me an email or telegram