sponsor Vim development Vim logo Vim Book Ad

paste_open.vim : Mapping targets for opening new lines in paste mode

 script karma  Rating 23/7, Downloaded by 586  Comments, bugs, improvements  Vim wiki

created by
Tom Ryder
script type
This plugin provides mapping targets for opening new lines in insert mode, above or below the cursor position (same as O and o), but precedes them with a :set paste. It restores that option's previous value once the insert operation finishes. This makes a "one-shot paste".

The excellent unimpaired.vim, vimscript #1590, provides pretty much the same mapping. However, newer versions of that plugin deprecated the two-key binding I liked, and I wanted something simpler without loading all the other bindings that I never used anyway.

install details
Drop plugin/paste_open.vim in your ~/.vim/plugin directory. Add doc/paste_open.txt in ~/.vim/doc if you want the help file. Otherwise, use your favourite Vim plugin package manager.

The author uses the mappings like this in his .vimrc:

    nmap \o <Plug>(PasteOpenBelow)
    nmap \O <Plug>(PasteOpenAbove)

To get the old unimpaired.vim bindings back, you might do this:

    nmap yo <Plug>(PasteOpenBelow)
    nmap yO <Plug>(PasteOpenAbove)

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-paste-open-1.0.1.tar.gz 1.0.1 2018-09-06 7.0 Tom Ryder Parenthesize map names, remove autoload, correct documentation
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.