Ⅰ. 插件描述
Vim plugin reading modelines from the git configⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'cryptomilk/vim-gitmodeline'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'cryptomilk/vim-gitmodeline'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'cryptomilk/vim-gitmodeline'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/cryptomilk/git-modeline.vim
Ⅳ. 文档说明
git-modeline.vim
Vim plugin reading modelines from the git config
Configuration
The plugin applies modelines specified in the git config to the current vim
- The plugin works with vim and neovim.
To set a modeline in the git config you can do it with the following command:
git config --add vim.modeline "tabstop=8 shiftwidth=8 noexpandtab cindent"
To set a format specific modeline (you'll need the filetype plugin on), just
define a vim.modeline.<FT> git config entry.
Example, C indented with 4 spaces, but Makefile with 8 space tabs:
git config --add vim.modeline-c "ts=4 sw=4 et"
git config --add vim.modeline-make "ts=8 sw=8 noet"
If no filetype specific entry can be found it will use the default modeline.
The allowed modelines are defined in a variable and can be overwritten and
extended by setting the following in your .vimrc:
let g:git_modeline_allowed_items = [
\ "textwidth", "tw",
\ "softtabstop", "sts",
\ "tabstop", "ts",
\ "shiftwidth", "sw",
\ "expandtab", "et", "noexpandtab", "noet",
\ "filetype", "ft",
\ "foldmethod", "fdm",
\ "readonly", "ro", "noreadonly", "noro",
\ "rightleft", "rl", "norightleft", "norl",
\ "cindent", "cin", "nocindent", "nocin",
\ "smartindent", "si", "nosmartindent", "nosi",
\ "autoindent", "ai", "noautoindent", "noai",
\ "spell",
\ "spelllang"
\ ]