Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does tmux support relative line-numbers?

Background.

I am a frequent vim-user, I just love the way you can navigate the buffers without ever having to reach for the mouse. I'm especially fond of the relative line numbers that let's me jump to specific lines with perfect accurecy, it just makes navigating that much faster. I also use tmux quite a bit since I often have a lot of stuff going on in my terminal.

The thing that bugs me the most though is when I use tmux copy-mode, it just takes forever to navigate to the line(s) you want to copy if you are using the arrow-keys, ctrl+p or k.

Searching for a unique keyword in the buffer is also not ideal but it might be faster if you already know what to search for. A lot of the time you make a search only to discover that the keyword you searched wasn't so unique after all and you didn't end up on the line you wished for anyway.

My question is this:

Does tmux support relative line-numbers?

..or line-numbers at all for that matter?

I can't find any information about this on the web. Nobody seems to be mentioning anything about this anywhere. Is there a better way?

Any other tips for ultra-speedy navigation in tmux copy-mode using the keyboard would also be very much appreciated.

like image 609
Master Wo Avatar asked Sep 25 '15 15:09

Master Wo


People also ask

How to enable relative line numbers in Vim?

Relative line numbers The current line is marked 0, the ones above and below it are marked 1, and so on. " turn relative line numbers on :set relativenumber :set rnu " turn relative line numbers off :set norelativenumber :set nornu " toggle relative line numbers :set relativenumber! :set rnu!

How to toggle relative number Vim?

To toggle the relative line numbering, use the :set relativenumber! or :set rnu! command: :set number!

Why use relative numbers in Vim?

The relative line numbers setting allows you to jump exactly where you want without having to do a mental addition or subtraction. The strategy is to look at the line number column, jump to the line you want to edit using a command like 10k, jump to the part of the line you want to change, and perform the edit.


2 Answers

tmux has a linenumber system in copy mode. however the first line is very bottom line.

In copy mode you can press : to go to line but there is no option to show linenumber. You can use some vim motions (key-mode was set as vi) in copy-mode, e.g. j k 20j 20k f F t T gg G 20G H L M ^ $ / ? ctrl-u ctrl-d w b ....

I think for copy a block of text, it is enough.. If you think you still cannot "ultra-speedy navigation", make a scenario, let's see how could we copy faster.

check man-page of tmux for details.

like image 74
Kent Avatar answered Sep 18 '22 15:09

Kent


I found this tip. It will take you to your line with less keystrokes.

# super fast way to reach copy-mode and search upwards
bind-key / copy-mode \; send-key ?
like image 34
Bjarte Brandt Avatar answered Sep 17 '22 15:09

Bjarte Brandt