enchantedvim


Ⅰ. 插件描述

Persistent Very Magic Patterns in Vim Commands.

Ⅱ. 基本信息

创建日期:  2014-02-04
使用用户:  11
Github星:  15
插件作者:  Marcin Szamotulski

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# Enchanted Vim

This is a vim script which makes searches with \v (very magic) persistent.
You can turn it off temporarily with

  let g:VeryMagic = 0 (default is 1)

or if you are already in the command line you can type \m or \M (see :help
\m). There are also: very magic substitute, global and vimgrep
(lvimgrep), which you have to turn on if you want to use them:

  let g:VeryMagicSubstitute = 1  " (default is 0)
  let g:VeryMagicGlobal = 1  " (default is 0)
  let g:VeryMagicVimGrep = 1  " (default is 0)
  let g:VeryMagicSearchArg = 1  " (default is 0, :edit +/{pattern}))
  let g:VeryMagicFunction = 1  " (default is 0, :fun /{pattern})
  let g:VeryMagicHelpgrep = 1  " (default is 0)
  let g:VeryMagicRange = 1  " (default is 0, search patterns in command ranges)
  let g:VeryMagicEscapeBackslashesInSearchArg = 1  " (default is 0, :edit +/{pattern}))
  let g:SortEditArgs = 1  " (default is 0, see below)

The g:VeryMagicSearchArg turns on the support for very magic `:edit +/pat
file for various commands which accepts this syntax, i.e. edit, view`,
visual, ex, split, vsplit, new, vnew, sview, find, sfind.
Furthermore with g:VeryMagicEscapeBackslashesInSearchArg the backslashes in
the +/ argument will be escaped (yes vim requires that and probably not only
I forget about this) if there is at least one unescaped backslash (this
prevents from double escaping when resuing the command from command history).
You still need to escape backslashes when you run vim +/\\vpat from the
command line, e.g. vim +"/\\vpattern" file.vim.

If you set g:SortEditArgs = 1 the arguments for :edit like commands will
be reordered. This allows to use :edit file.txt +/pattern which will be
reordered into :edit +/pattern file.txt.

If you use incsearch setting, you probably want to use g:VeryMagic = 0 and
set two mappings:

nm / /\v
nm ? ?\v

otherwise incsearch will not work for patterns which contains non
alphanumeric characters.

How it works

It simply injects \v at the beginning of your pattern after you press enter
or after c_CTRL-f.

Note: if you are using one of the two other of my plugins which are defining
maps to <CR> in the command line, you need to update them to the latest
version so that they will all work:

Macros

The plugin works well with vim macros which involve a search command like /.
Used register will not contain \v but it will by added when you play it.

Requirements

You have to also install
CRDispatcher plugin.

添加新评论