vim + COPY + mac over SSH

后端 未结 12 1198
悲哀的现实
悲哀的现实 2021-01-30 01:12

I access a sever over ssh on which I run vim for editing files. When I try to yank text from vim into an editor locally on my mac (lion) either with y OR \"+y it does not work.

12条回答
  •  后悔当初
    2021-01-30 01:32

    On MacOS, when SSH from machine A to machine B and using vim in machine B, I add this to my .vimrc in machine B:

    nmap yr :call system("ssh $machineA_IP pbcopy", @*)
    

    That way, in normal mode, if you copy something to * register, then type yr, the content of * register in vim@machine_B is copied to machine A's local clipboard, assuming you have setup Vim correctly with +clipboard and * register

提交回复
热议问题