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
42 cursor here
@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