An open API service indexing awesome lists of open source software.

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

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.

![gif](https://cloud.githubusercontent.com/assets/674812/5927093/15b527c6-a692-11e4-85c1-fbe4a49c4ebc.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:
![tada](https://cloud.githubusercontent.com/assets/674812/8426710/6d059906-1f01-11e5-8000-ba3a470630c1.gif)

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 <