---
title: "Vim and the System Clipboard"
url: "https://courses.osherove.com/courses/vim-hates-you/vim-and-the-system-clipboard.md"
canonical: "https://courses.osherove.com/courses/vim-hates-you/vim-and-the-system-clipboard/"
tags: []
author: "Roy Osherove"
description: "Lesson 24 of 26 in Vim Hates You (Go Faster), 4:57. Free video by Roy Osherove."
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Vim and the System Clipboard

1. [Courses](https://courses.osherove.com/#courses)
2. [Vim Hates You](https://courses.osherove.com/courses/vim-hates-you/)
3. Go Faster

Lesson 24 of 26

Duration: 4:57 [Watch on YouTube](https://www.youtube.com/watch?v=wyf3-dB_r94)

## In this lesson

Roy checks whether a Vim build supports the system clipboard by looking for the word clipboard in Vim's version output, where grep helps, and a minus sign means it is not supported, as with the built-in Vim on most Macs. He installs MacVim with brew, overriding the system Vim, after which clipboard shows a plus. He then pastes text copied from Hacker News through the plus register (double quote, plus, p) and yanks a line into the system clipboard with double quote, plus, y.

## Transcript

675 words

[\[00:07\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=7s) One of the most annoying things about Vim to me is how to use the system clipboard. Now, technically, in each system, you have to have a specific Vim that's integrated with the current system to be able to work with the system clipboard. in in on a Mac you can check if your Vim supports the system clipboard by default by basically saying Vim and then version and then looking for the word clipboard in the version. So if you see the minus sign next to a clip next to clipboard or external clipboard, it means that the current Vim that you have on your system does not support it.

[\[00:46\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=46s) And by default on most Macs the the built-in Vim does not support clipboard which means you cannot copy paste using special shortcuts into the console or into Vim. However, you can still use commandV and and command C to copy and paste from the system clipboard. It's just not the let's say the Vim way. And you're going to get a little bit of a weird behavior sometimes because whenever you paste into Vim using shiftV,

[\[01:17\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=77s) It's going to take longer and Vim is going to try to basically interpret every character as you're pasting it. The the the one thing that we can do is we can install a different Vim version. And the way that you can install this is basically on Mac, I highly recommend using either downloading a zip file from vim.org or for Mac or looking for a MacVim download or just use the brew

[\[01:47\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=107s) To install basically brew install MacVim and you can say over override system Vim which basically will install Vim and override it so that when you try to open vim you're going to get this. If I'm opening a new tab here and I say which vim sorry

[\[02:19\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=139s) Which vim I should be getting this this path right here. If I didn't install it yet here, and I say which Vim, this is the default Vim. So, if I do a, Vim version here, I can see that the clipboard is minus. And by the way, if I don't grep, this is what the full thing looks like.

[\[02:51\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=171s) That's why grep is important just to see what you care about. And if I do a Vim version here, you can see that the clipboard, the regular clipboard is a plus, an external clipboard is minus because it's not a system that uses the X11 view. So it doesn't need that kind of integration. So that's what you should be looking out for. But once you have that and you turn on Vim and let's say that we are that we have a bunch of stuff in the system clipboard.

[\[03:24\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=204s) So let me just copy a piece of text from let's say Hacker News. Okay. So I'm going to say just copy this how cars get named command C and go back. And if I want to paste this there there are there's basically a special register for the system clipboard and that register is the plus. So you access it just like any other register. You say

[\[03:55\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=235s) The name of the register but before that you say double quotes and then you say paste or yank into that. So, double quotes plus paste and I get what I had in the system clipboard. And this is usually a much faster, way to to work in terms of the way Vim interprets the paste. And if I wanted to, I can select the whole thing or I can write a whole

[\[04:26\]](https://www.youtube.com/watch?v=wyf3-dB_r94&t=266s) Line here. Escape, shift V to select the whole line. and I want to put it in the system clipboard. I'm going to say double quotes plus yank. And now if I go into let's say and I try to paste the blind text, I get this. So that's how you work with the system clipboard and you make sure that your Vim is fully aligned to actually allow this kind of workflow.

[Previous lesson Understanding Vim Registers](https://courses.osherove.com/courses/vim-hates-you/understanding-vim-registers/) [Next lesson Abbreviations in Vim](https://courses.osherove.com/courses/vim-hates-you/abbreviations-in-vim/)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
