vim-wheel


Ⅰ. 插件描述

Screen-anchored cursor movement for Vim

Ⅱ. 基本信息

创建日期:  2014-02-01
使用用户:  43
Github星:  50
插件作者:  Reed Es

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'reedes/vim-wheel'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'reedes/vim-wheel'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'reedes/vim-wheel'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

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

Ⅳ. 文档说明

# vim-wheel

Screen-anchored cursor movement for Vim

<br/>

    • -
      demo
    • -

Features

This plugin merges the standard cursor movement of j and k with the
scrolling of <CTRL-E> and <CTRL-Y> to produce a new screen-anchored
cursor movement. This roughly emulates movement when using a trackpad or
scroll wheel.

  • By default, two keys are mapped: <CTRL-J> (like j) moves towards the
    end of buffer and <CTRL-K> (like k) move towards its beginning
  • Movement is tied to trackpad/scroll wheel for ‘natural’ scrolling
  • Due to Vim’s inherent jumpiness with wrap enabled, you have option to
    degrade to gj and gk (more details below)
  • Supports Visual selection
  • Pure Vimscript with no dependencies

Installation

Install using Pathogen, Vundle, Neobundle, or your favorite Vim package
manager.

Configuration

You can change the behavior of this plugin in your .vimrc:

For instance, the default mappings of:

let g:wheel#map#up   = '<c-k>'
let g:wheel#map#down = '<c-j>'

...can be changed to use the Command key in MacVim:

let g:wheel#map#up   = '<D-k>'
let g:wheel#map#down = '<D-j>'

If you have any existing mappings to <c-k> or <c-j>, they will be
preserved.

Trackpad/Scroll wheel behavior

By default the scroll behavior of the mouse will reflect this new

  1. You can disable in your .vimrc if not desired.
  • Natural - content tracks finger movement on trackpad
  • Reverse - swiping down moves content up
let g:wheel#map#mouse = 1       " 1=natural, 0=disable, -1=reverse

End of buffer threshold

_wheel_’s scrolling will cease when cursor nears the start or end of the
buffer, degrading to gj and gk. You can adjust this threshold in your
.vimrc:

let g:wheel#line#threshold = 5      " lines from start or end

Behavior with wrap

With large blocks of wrapped text, Vim’s native scrolling with CTRL-E
and CTRL-Y can be jumpy. wheel inherits this behavior, unfortunately.
If you would prefer that wheel degrade to gj and gk when wrap is on,
you can disable the anchored scrolling in your .vimrc:

let g:wheel#scroll_on_wrap = 1      " 0=disable, 1=enable (default)

See also

If you find this plugin useful, check out these others by @reedes:

Future development

There’s an experimental horizontal scrolling movement hidden within for
those who wish to try it out.

If you’ve spotted a problem or have an idea on improving this plugin,
please post it to the github project issue page.

添加新评论