vimple


Ⅰ. 插件描述

Develop VimL

Ⅱ. 基本信息

创建日期:  2011-01-19
使用用户:  29
Github星:  51
插件作者:  Barry Arthur

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

Vimple

Pacifying Vimmers

http://of-vim-and-vigor.blogspot.com/2012/03/pacifying-vimmers.html[Ad]

Perhaps most usefully, Vimple provides a few maps and commands to make
the casual vimmer's life a little easier. If you don't want any of these
maps and commands, they can be disabled by adding this line to your
$MYVIMRC:

let g:init_vimple_maps_and_commands = 0

Here are a few examples of such maps and commands:

=== :View ex-command

Opens a split with the output of ex-command.

=== z=

Shows spelling suggestions in an overlay window. Pressing <enter>
will replace the word under the cursor in the original window with the
current word under the cursor in the overlay.

Use <plug>vimple_spell_suggest if you want to map this behaviour
to a differnt key.

=== [I

Shows identifier search results in an overlay window. Pressing <enter>
will jump to the associated line of the identifier under the cursor.

Use <plug>vimple_ident_search if you want to map this behaviour
to a differnt key.

=== g]

Shows tag search results in an overlay window. Pressing <enter>
will jump to the associated line of the tag under the cursor.

Use <plug>vimple_tag_search if you want to map this behaviour
to a differnt key.

=== SCall( script , function , arg )

A function which calls script-local function in script
with arguments arg. This lets you call <SNR> / s:
functions by script name rather than SNR (script-number).

=== :Silently ex-command

Performs the series of bar-separated ex-commands silently.

=== :QFdo ex-command

Performs the series of bar-separated ex-commands over the buffers in the QuickFix list.

NOTE: The location-list analogue is :LLdo

=== :BufTypeDo type ex-commands

Performs the series of bar-separated ex-commands over the buffers of the given +type+.

=== :BufMatchDo pattern ex-commands

Performs the series of bar-separated ex-commands over the buffers with names matching +pattern+.

=== :Collect register-or-variable ex-command

Saves the output of ex-command into the specified register
or variable.

=== Collect('register-or-variable ex-command')

Saves the output of ex-command into the specified register
or variable and returns the output for further use in
expressions.

=== GCollect( pattern )

Uses pattern in a :global /pattern/ command and returns
the results as a list of lines.

:echo GCollect('^\s*===\s*')

=== GCCollect( pattern )

Uses pattern in a :global /pattern/ command and returns
the results as a list of lines with the pattern stripped.

:echo GCCollect('^\s*===\s*')

=== :MyMaps

Shows your currently active |:map|s and |:imap|s in a new buffer. :MyMaps
attempts to group related maps to more easily allow you to create a custom map
layout for your various |'filetype'|s.

=== Scope()

The Scope() function attempts to show the current function or
class/method scope. Some people like to display this information in
their statusline, like:

set statusline=%f%m%r%h%w [%n:%{&ff}/%Y]%{Scope()}%=0x%04.4B[%p%% line %l of %L]

Currently only Vim & Python (and Python only for testing purposes, created by a NON Pythonista -- patches welcome) have been implemented, but it is very easy for you to write scope functions for your own filetypes. Take Ruby for example: Create ~/.vim/ftplugin/ruby_scope.vim like this:


function! Scope_ruby()
let class_scope = scope#inspect('^sclasss+([a-zA-Z0-9_.]+)', '^send')
let method_scope = scope#inspect('^sdefs+([a-zA-Z0-9_.]+)', '^send')
return ' ' . join(map(class_scope.stack, 'v:val.head_line_number . "," . v:val.tail_line_number . " " . v:val.head_string'), ' :: ')

    \. ' >> ' . join(map(method_scope.stack, 'v:val.head_line_number . "," . v:val.tail_line_number . " " . v:val.head_string'), ' > ')

endfunction

NOTE: The above example for Ruby is woefully inadequate. A better effect
might be achievable with more context in the regex patterns. The
patterns in syntax/ruby.vim might be useful. Parsing with regex is futile.

=== Composable Completions

By default, jj in insert mode activates a user-extendible
meta-completion list. The default list includes abbreviations (if you
have https://github.com/dahu/Aboriginal), some date-time patterns and
the built-in dictionary completion (<c-x><c-k>).

The default jj can be overridden like this:

imap <c-x><c-c> <plug>vimple_completers_trigger

Two other example shortcuts provided by vimple by default:

  • <c-x><c-a> to complete abbreviations
  • <c-x><c-z> to complete datetimes

These defaults can be disabled by adding these lines to your $MYVIMRC:

imap <unique> <nop-1> <plug>vimple_completers_trigger
imap <unique> <nop-2> <plug>vimple_completers_abbrev_trigger
imap <unique> <nop-3> <plug>vimple_completers_datetime_trigger

NOTE: <unique> is used here to trigger a warning if you're re-using a <nop- n > map.

Vimple also provides VimLOO (Object Oriented VimL) objects
for these read-only ++:ex++ commands:

  • ++:ls++ -- vimple#bl
  • ++:scriptnames++ -- vimple#sn
  • ++:highlight++ -- vimple#hl
  • ++:version++ -- vimple#vn
  • ++:marks++ -- vimple#ma
  • ++:undolist++ -- vimple#ul
  • ++:maps++ -- vimple#mp

NOTE: The awesome plugin
https://github.com/Raimondi/vim-buffalo[buffalo] uses the
vimple#bl object.

In addition to these existing ++:ex++ wrappers, Vimple allows
developers to craft their own objects too. See autoload/vimple/*.vim
for examples.

添加新评论