ToggleOptions.vim


Ⅰ. 插件描述

Quick toggling of options

Ⅱ. 基本信息

创建日期:  2005-05-09
使用用户:  1
Github星:  1
插件作者:  Eric Arnold

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

This allows "toggling" of more complex operations, like switching off "diffthis".  It also reduces the number of key mappings used overall by placing the operations under a key activated command window menu, i.e. if the key map is <leader>o  and <leader> is ",":
     ,o
displays an option list in the command window:
     wrap, Wrapscan, list, binary, modifiable, diff, virtualedit, uhex
so the full command
    ,od
toggles "diff" mode on/off for a window (including foldcolumn=0)
    ,om
toggles "modifiable" and "readonly" together.

You should edit the script to add what want.  E.g.  add your item to the menu call string:

    let l:char = s:Char_menu( "{w}rap, {W}rapscan, {l}ist, {b}inary, {m}odifiable, {d}iff, {v}irtualedit, uhe{x}" )

where {text} is in a different color, then add an elseif clause:

    elseif l:char ==# 'm'
        if &modifiable && !&readonly
            set nomodifiable
            set readonly
        else
            set modifiable
            set noreadonly
        endif
        set readonly?
        set modifiable?

添加新评论