Ⅰ. 插件描述
snoop around the script-local things :dog: :mag_right:Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'haya14busa/vim-snoopy'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'haya14busa/vim-snoopy'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'haya14busa/vim-snoopy'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/haya14busa/vim-snoopy
Ⅳ. 文档说明
vim-snoopy :dog: :mag_right:
:notes: Introduction
vim-snoopy ( snoopy.vim ) provides a way to snoop script-local things.
You can get <SID>, access script-local functions, and even script-variable
from {path}.
It also provides a command to open the <SID> file (:SnoopyOpen),:scriptnames like functions and [unite.vim] interface for :scriptnames.
This plugin is just a wrapper of [Vital.Vim.ScriptLocal] and little
additional functionality. Please install [vital.vim] to read this snoopy
documentation and if you are a vim plugin developer and want to use
vim-snoopy, please use vital's [Vital.Vim.ScriptLocal] API.
Let's snoop around the script-local things and debug, test them!
:tada: Access script local functions
:let s:sfuncs = Sfuncs('plugin/snoopy.vim')
:echo s:sfuncs
" =>
" {
" 'capitalize': function('<SNR>54_capitalize'),
" 'default_names': function('<SNR>54_default_names'),
" 'define_funcs': function('<SNR>54_define_funcs')
" }
:echo s:f.capitalize('hi there!')
" => Hi there!:ghost: Access script local variables
Warning: this is unsafe function. Please use it carefully
:let s:svars = Svars('autoload/unite/sources/snoopy.vim')
:echo s:svars.source
" =>
" {
" 'action_table': {},
" 'alias_table': {},
" ...
" 'white_globs': []
" }:electric_plug: Functions
| name | alias for |
|---|---|
Scriptnames() | Vital.Vim.ScriptLocal.scriptnames() |
Sfuncs({path}) | Vital.Vim.ScriptLocal.sfuncs() |
Sid({path}) | Vital.Vim.ScriptLocal.sid() |
Sid2path(<SID>) | Vital.Vim.ScriptLocal.sid2path() |
Sid2sfuncs(<SID>) | Vital.Vim.ScriptLocal.sid2sfuncs() |
Sid2svars(<SID>) | Vital.Vim.ScriptLocal.sid2svars() |
Svars({path}) | Vital.Vim.ScriptLocal.svars() |
See :h [Vital.Vim.ScriptLocal] for detail
:mag: Commands
:SnoopyOpen <SID>
Open the file whose <SID> is matched with given one.
example:
:SnoopyOpen 14:dragon: Unite
unite-scriptnames
vim-snoopy includes [unite.vim] sources for :scriptnames.
You can see scriptnames in unite interface and open the target file quickly.
:Unite scriptnames:bird: Author
haya14busa (https://github.com/haya14busa)