vim-pasteurize


Ⅰ. 插件描述

Common User Access cut, copy, and paste for Vim

Ⅱ. 基本信息

创建日期:  2017-07-24
使用用户:  2
Github星:  1
插件作者:  Issa Rice

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'riceissa/vim-pasteurize'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'riceissa/vim-pasteurize'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'riceissa/vim-pasteurize'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/riceissa/vim-pasteurize

Ⅳ. 文档说明

# pasteurize.vim

Common User Access (CUA) cut, copy, and paste for Vim.

Rationale

The default keybindings Vim provides for interacting with the system clipboard
are quite cumbersome: in normal mode, actions involving the clipboard must be
prefixed by "+. In insert mode, Vim provides several keybindings, but these
all have problems: <C-R>+ interprets control characters, so is unsafe;
<C-R><C-R>+ inserts linebreaks that don't exist in the original text; and
<C-R><C-O>+ and <C-R><C-P>+ can paste outside of surrounding quote marks.
Each of these is also cumbersome to type.

This plugin attempts to simplify access to the clipboard in the spirit of
mswin.vim, which is included (but not loaded) in stock Vim. mswin.vim
itself is not suitable because it goes beyond mappings that deal with the
clipboard, and also has its own problems with pasting.

Desiderata

  1. Clobber no more keybindings than mswin.vim
  2. Provide secure pasting, i.e. ASCII control sequences should not be
    interpreted
  3. Keep CUA keybindings
  4. If the user pastes when the cursor is between two quote marks, the pasted
    text is always inserted between the two quote marks

I think these desiderata are pretty "commonsense": gedit follows all of them.

Features

In addition to following the desiderata listed above, this plugin offers the
following:

  • Stripping of leading and trailing newlines. If text is copied in Vim using
    visual line mode and standard mappings (e.g. V"+y), a trailing newline is
    included in the clipboard. I rarely want this, so this plugin strips these
    newlines, both when copying out of Vim and when pasting into Vim. If you
    want to disable this, add let g:pasteurize_no_strip_newlines = 1 to your
    vimrc.
  • Selective mappings. All mappings are provided using <Plug> mappings. If
    you want to disable the provided mappings so you can map them on your own,
    just add let g:pasteurize_no_mappings = 1 to your vimrc.

Installation

The plugin works with the major plugin and runtime path managers.

With vim-plug, place in your vimrc:

Plug 'riceissa/vim-pasteurize'

Then run :PlugInstall.

With pathogen.vim:

cd ~/.vim/bundle && \
git clone https://github.com/riceissa/vim-pasteurize.git

License

Distributed under the same terms as Vim itself. See :help license.

添加新评论