jumpy.vim


Ⅰ. 插件描述

Filetype-specific mappings for [[ and ]]

Ⅱ. 基本信息

创建日期:  2019-08-03
使用用户:  4
Github星:  31
插件作者:  Martin Tournoij

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'arp242/jumpy-vim-be-who-we-are'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'arp242/jumpy-vim-be-who-we-are'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'arp242/jumpy-vim-be-who-we-are'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

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

Ⅳ. 文档说明

This project is considered stable
Build Status
codecov

Filetype-specific mappings for [[ and ]] to jump to the next or previous
section.

Use g:jumpy_map to configure the mappings:

let g:jumpy_map = [']]', '[[']                     Defaults.
let g:jumpy_map = ['<Leader>]', '<Leader>[']       Use Leader.
let g:jumpy_map = 0                                Don't map anything.

Use g:jumpy_after to run a command after after jumping:

let g:jumpy_after = ''                             Default.
let g:jumpy_after = 'zz'                           Center the screen.

Currently supported filetype with their patterns:

Filetype     What it matches                     Regexp
--------     ---------------                     ------
c            Function/typedef opening brace      \v%(^\{|^\s@!.*\{$)
css          Selector                            ^[^ \t{}/]
diff         File                                ^diff 
git          Commit in git log                   ^commit 
go           Top-level declaration               \v^%(func|type|var|const|import)
gomod        Replace/require                     \v^%(require|replace) 
help         Help tag definition                 \*[a-zA-Z0-9:_<> *-]\+\*
html         Common block elements               \v\<%(head|body|style|script|div|ul|article|section|main|header|footer|form|fieldset|h\d)[> ]
javascript   Function declaration/expression     \v^\s*%(function\s*\w|%(var|let) \w*\s+\=\s+%(function\(|\(.{-}\)\s*\=\>\s*))
lua          Function definition                 ^\s*function\>
make         Target                              ^[a-zA-Z0-9 _-]\+:
markdown     Header and horizontal rule          \v%(^\=\=\=|^---|^#{1,6})
php          Function, class, interface          \v^\s*%(%(abstract\s+|final\s+|private\s+|public\s+|protected\s|static\s+)*function|%(abstract\s+|final\s+)*class|interface)>
python       Function, method, class             \v^(class|\s*def|\s*async def)>
qf           Next/prev filename                  \%#=1\v^([^\|]+).*\n\1@!\zs
ruby         Function, class, or module          \v^\s*%(def|class|module)>
sh           Function declaration                ^\w\+()[ \n]*{
sql          CREATE and BEGIN                    \c\v^\s*%(create|begin)>
tex          Beginning of a section              \v^\s*\\%(%(sub)*section|chapter|part|appendix|%(front|back|main)matter)>
vcl          Function or backend.                \v^%(sub|backend)
vim          Function/augroup definition         \v^\s*%(fu%[nction]>|aug%[roup]\s%(\s*[eE][nN][dD])@!)
yaml         Top-level key                       ^\w\+:

This overrides mappings for some filetypes in Vim's standard distribution for
consistency and usefulness (e.g. ft=vim behaves different when it can't find a
match, ft=sql only jumps to BEGIN and not CREATE, etc.)

Adding a new filetype

  1. Call jumpy#map() in after/ftplugin/<ft>.vim.
  2. Add a test in autoload/jumpy_test.vim; the key is a filename from
    autoload/testdata/test.ext and the value a list of line numbers you expect

it to jump to. The plugin is tested with
testing.vim; running the full test
suite should be as easy as tvim test ./....

  1. Use ./tbl to create the table; the first line is used as the "what it
    matches" column.

Alternatively, you can use a Filetype autocmd in your local vimrc file:

autocmd Filetype myft call jumpy#map('..pattern..')

添加新评论