【发布时间】:2016-08-16 22:52:52
【问题描述】:
所以我的config.fish 和init.vim 中有以下字符串:
鱼:eval sh ~/.config/fish/colors/base16-monokai.dark.sh
Vim:colorscheme base16-monokai
维姆:let g:airline_theme='base16_monokai'
我有以下 shell 脚本:
#!/bin/sh
theme=$1
background=$2
if [ -z '$theme' ]; then
echo "Please provide a theme name."
else
if [ -z '$background' ]; then
$background = 'dark'
fi
base16-builder -s $theme -t vim -b $background > ~/.config/nvim/colors/base16-$theme.vim &&
base16-builder -s $theme -t shell -b $background > ~/.config/fish/colors/base16-$theme.$background.sh &&
base16-builder -s $theme -t vim-airline -b $background > ~/.vim/plugged/vim-airline-themes/autoload/airline/themes/base16_$theme.vim
sed -i -e 's/foo/eval sh ~/.config/fish/colors/base16-$theme.$background.sh/g' ~/Developer/dotfiles/config.fish
sed -i -e 's/foo/colorscheme base16-$theme/g' ~/Developer/dotfiles/init.vim
sed -i -e 's/foo/let g:airline_theme='base16_$theme'/g' ~/Developer/dotfiles/init.vim
fi
基本上这个想法是脚本将生成使用此builder 传递的任何主题。
我尝试过引用此documentation,但我对正则表达式不是很熟练,所以如果有人能帮我一把,我将不胜感激。
我需要做的是,一旦生成脚本sed 将查找上述字符串并将主题替换为新生成的主题。
【问题讨论】: