Ⅰ. 插件描述
A small, simple plugin to make the scroll action for C^D and C^U smootherⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'kazark/vim-simplesmoothscroll'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'kazark/vim-simplesmoothscroll'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'kazark/vim-simplesmoothscroll'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/kazark/vim-simplesmoothscroll
Ⅳ. 文档说明
### Description
SimpleSmoothScroll is a simple Vim global plugin for giving a smoothed effect
to Ctrl-D and Ctrl-U.
Rationale
I originally created this script for myself when I was looking through large
code files in a legacy code base and I was having trouble keeping track of
where I was in all the spaghetti. The smooth scroll action gave me a better
sense of my own navigation.
I originally published this code on StackOverflow.
The current version has been fixed up some in an attempt to be a little more
readable and conform to the guidelines put forth in :help write-script.
I've also used this as a chance to begin learning to use Github. At the time I
wrote this, I did not realize that there were [many existing smooth scroll
plugins](http://www.vim.org/scripts/script_search_results.php?keywords=smooth+scroll&script_type=&order_by=rating&direction=descending&search=search).
To be honest, I haven't looked into any of them. They might be better than
this.
Features
- Scroll on the basis of the Vim
scrolloption. - If you set the mouse option for some modes, you can scroll with the mouse
wheel in those modes. - Manually customizable scrolling speed (adjust the
sleepcommand's time
argument; I use ten milliseconds). Note: just like slowing down the frame
rate on a video, if you slow down the smooth scroll too much it will be jerky
scroll.
already in insert mode)
- Simple and lightweight
Warning
I've found that you shouldn't push Ctrl-D or
Ctrl-U until the previous scroll has finished, or the
behavior is somewhat unpredictable. I have mostly experienced this problem when
dealing with very large files over a painfully slow network connection.
Installation
I recommend installing pathogen.vim,
and then executing:
cd ~/.vim/bundle
git clone https://github.com/Kazark/vim-SimpleSmoothScroll.git
or the equivalent. Alternatively, you can copy plugin/SimpleSmoothScroll.vim
to ~/.vim/plugin. (Note: you may have to use ~\vimfiles instead of~/.vim if you are on Windows...)
Insert mode
By default <C-D> and <C-U> have different purposes in insert mode. However if
you would like to have scroll working as normal mode, add the lines below to
your vimrc file.
inoremap <C-U> <Esc><C-U>i
inoremap <C-D> <Esc><C-D>i