ToggleOptions.vim : Quick toggling of options
script karma |
Rating 0/0,
Downloaded by 1008 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Eric Arnold |
|
script type |
utility |
|
description |
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?
|
|
install details |
Put it in the plugin directory. Change the <leader>o key map as desired. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 142.132.191.50
|