Does Vim copy line numbers?

I am using vim through and SSH connection. I have a set of numbers installed, and when I try to copy sections of my code with the mouse ... it also captures numbers. Is there a good way to copy text that doesn't capture numbers with it. (I know that in this case vim I can use Y, but I need a way to copy other instances and programs).

Here is an example of what I'm talking about.

1 function foo ( home, ip, hash, regex ) 2 { 3 return false; 4 } 

Thank you very much for the advice.

+4
source share
3 answers
 :set nonumber 

copy what you want

 :set number 

: reference number

+4
source

Toggle the 'number' parameter with !

 :set nu! 

Run it once to disable 'number' . Run the command again to enable the setting.

I use the following mapping in my ~/.vimrc :

 nnoremap <leader>tn :set nu! nu?<cr> 

It will switch the setting and then give the current value of 'number'

For more help see:

 :h 'nu' :h :set-! 
+8
source
  • If you copy and paste into Vim, there is no good reason not to use the correct commands: y for "yank" (copy, see :help y ) and p in "put" (paste, see :help p ).

  • If you copy in a remote Vim to paste into another local application, you will need:

     :set nonumber do your thing :set number 

    You might want to check if you can use "X11 Forwarding" as it allows sharing clipboards.

  • If you copy to a local application to insert a remote Vim, you will need:

     copy in local app go to Vim :set paste Ctrl+v or Cmd+v :set nopaste 

    See :help pastetoggle for a convenient display.

+5
source

Source: https://habr.com/ru/post/1447340/


All Articles