Ⅰ. 插件描述
Screen-anchored cursor movement for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用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/>
- -

- -
- -
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>(likej) moves towards the
end of buffer and<CTRL-K>(likek) move towards its beginning - Movement is tied to trackpad/scroll wheel for ‘natural’ scrolling
- Due to Vim’s inherent jumpiness with
wrapenabled, you have option to
degrade togjandgk(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
- You can disable in your
.vimrcif 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=reverseEnd 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 endBehavior 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:
- vim-colors-pencil - color scheme for Vim inspired by IA Writer
- vim-lexical - building on Vim’s spell-check and thesaurus/dictionary completion
- vim-litecorrect - lightweight auto-correction for Vim
- vim-one - make use of Vim’s +clientserver capabilities
- vim-pencil - Rethinking Vim as a tool for writers
- vim-textobj-quote - extends Vim to support typographic (‘curly’) quotes
- vim-textobj-sentence - improving on Vim's native sentence motion command
- vim-thematic - modify Vim’s appearance to suit your task and environment
- vim-wordy - uncovering usage problems in writing
- vim-wordchipper - power tool for shredding text in Insert mode
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.