Do you like the relative line numbers setting?

set relativenumber

I do, but sometimes I’d like to see the actual line numbers when going to a line in a stack trace for example.

Anyway, try

let g:show_relative_numbers = 1

function! ToggleRelativeLineNumber()
  if g:show_relative_numbers
    set number!
    set relativenumber!

  let g:show_relative_numbers = !g:show_relative_numbers

nnoremap ;l :call ToggleRelativeLineNumber()<CR>

Then you can just do:


to swap between relative and normal line numbers