vimtricks.wiki Concise Vim tricks, one at a time.

How do I hide the command line area in Neovim to gain an extra line of screen space?

Answer

:set cmdheight=0

Explanation

Setting cmdheight=0 in Neovim 0.8 and later hides the command line bar at the bottom of the screen when it is not actively in use. This reclaims one line for your editing area. The command line still appears automatically whenever you press :, /, ?, or when a message or prompt needs to be shown — then disappears again when done.

This option is Neovim-only (0.8+). In Vim, cmdheight cannot be set below 1.

How it works

  • cmdheight controls how many lines are reserved for the command line at the bottom of the screen
  • The default is 1 (always visible)
  • Setting it to 0 tells Neovim to hide it when idle — the bar reappears on demand and fades away after the interaction completes
  • Messages that would previously appear in the cmdline are briefly shown and auto-dismissed

Example

Add to your init.vim:

set cmdheight=0

Or in init.lua:

vim.opt.cmdheight = 0

With this setting active, your editing area gains one full line at the bottom whenever you are in normal or insert mode.

Tips

  • Combine with :set laststatus=3 for a minimal UI: a single global status line and no persistent cmdline bar
  • If messages vanish before you can read them, use :messages (or :mes) to review the full message log
  • Some plugins may not behave perfectly with cmdheight=0; check :checkhealth if something looks wrong
  • To revert to the default: :set cmdheight=1

Next

How do I get just the filename without its path or extension to use in a command?