https://github.com/seletskiy/urxvt-vim-insert
Make Shift-Insert work as expected in vim and shell
https://github.com/seletskiy/urxvt-vim-insert
Last synced: 4 months ago
JSON representation
Make Shift-Insert work as expected in vim and shell
- Host: GitHub
- URL: https://github.com/seletskiy/urxvt-vim-insert
- Owner: seletskiy
- Created: 2015-01-27T20:26:11.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-01-22T12:49:28.000Z (over 7 years ago)
- Last Synced: 2025-10-26T13:27:32.196Z (9 months ago)
- Language: Perl
- Size: 8.79 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Try to insert following text into your fully configured vim using `Shift-Insert`:
```
{
{
{
# madness!
}
}
}
```
Then, compare with following gif.

You can use Shift+Insert now
============================
How many times you do following sequence in vim?
```
"*p
```
Or, if you smart one, this one?
```
*
```
However, remote vim leaves you no choice.
```
:set paste
:set nopaste
```
urxvt-vim-insert into the rescue
================================
Just install this urxvt perl plugin, restart urxvt and all following
Shift-Inserts will paste text as it expected to be done in XXI century.
It will also work onto remote server vim. Waow.
What's difference with "bracketed paste?"
=========================================
"Bracketed paste" requires plugin for vim and intended for pasting in vim only.
urxvt-vim-insert is a plugin for terminal and redirects any paste to the new
vim session, which can be used for **the remote sessions** as well. E.g.,
you can safely paste multiline text directly into remote unconfigured vim and
it will work nice.
urxvt-vim-insert can be used for pasting multiline text in local or remote
shell.
urxvt-vim-insert requires no vim/shell configuration whatsoever.
How about pasting multiline text directly into the shell?
=========================================================
Seen this site?
http://thejh.net/misc/website-terminal-copy-paste
Your browser will happily copy any hidden text into clipboard, and guess what
happens if you paste some hidden text that contains `rm -rf /usr/` into terminal
on the production server? :peach:
Hopefully, there is a solution.
## :tada: TADA! :tada:

Also, you need to specify program, that will be used to edit clipboard and send
result back.
This command is specified via `URxvt.safe-paste.command` param. See more in the
next section.
For example, I'm using setup with urxvt+tmux+vim, so my safe-paste command is:
```
URxvt.safe-paste.command: vim-safe-paste
```
`vim-safe-paste`:
```sh
tmux_pid=$(pgrep -P$1 tmux)
session_name=$(grep -zFxA1 -- '-s' < /proc/$tmux_pid/cmdline | cut -b3-)
tmux neww -t $session_name "$(cat <