-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·238 lines (191 loc) · 8.41 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/bin/bash
echo -ne "\x1B[00;34m\nWelcome!\n"
echo -ne "This will install fbeeper's MacVim package in your system! \x1B[00m\n"
echo -ne "***************************************************************\n\n"
current_path="`pwd`"
confirm () {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response
in [yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
################################################################################
# Check for MacVim, install if missing. #
# Via Homebrew or compiling it... #
################################################################################
tmpdownload="$HOME/Downloads"
brew_cmd=`which brew`
ruby_cmd=`which ruby`
clng_cmd=`which clang`
mvim_cmd=`find /Applications -name "MacVim.app" -maxdepth 1`
mvim_internals="/Applications/MacVim.app/Contents/Resources/vim"
echo -ne "Checking for installed MacVim..."
if [[ ! -d $mvim_cmd ]]
then
echo -ne " \x1B[00;31mNO\x1B[00m\n"
echo -ne "Choose...\n"
echo -ne " *) Download the latest binary snapshot (default in 5 seconds)\n"
echo -ne " 1) Compile from source\n"
read -t 5 n
case $n in
1)
if [[ -f $clng_cmd ]]
then
echo -ne "Compiling MacVim (by Björn Winckler)"
git clone git://github.com/b4winckler/macvim.git $tmpdownload/macvim
cd $tmpdownload/macvim/src
CC=clang ./configure --with-features=huge \
--with-tlib=ncurses \
--enable-multibyte \
--enable-perlinterp \
--enable-pythoninterp \
--enable-rubyinterp \
--with-ruby-command=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby \
--enable-cscope \
--with-macarchs=`uname -m` $@
echo -ne "\nKeep Calm! this will take a while..."
make
cd MacVim/build/Release
cp -R MacVim.app /Applications/MacVim.app
mv mvim /usr/local/bin/
rm -rf $tmpdownload/macvim
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
else
echo -ne "\x1B[00;31mYou need XCode command line tools installed to proceed. Leaving!\n\x1B[00m"
exit -1
fi
;;
*)
cd $tmpdownload
curl -L "https://github.com/downloads/b4winckler/macvim/MacVim-snapshot-65.tbz" -o macvim.tbz
tar -xjf macvim.tbz
cd MacVim-snapshot-65
mv MacVim.app /Applications/
mv mvim /usr/local/bin/
cd ..
rm -rf macvim.tbz MacVim-snapshot-64
;;
esac
else
echo -ne " \x1B[00;32mYES\x1B[00m\n"
echo -n "Backing up your previous configs..."
for i in $mvim_internals/runtime/bundle $mvim_internals/runtime/autoload/pathogen.vim $mvim_internals/vimrc $mvim_internals/gvimrc;
do
[ -e $i ] && mv $i $i.old;
done
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
fi
################################################################################
# Download and install confs and plugins #
################################################################################
echo -e "\n0) \x1B[00;34mInstalling Solarized Terminal theme\x1B[00m"
echo " (by Ethan Schoonover + Tomislav Filipčić)"
echo " Includes some personal customizations:"
echo -e "\t- Menlo patched for powerline (by Steve Losh)"
echo -e "\t- Shortcut to go to line ends fn + <- / ->"
echo -e "\t- Only visual bell alert"
echo " *** Vim needs this to render the theme properly on the Terminal"
git clone git://gist.github.com/1627888.git $tmpdownload/menlofp
unzip $tmpdownload/menlofp/Menlo-ForPowerline.ttc.zip
cp Menlo-ForPowerline.ttc ~/Library/Fonts/Menlo-ForPowerline.ttc
rm -rf $tmpdownload/menlofp
open "$current_path"/fSolarized.terminal
osascript -e 'tell application "Terminal"' -e 'close front window' -e 'end tell'
osascript -e 'tell application "Terminal" to set default settings to settings set "fSolarized"'
osascript -e 'tell application "Terminal" to set current settings of front window to settings set "fSolarized"'
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n1) \x1B[00;34mMacVim has all config files in the bundle, but most Vim"
echo -e " users come from Linux, so I've added some handy symlinks:\x1B[00m"
echo -e "\t/Applications/MacVim.app/"
echo -e "\t\tContents/Resources/vim/runtime/ <-- ~/.vim/"
echo -e "\t\tContents/Resources/vim/runtime/vimrc <-- ~/.vimrc"
ln -s $mvim_internals/runtime/ ~/.vim
ln -s $mvim_internals/vimrc ~/.vimrc
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n2) \x1B[00;34mInstall plugins:\x1B[00m\n"
mkdir -p ~/.vim/autoload ~/.vim/bundle
echo -e " * \x1B[00;36mpathogen.vim\x1B[00m (super easy plugin management)"
echo " by Tim Pope"
curl -Sso ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
##cd $tmpdownload/
##git clone git://github.com/tpope/vim-pathogen.git
##cp $tmpdownload/autoload/pathogen.vim ~/.vim/autoload/
##rm -rf $tmpdownload/auto
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
cd ~/.vim/bundle
echo -e "\n * \x1B[00;36mfugitive.vim\x1B[00m (nice git integration)"
echo " by Tim Pope"
git clone git://github.com/tpope/vim-fugitive.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mGitv\x1B[00m ('gitk clone' plugin for fugitive)"
echo " by Greg Sexton"
git clone git://github.com/gregsexton/gitv.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mSolarized\x1B[00m (pleasant colorscheme)"
echo " by Ethan Schoonover"
git clone git://github.com/altercation/vim-colors-solarized.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mNERDTree\x1B[00m (useful file system explorer)"
echo " by Martin Grenfell"
git clone git://github.com/scrooloose/nerdtree.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mNERDCommenter\x1B[00m (comment your code easily ,cl ,cu)"
echo " by Martin Grenfell (again :P)"
git clone git://github.com/scrooloose/nerdcommenter.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mPowerline\x1B[00m (cool statusline replacement)"
echo " by Kim Silkebækken"
git clone git://github.com/Lokaltog/vim-powerline.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mSignature\x1B[00m (pimped marks and signs)"
echo " by kshenoy"
git clone git://github.com/kshenoy/vim-signature.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mClang complete\x1B[00m (C/C++ completion using clang)"
echo " by Xavier Deguillard"
git clone git://github.com/Rip-Rip/clang_complete.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mSupertab\x1B[00m (handy addition for text completion)"
echo " by Eric Van Dewoestine"
git clone git://github.com/ervandew/supertab.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mSnipMate\x1B[00m (snippets gallore!)"
echo " originally by Michael Sanders but"
echo " current package (and dependencies)"
echo " by Rok Garbas (Tom Link, Marc Weber, Honza Pokorny)"
##git://github.com/msanders/snipmate.vim.git
git clone git://github.com/garbas/vim-snipmate.git
git clone git://github.com/tomtom/tlib_vim.git
git clone git://github.com/MarcWeber/vim-addon-mw-utils.git
git clone git://github.com/honza/snipmate-snippets.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mGundo\x1B[00m (Looking for Lion's file versioning?)"
echo " by Steve Losh"
git clone http://github.com/sjl/gundo.vim.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n * \x1B[00;36mOpenGL and GLSL syntax hl\x1B[00m (the missing highlighting)"
echo " by Marc Costa"
git clone git://github.com/beyondmarc/opengl.vim.git
git clone git://github.com/beyondmarc/glsl.vim.git
echo -ne " \x1B[00;32mDONE\x1B[00m\n"
echo -e "\n3) \x1B[00;34mCustomizing vim\n\x1B[00m"
echo -e " * \x1B[00;36mPatching MacVim tab-switching shortcuts\x1B[00m"
echo " to switch tabs to browser-like Ctrl+Tab / Ctrl+Shift+Tab"
echo " This is a workaround: mapping <C-t> in .vimrc is not working"
patch ~/.vim/menu.vim < "$current_path"/menu.patch
echo -e "\n * \x1B[00;36mSetting up a pimped .vimrc\x1B[00m"
echo " assembled by me (Ferran Poveda)"
cp -f "$current_path"/vimrc $mvim_internals/vimrc
echo -en "\n4) \x1B[00;34mCleaning cache, generating help tags, finishing...\x1B[00m"
vim +PowerlineClearCache +Helptags +q
cd "$current_path"
echo -ne " \x1B[00;32m100%! Enjoy!\x1B[00m\n"
echo -e "\n\x1B[00;33mMore info in the README file, or at \x1B[00;34mhttp://github.com/fbeeper/fMacVim\x1B[00m"
echo -e "\x1B[00;33mAll comments, ideas, code or/and cheers will be appreciated!\x1B[00m\n"