A Neovim plugin that repositions the cmdline as a centered floating window, powered by Neovim's native ui2 system.
Table of Contents
Requirements
- Neovim >= 0.12
cmdheight=0(better to have forui2)ui2must be enabled explicitly:require("vim._core.ui2").enable({})
Installation
The plugin is setup-less: it auto-initializes on UIEnter with sensible defaults. No setup() call is required.
There are three ways to configure it:
- Minimal: just install and set
cmdheight=0 vim.g: setvim.g.tiny_cmdlinebefore the plugin loads (nosetup()needed)setup(): explicit call, takes priority overvim.g
vim.pack (Neovim built-in, >= 0.12)
Minimal:
vim.o.cmdheight = 0 vim.pack.add({ "https://github.com/rachartier/tiny-cmdline.nvim" })
With vim.g:
vim.o.cmdheight = 0 vim.g.tiny_cmdline = { width = { value = "70%" }, } vim.pack.add({ "https://github.com/rachartier/tiny-cmdline.nvim" })
With setup():
vim.pack.add({ "https://github.com/rachartier/tiny-cmdline.nvim", config = function() vim.o.cmdheight = 0 require("tiny-cmdline").setup() end, })
lazy.nvim
Minimal:
{
"rachartier/tiny-cmdline.nvim",
init = function()
vim.o.cmdheight = 0
end,
}With vim.g:
{
"rachartier/tiny-cmdline.nvim",
init = function()
vim.o.cmdheight = 0
vim.g.tiny_cmdline = {
width = { value = "70%" },
}
end,
}With setup():
{
"rachartier/tiny-cmdline.nvim",
config = function()
vim.o.cmdheight = 0
require("tiny-cmdline").setup()
end,
}Configuration
Full default configurationrequire("tiny-cmdline").setup({ -- Cmdline window width width = { value = "60%", -- "N%" = fraction of editor columns, integer = absolute columns min = 40, -- minimum width in columns max = 80, -- maximum width in columns }, -- Window position ("N%" = fraction of available space, integer = absolute columns/rows) position = { x = "50%", -- horizontal: "0%" = left, "50%" = center, "100%" = right y = "50%", -- vertical: "0%" = top, "50%" = center, "100%" = bottom }, -- Border style for the floating window -- nil inherits vim.o.winborder at setup() time, falling back to "rounded" -- Set to "none" to disable the border border = nil, -- Horizontal offset of the completion menu anchor from the window's left inner edge -- Used to align blink.cmp / nvim-cmp menus with the cmdline window menu_col_offset = 3, -- Cmdline types rendered at the bottom of the screen instead of centered -- "/" and "?" (search) are kept native by default native_types = { "/", "?" }, -- Dynamic popup title (rendered on the floating border) -- Disabled by default; set enabled = true to opt in -- Has no effect when border = "none" or when the cmdline is rendered via native_types title = { enabled = false, pos = "center", -- "left" | "center" | "right" }, -- Optional callback invoked after every reposition on_reposition = nil, })
Highlight Groups
| Group | Default link | Description |
|---|---|---|
TinyCmdlineNormal |
MsgArea |
Background of the cmdline window |
TinyCmdlineBorder |
FloatBorder |
Border of the cmdline window |
TinyCmdlineTitle |
FloatTitle |
Title shown on the border |
Override them in your colorscheme or config:
vim.api.nvim_set_hl(0, "TinyCmdlineBorder", { fg = "#your_color" }) vim.api.nvim_set_hl(0, "TinyCmdlineNormal", { bg = "#your_color" })
How It Works
tiny-cmdline hooks into Neovim's internal vim._core.ui2 system, which manages the floating cmdline window introduced in Neovim 0.12. On every CmdlineEnter it repositions that window to the center of the editor, and on CmdlineLeave it restores the original position so that post-command messages still render correctly at the bottom.
Cmdline types listed in native_types (search by default) are pinned to the bottom at full width, preserving the native search experience.
The window position is also updated on VimResized and TabEnter to stay correctly centered after layout changes.
Integrations
tiny-cmdline is compatible with the most common completion plugins. The table below summarises compatibility details for each.
| Plugin | Menu repositions on open | Menu repositions on window resize | Extra config required |
|---|---|---|---|
| blink.cmp | ✔️ with adapter | ✔️ with adapter | ✔️ see below |
| nvim-cmp | ✔️ | ❌ (not yet supported) | ❌ |
| mini.cmdline | ✔️ | ❌ (not yet supported) | ❌ |
| Default (built-in) | ✔️ | ❌ (not yet supported) | ❌ |
blink.cmp
blink.cmp manages its own menu position independently. Use the built-in adapter so it follows the repositioned cmdline window:
require("tiny-cmdline").setup({ on_reposition = require("tiny-cmdline").adapters.blink, })
Troubleshooting
- Cmdline stays at the bottom: Ensure
vim.o.cmdheight = 0is set before the plugin initializes (useinitin lazy.nvim, or set it early in your config). - Completion menu misaligned: Tune
menu_col_offsetto match your border/padding. - Border doesn't match the rest of Neovim: Leave
border = nilto inheritvim.o.winborder. - Search feels different:
/and?are innative_typesby default and rendered at the bottom; remove them from that list to also center them.