securemodelines


Ⅰ. 插件描述

A secure alternative to Vim modelines

Ⅱ. 基本信息

创建日期:  2007-04-29
使用用户:  136
Github星:  101
插件作者:  Ciaran McCreesh

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

Secure, user-configurable modeline support for Vim 7.

Vim's internal modeline support allows all sorts of annoying and potentially insecure options to be set. This script implements a much more heavily restricted modeline parser that permits only user-specified options to be set.

The g:secure_modelines_allowed_items array contains allowable options. By default it is set as follows:

    let g:secure_modelines_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"
                 ]

The g:secure_modelines_verbose option, if set to something true, will make the script warn when a modeline attempts to set any other option.

The g:secure_modelines_modelines option overrides the number of lines to check. By default it is 5.

If g:secure_modelines_leave_modeline is defined, the script will not clobber &modeline. Otherwise &modeline will be unset.

Keeping things up to date on vim.org is a nuisance. For the latest version, visit:

    http://github.com/ciaranm/securemodelines

添加新评论