命令行状态下
首先将Cygwin设为左键选择后自动复制,右键粘贴;然后就可以把Cygwin当成一个普通的Windows应用了;
vi窗口中
根据http://vim.wikia.com/wiki/Using_the_Windows_clipboard_in_Cygwin_Vim的介绍,将下面的代码拷贝到cygwin的$HOME/.vimrc中,就可以用\y拷贝,\p粘贴了。
function! Putclip(type, ...) range
let sel_save = &selection
let &selection = "inclusive"
let reg_save = @@
if a:type == 'n'
silent exe a:firstline . "," . a:lastline . "y"
elseif a:type == 'c'
silent exe a:1 . "," . a:2 . "y"
else
silent exe "normal! <" . a:type . "
>y"
endif
"call system('putclip', @@)
"As of Cygwin 1.7.13, the /dev/clipboard device was added to provide
"access to the native Windows clipboard. It provides the added benefit
"of supporting utf-8 characters which putclip currently does not. Based
"on a tip from John Beckett, use the following:
call writefile(split(@@,"\n"), '/dev/clipboard')
let &selection = sel_save
let @@ = reg_save
endfunction
vnoremap