rubik
rubik

Reputation: 9104

Add a command into vimrc

I'd like to copy something that I selected with VISUAL mode to X clipboard using xclip. How can I create a mapping in my vimrc that uses the selected text?

The command that I'd like to execute is the following:

xclip -selection c {selected text}

Upvotes: 1

Views: 375

Answers (1)

kev
kev

Reputation: 161964

Try this:

vnoremap <F2> :w !xclip -selection c<CR><ESC>

Upvotes: 3

Related Questions