I'm using vim in terminal on OSX with a blank .vimrc file. I try to paste the following from my clipboard:
#!/bin/bash
set -e
set -o pipefail
npm run precommit
using
:set paste
but in vim, what's pasted (using cmd-v) is
et -e
set -o pipefail
npm run precommit
Anybody know what's wrong?
That makes the default paste buffer map to X's clipboard. So, if I mark a bit of text in a terminal, I can simply press p to paste it in vim. Similarly, I can yank things in vim (e.g. YY to yank the current line into the buffer) and middle click in any window to paste it.
When using Vim under Windows, the clipboard can be accessed with the following: In step 4, press Shift+Delete to cut or Ctrl+Insert to copy. In step 6, press Shift+Insert to paste.
You have to enter into insert mode before you can edit the file, you can do this by pressing the i key.
If you're using vim
on OSX, you can add the following to your .vimrc
:
set clipboard+=unnamed
Once you have done this, vim will use the system clipboard to read from by default for pasting. This means that, instead of having to enter insert
mode first you can simply use p
to paste. It also means that if you y
ank within vim, it's available to paste elsewhere.
I haven't tested this on any other OS, so if anyone has please feel free to add a comment...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With