This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/relative-number-with-ben-orenstein
Before āset relativenumberā put āset numberā and instead zero you will have current line number.
set number
set relativenumber
1
2
42 cursor here
2
1
@rbilych, this is a great tip. This is one of my favorite (relatively recent) Vim features, as it gets you the best of both worlds.
I use something slightly different. With configuration like:
set relativenumber
set number
autocmd InsertEnter * :set number norelativenumber
autocmd InsertLeave * :set relativenumber
The relative number is used in visual mode, but once entering the insert mode, it becomes the absolute number.
Hope that helps someone!
Wow, that is really cool. Do you notice any sluggishness when you enter and leave normal mode? I am going to give this a try in my dotfiles.
That is super cool. Extremely useful. Awesome solution to combine number and relative number together.
sluggishness? No, I havenāt noticed anything particularly different than before using this set of configā¦ But Iāll keep an eye on it! Thanks!
Love this episode! I have a question, plus and minus donāt work for me. why is that?
Love it! Thanksā¦
Iāve found that relativenumber is very slow in large ruby files. I profiled my entire zshrc without any plugins and thatās what was causing it. Iāve since switched to using easy-motion