增加更新脚本
This commit is contained in:
parent
6facb96b1f
commit
efc07025a6
12
README.md
12
README.md
@ -32,6 +32,12 @@ An automatic configuration program for vim
|
||||
|
||||
为防止vimplus显示乱码,需设置mac终端字体为`Droid Sans Mono Nerd Font`。
|
||||
|
||||
#### 更新vimplus
|
||||
|
||||
cd ~/.vimplus
|
||||
./update.sh
|
||||
|
||||
|
||||
### Linux 64-bit
|
||||
|
||||
#### 支持以下发行版
|
||||
@ -67,6 +73,12 @@ An automatic configuration program for vim
|
||||
为防止vimplus显示乱码,需设置linux终端字体为`Droid Sans Mono Nerd Font`。
|
||||
|
||||
|
||||
#### 更新vimplus
|
||||
|
||||
cd ~/.vimplus
|
||||
./update.sh
|
||||
|
||||
|
||||
#### 多用户支持
|
||||
|
||||
将vimplus在某个用户下安装好后,若需要在其他用户也能够使用vimplus,则执行
|
||||
|
||||
86
update.sh
Executable file
86
update.sh
Executable file
@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 获取平台类型,mac还是linux平台
|
||||
function get_platform_type()
|
||||
{
|
||||
echo $(uname)
|
||||
}
|
||||
|
||||
# 更新mac平台字体
|
||||
function update_fonts_on_mac()
|
||||
{
|
||||
rm -rf ~/Library/Fonts/Droid\ Sans\ Mono\ Nerd\ Font\ Complete.otf
|
||||
cp ./fonts/Droid\ Sans\ Mono\ Nerd\ Font\ Complete.otf ~/Library/Fonts
|
||||
}
|
||||
|
||||
# 更新linux平台字体
|
||||
function update_fonts_on_linux()
|
||||
{
|
||||
mkdir -p ~/.local/share/fonts
|
||||
rm -rf ~/.local/share/fonts/Droid\ Sans\ Mono\ Nerd\ Font\ Complete.otf
|
||||
cp ./fonts/Droid\ Sans\ Mono\ Nerd\ Font\ Complete.otf ~/.local/share/fonts
|
||||
|
||||
fc-cache -vf ~/.local/share/fonts
|
||||
}
|
||||
|
||||
# 更新vim插件
|
||||
function update_vim_plugin()
|
||||
{
|
||||
vim -c "PlugUpdate" -c "q" -c "q"
|
||||
}
|
||||
|
||||
# 打印logo
|
||||
function print_logo()
|
||||
{
|
||||
color="$(tput setaf 6)"
|
||||
normal="$(tput sgr0)"
|
||||
printf "${color}"
|
||||
echo ' __ __ '
|
||||
echo '__ __/_/___ ___ ____ / /_ _______ '
|
||||
echo '\ \ / / / __ `__ \/ __ \/ / / / / ___/ '
|
||||
echo ' \ V / / / / / / / /_/ / / /_/ (__ ) '
|
||||
echo ' \_/_/_/ /_/ /_/ ,___/_/\____/____/ '
|
||||
echo ' /_/ ...is now updated!'
|
||||
echo ''
|
||||
echo ''
|
||||
echo 'Just enjoy it!'
|
||||
echo 'p.s. Follow me at https://github.com/chxuan.'
|
||||
echo ''
|
||||
printf "${normal}"
|
||||
}
|
||||
|
||||
# 在mac更新vimplus
|
||||
function update_vimplus_on_mac()
|
||||
{
|
||||
git pull origin master
|
||||
update_fonts_on_mac
|
||||
update_vim_plugin
|
||||
print_logo
|
||||
}
|
||||
|
||||
# 在linux更新vimplus
|
||||
function update_vimplus_on_linux()
|
||||
{
|
||||
git pull origin master
|
||||
update_fonts_on_linux
|
||||
update_vim_plugin
|
||||
print_logo
|
||||
}
|
||||
|
||||
# main函数
|
||||
function main()
|
||||
{
|
||||
type=`get_platform_type`
|
||||
echo "Platform type: "${type}
|
||||
|
||||
if [ ${type} == "Darwin" ]; then
|
||||
update_vimplus_on_mac
|
||||
elif [ ${type} == "Linux" ]; then
|
||||
update_vimplus_on_linux
|
||||
else
|
||||
echo "Not support platform type: "${type}
|
||||
fi
|
||||
}
|
||||
|
||||
# 调用main函数
|
||||
main
|
||||
Loading…
Reference in New Issue
Block a user