Home

Awesome

This plugin is archived. I will move it features into my lua config directly.

You can check my lua config at https://github.com/LintaoAmons/CoolStuffes/tree/main/nvim/.config/nvim

A collection of intuitive, easily searchable,and ready-to-use commands.

Why this plugin?

Something like IDEA's Find Actions or Vscode's Show All Commands or Obsidian's Open Commands.

<p align="left"> <img src="https://github.com/LintaoAmons/easy-commands.nvim/assets/95092244/527c0f7b-9c5c-483b-9bed-11c9efdfea6c" width="49%"> <img src="https://github.com/LintaoAmons/easy-commands.nvim/assets/95092244/fcdb8643-3193-48b6-83f2-77016a4ed278" width="49%"> </p>

image

<details> <summary>READ MORE REASON</summary> </details>

New Commands Added: TerminalCdToBufferDir

Find more usecase: CommandUsecases

Change visible terminal's working directory to the buffer's directory

show

Install & Config

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"
}

Detailed config

{
  "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,
}

Commands

Keybindings

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

CONTRIBUTING

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

FIND MORE USER FRIENDLY PLUGINS MADE BY ME