Ⅰ. 插件描述
Persistent settings for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'ernstwi/vim-sticky'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'ernstwi/vim-sticky'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'ernstwi/vim-sticky'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/ernstwi/vim-sticky
Ⅳ. 文档说明
# vim-sticky
This Vim plugin remembers the state of a user-defined set of "sticky" options between launches. When a sticky option is changed interactively (eg :set number) its state is saved, to be restored the next time Vim is launched.
This is meant to be used as a lightweight way to toggle options you change a lot, as an alternative to editing your vimrc.
Configuration
Sticky options are configured by setting g:sticky_all to a list of (long) option names. Besides option names, the string colorscheme can also be in this list.
let g:sticky_all = ['cursorline', 'breakindent', 'colorscheme']Different sticky options may be set for terminal and gui Vim.
" Make number sticky in terminal
let g:sticky_term = ['number']
" Make number and guifont sticky in gui
let g:sticky_gui = ['number', 'guifont']
" Make cursorline and breakindent sticky across both terminal and gui
let g:sticky_all = ['cursorline', 'breakindent']Note that number is in both g:sticky_term and g:sticky_gui. This means that the option will stick in both terminal and gui Vim, but may be set to a different value in each mode. If number was instead in g:sticky_all, a single state would be shared between terminal and gui.
After installing and configuring the plugin, you might want to manually :source ~/.vimrc to populate the plugin's data store with settings from your vimrc.
Similar plugins
- AutoSaveSetting by Kien Nguyen