Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I select text from command-line vim and copy it to the clipboard, it includes line numbers (from set relativenumber). Gvim is smart about selection and does not copy the line numbers. However, if I do set mouse="" in gvim, it makes it behave like command-line vim (line numbers are copied).

I don't want to enable the mouse in gvim because I don't like the cursor moving when I click. Is there any way to disable the mouse in gvim without making copying to the clipboard grab line numbers?

share|improve this question
    
Your terminal emulator might let you do block selection, that could be a workaround. –  Eroen Apr 19 '12 at 22:26
    
Wow. I never realized that works. It looks like ctrl-dragging does block selection. –  amcnabb Apr 19 '12 at 23:00
add comment

2 Answers

Yes. Use Vim as it's supposed to be used: with the keyboard.

Visual selection:

  • v character-wise

  • V line-wise

  • See :help visual-mode

Copying:

  • y places selected text in the default register

  • "*y places selected text in the * register (the GUI clipboard when available)

  • See :help registers, :help yank

Pasting:

  • p puts the content of the default register after the cursor

  • "*p puts the content of the * register after the cursor

  • See :help put

You won't paste line numbers if you use Vim correctly.

share|improve this answer
add comment

So your problem is basically that you copy the line numbers? Why don't you just add a mapping to toggle your line numbers?

Something like this for example:

map <Leader>nn :set relativenumber!<CR>

Then you wouldn't need to copy the line numbers in the first place...

share|improve this answer
    
Right now I have to toggle paste mode before I paste, and this would mean I would have to toggle "copy" mode, too. It's better than nothing, but it would be ideal if there weren't a manual step. –  amcnabb Apr 19 '12 at 22:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.