Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ex-command-palette.nvim

A small command palette for Neovim built on snacks.nvim.

It makes Ex commands easier to discover by showing human-readable descriptions next to them.

:ascii                 print ascii value of character under the cursor
:bdelete               remove a buffer from the buffer list
:checkhealth           run healthchecks
:colorscheme           load a specific color scheme
:messages              view previously displayed messages
:registers             display the contents of registers
:set                    show or set options
:undolist               list leaves of the undo tree

How it works

For built-in Ex commands, descriptions are read from Neovim's own:

$VIMRUNTIME/doc/index.txt

For plugin/user commands, the plugin uses nvim_get_commands() and buffer-local nvim_buf_get_commands() metadata.

If a user command has no desc, the plugin tries to derive a useful one-line description from its definition. As a final fallback it shows a shortened version of the command definition instead of a generic User command label.

When you select a command:

  • commands with nargs = 0 execute immediately;
  • commands accepting arguments prefill the command line, e.g. :colorscheme , leaving you to type only the argument;
  • interactive built-ins such as :append, :change, and :insert are prefixed instead of executed immediately.

Requirements

Installation

lazy.nvim

{
  "warpspin/ex-command-palette.nvim",
  dependencies = {
    "folke/snacks.nvim",
  },
  opts = {},
  keys = {
    {
      "<leader>g:",
      function()
        require("ex-command-palette").open()
      end,
      desc = "Go to Command",
    },
  },
}

Command

The plugin also registers:

:ExCommandPalette

No keymap is installed automatically.

Configuration

require("ex-command-palette").setup({
  title = "Commands",

  -- Override whether specific zero-argument commands execute immediately.
  -- false means: put the command onto the ':' command line instead.
  direct = {
    append = false,
    change = false,
    insert = false,
  },
})

You can add your own exceptions:

opts = {
  direct = {
    qall = false,
    restart = false,
  },
}

Design

The plugin deliberately does not maintain its own database of Ex commands. Built-in descriptions come from the Neovim version you are actually running, so the palette follows your installed runtime documentation.

Likewise, user/plugin commands are inspected at picker-open time so commands loaded lazily by plugins appear automatically.

License

0BSD

About

Neovim Plugin to show :Ex commands similar to Sublime Edits command palette

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages