Ⅰ. 插件描述
DEPRECATED Improved /-search (experimental)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'junegunn/vim-oblique'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'junegunn/vim-oblique'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'junegunn/vim-oblique'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/junegunn/vim-oblique
Ⅳ. 文档说明
vim-oblique 
*Disclaimer: this plugin has many issues that cannot be easily fixed.
I suggest that you try simpler alternatives like
vim-evanesco or
vim-slash.*
Improved /
-search for Vim.
- Different highlight for the match under the cursor
- Automatically clears search highlight when cursor is moved
- Does not append short patterns to search history
- Readline key bindings
- Fuzzy-search
- Improved star-search (visual-mode, highlighting without moving)
Installation
Use your favorite plugin manager. vim-oblique requires
vim-pseudocl.
With vim-plug:
Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-oblique'
Usage
vim-oblique overrides the following keys by default:
Default Key | <Plug> map | Description |
---|---|---|
/ | <Plug>(Oblique-/) | Forward search |
? | <Plug>(Oblique-?) | Backward search |
z/ | <Plug>(Oblique-F/) | Forward fuzzy-search |
z? | <Plug>(Oblique-F?) | Backward fuzzy-search |
n | <Plug>(Oblique-n) | Repeat the last search |
N | <Plug>(Oblique-N) | Repeat the last search in the opposite direction |
<Plug>(Oblique-n!) | Repeat the last search (always forward) | |
<Plug>(Oblique-N!) | Repeat the last search (always backward) | |
* | <Plug>(Oblique-*) | Forward star-search (in normal and visual mode) |
# | <Plug>(Oblique-#) | Backward star-search (in normal and visual mode) |
g* | <Plug>(Oblique-g*) | Forward star-search (no word boundary match) |
g# | <Plug>(Oblique-g#) | Backward star-search (no word boundary match) |
(Unlike the default star-search, the overridden version will not move the cursor)
Customization
Maps
Use the <Plug>
maps in the above table to customize the maps.
Options
g:oblique#min_length
(default: 3)- Patterns shorter than this will not be added to search history
g:oblique#incsearch_highlight_all
(default: 0)- To highlight all incremental matches (requires
incsearch
)
- To highlight all incremental matches (requires
g:oblique#clear_highlight
(default: 1)- To clear search highlight or not
g:oblique#prefix
(default: '')- Option to prefix pattern with
g:oblique#enable_cmap
(default: 1)- Enable experimental cmap emulation
Events
You can customize the behavior of vim-oblique by registering custom actions to
the following events of User
group.
Event | When |
---|---|
Oblique | / , ? , z/ , z? |
ObliqueStar | * , # , g* , g# |
ObliqueRepeat | n , N |
The following example will move your cursor line to the middle of the screen
after search.
autocmd! User Oblique normal! zz
autocmd! User ObliqueStar normal! zz
autocmd! User ObliqueRepeat normal! zz
Highlighting
Define the following highlight groups to change the color:
ObliquePrompt
(default: linked toLabel
)ObliqueLine
(default: linked toNone
)ObliqueCurrentMatch
(default: linked toIncSearch
)ObliqueCurrentIncSearch
(default: linked toIncSearch
)
Example
hi! def link ObliqueCurrentMatch Keyword
hi! def link ObliquePrompt Structure
hi! def link ObliqueLine String
License
MIT