On Sun, Apr 07, 2019 at 10:40:44PM +1000, Erik Christiansen wrote:
> On 07.04.19 13:51, meine wrote:
> > I found a site where a vim plugin was used for relative line numbering
> > and I want to give it a try. relative line numbers make it easier to
> > navigate in normal mode by just using `3j' instead of `256G'. the less
> > keystrokes the better!
>
> No experience with plugins, but just this in .vimrc does it for me:
>
> noremap <F1> :call Rnu_toggle()<CR>        " Toggle relative line numbering.
> "
> " Toggle relative line numbering.
> function! Rnu_toggle()
>     if &rnu == 1
>      set nornu
>   else
>      set rnu
>   endif
> endfun

This function works like a charm!

I also found andother solution in `Mastering Vim Quickly',  p. 118 to
have relative numbers in Normal mode and absolute numbers in Insert.

Add to your .vimrc

    set number
    set relativenumber

    augroup toggle_relative_number
    autocmd InsertEnter * :setlocal norelativenumber
    autocmd InsertLeave * :setlocal relativenumber

This way you only use functions that are already aboard in default
Vim...

//meine

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to