Ⅰ. 插件描述
iptables-save/restore syntax highlighterⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'eiginn/iptables-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'eiginn/iptables-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'eiginn/iptables-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/eiginn/iptables-vim
Ⅳ. 文档说明
This was a mirror of http://www.vim.org/scripts/script.php?script_id=1425
and has some updated keyword highlighting
updating the syntax highlighting from man pages
longopts "iptablesLongParam"
man iptables-extensions | grep -oP -- '--\S*' | sed 's/[,.]//g' | sort | uniq | sed ':a;N;$!ba;s/\n/ /g' | fold -s | sed -e 's/^/ \\ /'
man iptables | grep -oP -- '--\S*' | grep -Pv -- '--(append|delete|insert|replace|list|flush|zero|new-chain|delete-chain|policy|rename-chain)' | \
sed 's/[,.]//g' | sort | uniq | sed ':a;N;$!ba;s/\n/ /g' | fold -s | sed -e 's/^/ \\ /'
man xtables-addons | grep -oP -- '--\S*' | sed 's/[,.]//g' | sort | uniq | sed ':a;N;$!ba;s/\n/ /g' | fold -s | sed -e 's/^/ \\ /'modules and targets "iptablesTarget" and "iptablesModuleName"
you could use this:
#!/bin/bash
declare -a modules
declare -a targets
for i in $(
zgrep -oP '(?<=\.SS )\S*' /usr/share/man/man8/iptables-extensions.8.gz
zgrep -oP '(?<=\.SS )\S*' /usr/share/man/man8/xtables-addons.8.gz
); \
do if [[ "$i" =~ [A-Z] ]]; then
targets+=("$i")
else
modules+=("$i")
fi
done
echo modules:
echo ${modules[@]} | fold -s | sed -e 's/^/ \\ /'
echo targets:
echo ${targets[@]} | fold -s | sed -e 's/^/ \\ /'but it assumes that the man page is formatted correctly (hint: its not)