https://www.slothparadise.com/copy-system-clipboard-vim/

How to Copy to System Clipboard from Vim

In this tutorial, I used Cygwin on Windows 10 and Bash on Windows 10 to copy text from vim to the system clipboard for pasting.

  1. Check if we have +clipboard on our version of vim
  2. If you’re using bash on Windows or Ubuntu, and vim does not have +clipboardsudo apt-get install vim-gnome -y
  3. +clipboard gets installed
  4. vim file
  5. Type: :%y+ to copy all lines
  6. Right click and paste, and you’ll see the lines you copied from vim

 

Check if we have +clipboard on our version of vim.

vim --version

Instead of -clipboard, we want +clipboard.

 

If you’re using bash or Ubuntu, and vim does not have +clipboard already:

sudo apt-get install vim-gnome -y

 

+clipboard gets installed.

vim --version

 

Open the file with vim and copy its contents to the clipboard.

vim file

Type:

:%y+

to yank all lines.

 

Now, you can right click and paste into a text editor.

I pasted the clipboard to an empty document in Sublime!



'Linux' 카테고리의 다른 글

vimrc 옵션  (0) 2019.05.05
리눅스 레포지토리 패키지 찾기 명령어  (0) 2019.05.05
vim 단축키 정리  (0) 2019.04.28
리눅스 소켓프로그래밍 설명  (0) 2019.01.26
git 관련 설정 및 명령어  (0) 2019.01.26

+ Recent posts