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

How do I save screen space by merging the sign column into the line number column in Neovim?

Answer

:set signcolumn=number

Explanation

Setting signcolumn=number tells Neovim to display signs (diagnostics, git hunks, breakpoints) inside the line number column instead of adding a dedicated extra column beside it. This reclaims a column of horizontal space without losing sign visibility.

How it works

  • signcolumn=no — never show signs
  • signcolumn=yes — always reserve a fixed column for signs (default in many configs)
  • signcolumn=auto — show column only when signs are present (causes layout shift)
  • signcolumn=number — signs replace the line number on the lines where they appear; all other lines still show their number normally

When a sign is present on a line, the line number is replaced by the sign icon. When no sign is present, the full line number is shown as normal.

Example

 Before (signcolumn=yes):       After (signcolumn=number):
  1 |  fn main() {              1  fn main() {
  2 | │ let x = 1;              E  let x = 1;    ← sign replaces number
  3 |  let y = 2;               3  let y = 2;

Tips

  • This is a Neovim-only option; Vim does not support signcolumn=number
  • Works well with plugins like nvim-lspconfig, gitsigns.nvim, and nvim-dap that use signs frequently
  • If you use relative line numbers (set relativenumber), the relative number is replaced on signed lines instead
  • Combine with set number or set relativenumber for the best experience

Next

How do I encode and decode JSON data in Vimscript for configuration and plugin development?