Telescope extension to use command line in a floating window, rather than in bottom-left corner. Allows using fuzzy search to filter neovim commands and command history simultaneously.
- Command history by default.
Allows picking any previous command quickly. - Autocompletion
Allows using TAB key to fix spelling mistakes or complete command arguments using selected row. It determines next completion level by typing Space after the command.- 💡 Use
:vsplit
or:tabnew
and press<Space>
to see folders and filenames. - 💡 Type
DiffviewOpen
and press<Space>
to show git branch names.
- 💡 Use
- Fuzzy search (Thanks to Kacper Dębowski)
Allows filtering commands and command history simultaneously using user's input.- 💡 Type
lsprest
and use<Tab>
to expandLspRestart
- 💡 Typing
dvo
can filterDiffviewOpen
command. - 💡 Typing
gipure
can filter a previously executedGit pull --rebase
command.
- 💡 Type
- overseer.nvim integration for shell commands (
:!...
) - Support visual mode (PENDING)
Warning
Make sure to load the cmdline
extension after telescope, otherwise
Telescope cmdline
command won't be available.
Using Packer
use { 'jonarrien/telescope-cmdline.nvim' }
require("telescope").setup({})
require("telescope").load_extension('cmdline')
Using Lazy
Install package as telescope dependency
{
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
'nvim-lua/plenary.nvim',
'jonarrien/telescope-cmdline.nvim',
},
keys = {
{ 'Q', '<cmd>Telescope cmdline<cr>', desc = 'Cmdline' }
{ '<leader><leader>', '<cmd>Telescope cmdline<cr>', desc = 'Cmdline' }
},
opts = {
...
extensions = {
cmdline = {
... plugin settings ...
},
}
...
},
config = function(_, opts)
require("telescope").setup(opts)
require("telescope").load_extension('cmdline')
end,
}
You can customise cmdline settings in telescope configuration.
require("telescope").setup({
-- ...
extensions = {
cmdline = {
-- Adjust telescope picker size and layout
picker = {
layout_config = {
width = 120,
height = 25,
}
},
-- Adjust your mappings
mappings = {
complete = '<Tab>',
run_selection = '<C-CR>',
run_input = '<CR>',
},
-- Triggers any shell command using overseer.nvim (`:!`)
overseer = {
enabled = true,
},
},
}
-- ...
})
Default configuration can be found in lua/cmdline/config.lua file.
Caution
Neovim's built-in cmdline is triggered with :
and overriding this
mapping can have a severe impact in your setup. Therefore it is completely
discouraged.
Tip
The recommended mapping is Q
, normally used for :Ex
mode. It's
out of use in modern setups and is easily reachable as :
.
Alternatively, you could use double leader. Please, use the one that
suits best for you:
vim.api.nvim_set_keymap('n', 'Q', ':Telescope cmdline<CR>', { noremap = true, desc = "Cmdline" })
vim.api.nvim_set_keymap('n', '<leader><leader>', ':Telescope cmdline<CR>', { noremap = true, desc = "Cmdline" })
Picker mappings
Key | Descrition |
---|---|
<CR> |
Triggers the selected command in telescope results |
<C-CR> |
Triggers user input from prompt, ignoring selected result. |
<TAB> |
Expand selected row into prompt for editing |
- Only the first error message of several may be displayed, because the Neovim Lua API
does not return multiple errors. For example, running
q
orquit
from the standard command line when there are unsaved changes returns multiple errors, the second and subsequent errors tell which buffers have unsaved changes, but the first error, the only one available totelescope-cmdline.nvim
, just says "No write since last change".
Caution
This is an alpha version done in relative short time. May need further improvements or customizations, but it's working pretty well for me and thought sharing with community.
Feel free to create an issue/PR if you want to see anything else implemented, but please read CONTRIBUTING.md before opening a PR.
We enjoy this awesome plugin thanks to these wonderful people:
- Everyone who contributes in Neovim, this is getting better every day!
- Neovim team for adding lua, it really rocks!
- Telescope for facilitating extension creation 💪