Ⅰ. 插件描述
Like f{char}, but searching the same screen column, not line.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'inkarkat/jumptoverticaloccurrence'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'inkarkat/jumptoverticaloccurrence'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'inkarkat/jumptoverticaloccurrence'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/JumpToVerticalOccurrence
Ⅳ. 文档说明
JUMP TO VERTICAL OCCURRENCE
by Ingo Karkat
DESCRIPTION
The f / F commands allow you to quickly go to next / previous occurrences
of a character in the same line (with plugins also across lines), but are
limited to horizontal movement. But vertical movement, restricted to the same
screen column the cursor is in, across lines would often be helpful, too.
This plugin provides a |]V|{char} mapping that works just like f, but
- The ]v mapping is similar, but uses the character under the
- instead of querying for it (which is a more common use case when moving
vertically).
The ]| mapping is helpful for jumping out of indented blocks, or to filled-out
columns, as it moves to the next non-whitespace in the current column.
In long sorted lists, one often wants to go to the first / last instance of
the current character (e.g. to move from "[A]ddress" to "Aardvark" or the last
"Azure" before the entries with "B" begin). The ]! mapping does that.
SOURCE
- [The ]| mapping was inspiration](http://stackoverflow.com/questions/20882722/move-to-the-next-row-which-has-non-white-space-character-in-the-same-column-in-v)
SEE ALSO
- The JumpToLastOccurrence.vim plugin (vimscript #3386) still moves
horizontally in the same line, but counts the characters in reverse,
starting from the last one.
- The JumpToVerticalBlock.vim plugin (vimscript #5657) has motions that
operate like W and E, but vertically. - Check out the CountJump.vim plugin page (vimscript #3130) for a full list
of motions and text objects powered by it.
RELATED WORKS
- columnmove (vimscript #4880) defines f/t/;/, commands as well as w/e/b/ge
commands that work vertically, either skipping or opening closed folds. - columnMove (vimscript #5402) moves to the end / start of vertical blocks of
non-whitespace.
USAGE
]v To [count]'th occurrence of the character under the cursor
in the same screen column of following lines.
[v To [count]'th occurrence of the character under the cursor
in the same screen column of previous lines.
]V{char} To [count]'th occurrence of {char} in the same screen
column of following lines. Like f, but vertically.
[V{char} To [count]'th occurrence of {char} in the same screen
column of previous lines. Like F, but vertically.
You can quickly repeat the same motion via the ]v / [v
mappings (like ; / , for f).
]| To [count]'th next line that has non-whitespace in the
same column as the current one.
[| To [count]'th previous line that has non-whitespace in the
same column as the current one.
]! To the last continuous occurrence of the character under
the cursor in the same screen column. With any [count],
skips over whitespace and shorter lines.
[! To the first continuous occurrence of the character under
the cursor in the same screen column. With any [count],
skips over whitespace and shorter lines.
Mnemonic: The ! looks like a column, with the dot marking
the jump target.
INSTALLATION
The code is hosted in a Git repo at
https://github.com/inkarkat/vim-JumpToVerticalOccurrenceYou can use your favorite plugin manager, or "git clone" into a directory used
for Vim packages. Releases are on the "stable" branch, the latest unstable
development snapshot on "master".
This script is also packaged as a vimball. If you have the "gunzip"
decompressor in your PATH, simply edit the *.vmb.gz package in Vim; otherwise,
decompress the archive first, e.g. using WinZip. Inside Vim, install by
sourcing the vimball or via the :UseVimball command.
vim JumpToVerticalOccurrence*.vmb.gz
:so %
To uninstall, use the :RmVimball command.
DEPENDENCIES
- Requires Vim 7.0 or higher.
- Requires the CountJump plugin (vimscript #3130), version 1.60 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.034 or
higher. - repeat.vim (vimscript #2136) plugin (optional)
CONFIGURATION
For a permanent configuration, put the following commands into your vimrc:
To change the default motion mappings, use:
let g:JumpToVerticalOccurrence_CharUnderCursorMapping = 'v'
let g:JumpToVerticalOccurrence_QueriedMapping = 'V'
let g:JumpToVerticalOccurrence_NonWhitespaceMapping = '<Bar>'
let g:JumpToVerticalOccurrence_LastSameCharMapping = '!'
To also change the [ / ] prefix to something else, follow the instructions for
CountJump-remap-motions.
CONTRIBUTING
Report any bugs, send patches, or suggest features via the issue tracker at
https://github.com/inkarkat/vim-JumpToVerticalOccurrence/issues or email
(address below).
HISTORY
1.01 14-Feb-2018
- BUG: ]! on a single occurrence of a character in that column mistakenly
jumps to end of buffer. - BUG: <count>]! may jump too far and land on whitespace instead of the last
line that contains the current character at the current column.
You need to update to ingo-library (vimscript #4433) version 1.034!
1.00 22-Jan-2014
- First published version.
0.01 02-Jan-2014
- Started development.
Copyright: (C) 2014-2018 Ingo Karkat -
The VIM LICENSE applies to this plugin.
Maintainer: Ingo Karkat <ingo@karkat.de>