From 60a20b79afd2fe74c84e4b5c5f9c2a822f7e66de Mon Sep 17 00:00:00 2001 From: BruceGui Date: Fri, 6 Jul 2018 20:13:12 +0800 Subject: [PATCH] some tools --- README.md | 15 +++++++++++---- tools/install.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 tools/install.sh diff --git a/README.md b/README.md index c976773..4766532 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,21 @@ # VIM 插件管理系统及配置 -> 自己使用的VIM插件管理系统和配置文件,方便在各个平台实现同步更新。参考链接[VIM-PLUG](https://github.com/junegunn/vim-plug) +> 自己使用的VIM插件管理系统和配置文件,方便在各个平台实现同步更新。 -## 基本安装 +## 手动安装 ```bash -git clone git@github.com:BruceGui/selfvimplug.git -cd selfvimplug +git clone git@github.com:BruceGui/vimconfplug.git +cd vimconfplug cp -r autoload ~/.vim/ cp .vimrc ~/ ``` 然后打开VIM,使用:PlugInstall安装配置在.vimrc文件中的插件。 + +## 参考链接 +[VIM-PLUG](https://github.com/junegunn/vim-plug) + +[OH-MY-VIM](https://github.com/liangxianzhe/oh-my-vim) + +[OH-MY-ZSH](https://github.com/robbyrussell/oh-my-zsh) diff --git a/tools/install.sh b/tools/install.sh new file mode 100644 index 0000000..dd5682c --- /dev/null +++ b/tools/install.sh @@ -0,0 +1,49 @@ +# 自动安装脚本 + +main() { + + if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) + fi + + if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" + else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + NORMAL="" + fi + + set -e + + if [ ! -n "$VIM_PLUG_CONF" ]; then + VIM_PLUG_CONF=~/.vimplugconf + fi + + if [ -d "$VIM_PLUG_CONF" ]; then + printf "${RED}You already have vim plug conf installed.${BLOD}\n" + exit + fi + + printf "${BLUE}Cloning vim plug conf...${NORMAL}\n" + command -v git >/dev/null 2>&1 || { + echo "Error: git is not installed" + exit 1 + } + + env git clone --depth=1 git@github.com:BruceGui/vimconfplug.git $VIM_PLUG_CONF || { + printf "Error: git clone of vim plug conf repo failed\n" + exit 1 + } + +} + +main \ No newline at end of file