Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add non mouse-selectable line numbers to vim? [duplicate]

Tags:

vim

People also ask

How do you not copy line numbers in vim?

Make the vi/vim text editor show or hide line numbers Press ESC key. At the : prompt type the following command to run on line numbers: set number. To turn off line numbering, type the following command at the : prompt set nonumber.

How do I select a range of lines in Vim?

Press V to switch to VISUAL LINE mode and then go to line 1701 by typing: 1701G . Now your lines are selected, you can run a command on them. For example, to replace foo with bar type: :s/foo/bar/ .


Use the following:

:set mouse=a

to turn on xterm style mousing in all modes. This will allow you to do what you want. Keep in mind if the vim is remote via ssh, you'll need X11 forwarding turned on for the selection to make it to your local clipboard.


AFAIK, that is not possible.

The only thing I can add at the moment is that you'd be better off with

:set invnumber

It will inverse the current condition, so you can map it to a key, and toggle it. That way you don't have to remember two commands.


I agree with the first answer. If you use gvim, you can experiment with using set mouse=n and set mouse=a, which should change the line number selecting behavior.


When I want to select text into a terminal, I remove line numbers.

:set nonu

When I finished

:set nu