这是我自己用的,更新 rime squirrel 输入法配色的方案
* theme_file 是[squirrel.custom.yaml](
https://gist.github.com/lotem/2290714)的路径* .rimetheme_args 是 squirrel 的配色名词,需要自己写下配色方案的名称
mac 上的 sed 我懒得折腾了,又安装了个 gsed
```zsh
function rimetheme() {
if [ ! $1 ]; then
start_line=`awk '/系統默認色系 /{print NR}' ${theme_file}`
gsed -n "${start_line},$ p" ${theme_file}
else
theme=" style/color_scheme: $1 # 配色方案"
scheme_line=`awk '/color_scheme:/{print NR}' ${theme_file}`
gsed -i "${scheme_line}c\ ${theme}" ${theme_file}
echo "更新配色方案: $1"
Squirrel --reload
fi
}
_rimetheme()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(grep "$cur" ~/.rimetheme_args) )
}
complete -F _rimetheme rimetheme
```