Can vim use the system clipboard(s) by default?

前端 未结 3 392
臣服心动
臣服心动 2020-12-12 11:53

I am running into several problems because vim\'s tabs are, for the lack of a better term, god awful. I want to start using multiple Gnome tabs instead, each with a differen

相关标签:
3条回答
  • 2020-12-12 12:22

    I found a solution to my problem here. If you add the following to your .vimrc file

    set clipboard=unnamedplus
    

    Everything you yank in vim will go to the unnamed register, and vice versa.

    0 讨论(0)
  • 2020-12-12 12:26

    Possible workaround:

    "Ctrl-c to copy in + buffer from visual mode
    vmap <C-c> "+y
    
    "Ctrl-p to paste from the + register in cmd mode
    map <C-v> "+p
    
    "Ctrl-p to paste from the + register while editing
    imap <C-v> <esc><C-v>
    
    0 讨论(0)
  • 2020-12-12 12:29

    By the way, if you just want to use the terminal's native copy/paste handling, suggest setting

    :se mouse-=a
    

    and just doubleclick/rightclick as you're used to in your terminal.

    That said, I love vim split windows and the fact that you can use the mouse to drag window dividers/position the cursor (heresy!). That requires mouse+=a... (and will work over ssh/screen sessions as well!).

    I'm used to doing things like this instead:

    :%retab|%>|%y+|u
    

    and have commands like that on recall. Note that the "+ register is coded in the command line. To copy the last visual selection to the clipboard,

    :*y+
    

    or

    :'<,`>y+ 
    
    0 讨论(0)
提交回复
热议问题