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

How do I customize the status line at the bottom of the screen?

Answer

:set statusline=%f\ %m%r%=%l/%L

Explanation

The statusline option controls what information is shown in the status bar at the bottom of each window. You can display filename, position, file type, and more.

How it works

  • %f shows the filename
  • %m shows the modified flag ([+])
  • %r shows the readonly flag
  • %= separates left and right sections
  • %l/%L shows current line / total lines

Example

set statusline=%f\ %m%r\ %y%=%l/%L\ (%p%%)

Shows: src/main.go [+] [go] 42/500 (8%)

Tips

  • :set laststatus=2 always shows the status line
  • %y shows the file type
  • %p%% shows the percentage through the file
  • %{FunctionName()} calls a Vimscript function for dynamic content
  • Plugins like vim-airline and lightline provide advanced status lines

Next

How do you yank a single word into a named register?