vim-loclist-follow


Ⅰ. 插件描述

follow vim's location list entries based on source buffer cursor position

Ⅱ. 基本信息

创建日期:  2019-06-13
使用用户:  2
Github星:  11
插件作者:  Pete Beardmore

Ⅲ. 安装方法

使用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 = 1

Then 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 basis
  • previous : targets the item under cursor, else the previous item in the list
  • next : targets the item under cursor, else the next item in the list
  • towards : targets the item under cursor, else the next item given the direction of your cursor movement
  • away : inverts the behaviour described for towards
  • last : where possible targets / retains the last hit item

installation

autoload

  $ cp plugin/vim-loclist-follow.vim ~/.vim/autoload/

VimPlug

  Plug 'elbeardmorez/vim-loclist-follow'

添加新评论