I have this in my .vimrc
:
nnoremap <C-a> :set relativenumber!<cr>
This toggles the relative number feature only in the current window.
Is it possible to toggle it in all opened windows with one command?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityYes, using :h :windo
:
nnoremap <C-a> :windo set relativenumber!<CR>
<silent>
to your mapping, so that the:set
(or:windo
) Ex command doesn't appear in the command line when you use it. Note also that the<C-a>
keystroke is a pretty useful command (increment number, in your buffer, if you have one under the cursor of the current line), so think twice before shadowing with a mapping of your own. Cheers!