configurationUtility.vim


Ⅰ. 插件描述

Save and load configuration files in a dictionary format with sections and items

Ⅱ. 基本信息

创建日期:  2013-01-03
使用用户:  0
Github星:  0
插件作者:  Alexandre Viau

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

See latest version on github: https://github.com/viaa/VimPlugins

Name: configurationUtility.vim
Version: 1.0
Author: Alexandre Viau (alexandreviau@gmail.com)

NOTE: The configurationUtility.vim plugin is fully functional as it is, but I will not continue its development because I now use and develop the basicXmlParser.vim plugin to load and save data to configuration files. One advantage of the basicXmlParser plugin is that it offers unlimited levels of subitems of data but the configurationUtility offers only 2, but in many case for configuration files, 2 levels are enough. Here is the link to the basicXmlParser plugin http://www.vim.org/scripts/script.php?script_id=4380

Description: Save and load configuration files in a dictionary format containing sections and items. I wanted to have a way to save and load configuration data with items and sections like .ini files on Windows, and I found that it could be possible using dictionaries.
The functions in this plugin are used to create and load a file like this which contains a large dictionary that contains items and one level of subitems called sections.

Here are the available functions:
g:CfgLoadFromFile(file)
g:CfgSaveToFile(cfg, file)
g:CfgGetItem(dict, itemKey)
g:CfgGetItemKey(dict, itemValue)
g:CfgRemoveItem(dict, itemKey)
g:CfgSetItem(dict, itemKey, itemValue)
g:CfgGetSection(dict, sectionKey)
g:CfgSetSection(dict, sectionKey, sectionvalue)
g:CfgSectionRemove(dict, sectionKey)
g:CfgSectionGetItem(dict, sectionKey, itemKey)
g:CfgSectionGetItemKey(dict, itemValue)
g:CfgSectionRemoveItem(dict, sectionKey, itemKey)
g:CfgSectionSetItem(dict, sectionKey, itemKey, itemValue)
g:CfgSectionExists(dict, sectionKey)

The sections themselves contains items. So at the first level there are items and sections, and in the sections there are items only.
For example here items would be 'history', 'favorites', 'lastPath'. The sections would be for example 'selectedFiles', 'marks', and items in the sections in this example would be 'B', 'C', etc...  
let g:Cfg = {'selectedFiles': {}
, 'marks': {'A': 'C:Usbi_greenapps'
, 'B': 'C:UsersUserDesktop'
, 'C': 'C:'
, 'D': 'C:Usbi_greendata'
, 'F': 'C:/Windows/Microsoft.NET/Framework64/v4.0.30319'
, 'G': 'G:'
, 'H': 'C:Users'
, '2': 'C:/Usb/iomega/Video'
, 'M': 'C:ProgramDataMicrosoftWindowsStart MenuPrograms'
, 'P': 'C:vimvim73plugin'
, 'S': 'C:UsersUserDocumentsShortcuts'
, 'T': 'C:Temp'
, 'U': 'C:Usb'
, 'V': 'C:vimvim73'
, 'W': 'C:/Usb/z_white'
, '3': 'C:/Temp/a1'
, 'a': 'C:Usbz_whiteAppsPortable'
, 'b': 'C:UsersUserDesktop'
, 'c': 'C:Usbz_whiteAppsPortableCmdUtils'
, 'd': 'C:UsersUserDocuments'
, 'e': 'C:/Users/User/Documents/emails'
, 'f': 'C:/Windows/Microsoft.NET/Framework64/v4.0.30319'
, 'g': 'G:'
, 'h': 'C:UsersUser'
, 'i': 'C:Usbi_green'
, 'm': 'C:/Users/User/AppData/Roaming/Microsoft/Windows/Start Menu/Programs'
, 'n': 'C:/Usb/i_green/data/Notes'
, 'p': 'C:Usbi_greendataProjects'
, 'r': 'C:repository'
, 's': 'C:UsersUserDocumentsShortcuts'
, 't': 'C:Temp'
, 'u': 'C:Usb'
, 'v': 'C:vimvim73'
, 'w': 'C:Windows'
, '8': 'C:/HP'
, '9': 'C:/HP/support'
, 'z': 'C:/Windows/Logs'}
, 'history': '[C:/Usb/z_white/Data/] [C:/Usb/z_white/Data/] [C:/Temp/allo] [C:/Temp/allo/a5/zzz/wwwwwwww]'
, 'favorites': '[C:/cygwin] [C:/cygwin/usr/share/vim/vim73]'
, 'cursorPos': {'C:/Temp/a1': '..'
, 'C:/Temp/a2': 'bclear.vim'
, 'C:/Temp/a3': '.'
, 'C:/Temp/a5': '..'
, 'C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Security and Protection': '..'
, 'C:/Usb/iomega/Documents/Emails': 'John_bak.dbx'
, 'C:/Usb/iomega/Documents/Orthodox (faire menage)/Early Church Fathers v.2.0': 'ecf02.hlp'}
, 'lastPath': 'C:/Usb/'}

添加新评论