Ⅰ. 插件描述
follow vim's location list entries based on source buffer cursor positionⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'elbeardmorez/vim-loclist-follow'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'elbeardmorez/vim-loclist-follow'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'elbeardmorez/vim-loclist-follow'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/elbeardmorez/vim-loclist-follow
Ⅳ. 文档说明
# vim-loclist-follow
description
Use this plugin to enable automatic updating of the selected location list item based on the current cursor position. The item selected is determined by the target type which by default selects the nearest item. Both window local, and global 'quickfix' location lists are supported.
Tested against Syntastic and Ale setups with dozens of unique / split buffer windows opened (and their respective location list windows open (and closed) and populated) with no noticeable lag. Please report any issues.
usage
To enable this plugin's functionality the global g:loclist_follow variable must be explicitly set either on/off, likely through an rc file entry e.g.:
let g:loclist_follow = 1Then there are two variables which control the ultimate on/off per buffer state of this functionality, namely g:loclist_follow and b:loclist_follow, and these can be toggled via commands :LoclistFollowGlobalToggle and :LoclistFollowToggle respectively.
When globally enabled, any opened/read buffers will have the appropriate hook installed on the CursorMoved(I) event(s) (this can be verified via :autocmd loclist_follow). The events correspond to normal and insert modes and both are hooked by default. The global g:loclist_follow_modes variable can be configured to modify this behaviour by setting any combination of the mode mappings n -> normal and i -> insert e.g.:
let g:loclist_follow_modes = 'n' "[default: 'ni']When globally toggled, all buffers will be toggled unless they have been locally toggled off (via :LoclistFollowToggle / let b:loclist_follow = 0) - this buffer local variable state removes the buffer from the influence of global toggling. When globally disabled, locally enabling a buffer will enable the functionality locally and will not change the global state.
The global g:loclist_follow_target variable and its corresponding command for toggling LoclistFollowTargetToggle can be used to switch the target type between the following values:
nearest: targets the closest item to the cursor on a line basisprevious: targets the item under cursor, else the previous item in the listnext: targets the item under cursor, else the next item in the listtowards: targets the item under cursor, else the next item given the direction of your cursor movementaway: inverts the behaviour described fortowardslast: where possible targets / retains the last hit item
installation
autoload
$ cp plugin/vim-loclist-follow.vim ~/.vim/autoload/VimPlug
Plug 'elbeardmorez/vim-loclist-follow'