[一键到底]vim 安装与配置 solarized 主题与 Vundle 插件管理器脚本

2015-12-16 18:47:57 +08:00
 wikinee
#!/usr/bash
# maybe you are using zsh,fix the first line.
# Program:
# This program include:
# - add auto change vim colorscheme to solarized.
# - install Vundle.vim
# History:
# Dec.16, 2015 wikinee First release
echo "This script need wget, ssh, github-key, and unzip?"
echo "Sure you have those?Enter continue or quit: "
read base_env
if [ ! "$base_env" == "" ]; then
echo "Please install them and run script again."
else
vimrcPath="$HOME/.vimrc"
vimColorPath="$HOME/.vim/colors"
vimPluginPath="$HOME/.vim/bundle"
echo "===============test exist and touch file==============="
if [ ! -x "$vimrcPath" ]; then
touch "$vimrcPath"
fi

mkdir -p "$vimColorPath"
wget https://github.com/altercation/vim-colors-solarized/archive/master.zip && unzip master.zip && cp vim-colors-solarized-master/colors/solarized.vim $HOME/.vim/colors
rm -rf vim-colors-solarized-master
rm master.zip
cd $HOME

echo -e "\" ===============solarized settings=================" >> $vimrcPath
echo "Chose you scheme? y:light(default),n:dark"
read chose_scm
if [ "$chose_scm" == "n" ]; then
usr_chs_scm="dark"
fi

echo -e "syntax on\nset nu\nset t_Co=256\nlet g:solarized_termcolors=256\n\
set background=${usr_chs_scm:=light}\ncolorscheme solarized" >> $vimrcPath
fi
echo "finish solarized, install Vundle?Enter yes or other quit"
read Install_vundle
if [ ! "$Install_vundle"=="" ]; then
exit 0
else
echo "==================install Vundle==================="
mkdir -p "$vimPluginPath"
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
echo "\"==============Vundle Settings============="
echo -e "\n\
set nocompatible \" be iMproved, required\n
filetype off \" required\n
\" set the runtime path to include Vundle and initialize\n
set rtp+=~/.vim/bundle/Vundle.vim\n
call vundle#begin()\n
\" alternatively, pass a path where Vundle should install plugins\n
\"call vundle#begin('~/some/path/here')\n

\" let Vundle manage Vundle, required\n
Plugin 'gmarik/Vundle.vim'\n

\" The following are examples of different formats supported.\n
\" Keep Plugin commands between vundle#begin/end.\n
\" plugin on GitHub repo\n
Plugin 'tpope/vim-fugitive'\n
\" plugin from http://vim-scripts.org/vim/scripts.html\n
Plugin 'L9'\n
\" Git plugin not hosted on GitHub\n
Plugin 'git://git.wincent.com/command-t.git'\n
\" git repos on your local machine (i.e. when working on your own plugin)\n
Plugin 'file:///home/gmarik/path/to/plugin'\n
\" The sparkup vim script is in a subdirectory of this repo called vim.\n
\" Pass the path to set the runtimepath properly.\n
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}\n
\" Avoid a name conflict with L9\n
Plugin 'user/L9', {'name': 'newL9'}\n
\" All of your Plugins must be added before the following line\n
call vundle#end() \" required\n
filetype plugin indent on \" required\n
\" To ignore plugin indent changes, instead use:\n
\"filetype plugin on
\"
\" Brief help
\" :PluginList - list configured plugins
\" :PluginInstall(!) - install (update) plugins
\" :PluginSearch(!) foo - search (or refresh cache first) for foo
\" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
\"
\" see :h vundle for more details or wiki for FAQ
\" Put your non-Plugin stuff after this line" >> $vimrcPath

echo "===================Finish====================="
fi
exit 0
5060 次点击
所在节点    Vim
4 条回复
timothyye
2015-12-16 19:14:40 +08:00
放 gist 吧, lz
wikinee
2015-12-16 20:56:22 +08:00
@timothyye git 节点吗?
maemual
2015-12-16 21:02:08 +08:00
timothyye
2015-12-16 21:11:04 +08:00
@wikinee 放 gist 上,这样看起来更方便,收藏也方便

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/244001

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX