forked from mxaddict/dotfiles_archive_001
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·171 lines (130 loc) · 4.26 KB
/
install
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
#!/bin/bash
# Set GIT to use colors
git config --global color.ui auto
git config --global rebase.instructionFormat "(%an <%ae>) %s"
DOT_FILES_BRANCH="${DOT_FILES_BRANCH:-master}"
# Load up some default values from the environment!
GIT_NAME_CURRENT=$(git config --global user.name)
GIT_EMAIL_CURRENT=$(git config --global user.email)
# Ask what name to use?
printf "Git Name [$GIT_NAME_CURRENT]: "
read GIT_NAME_NEW
# Ask what email to use?
printf "Git Email [$GIT_EMAIL_CURRENT]: "
read GIT_EMAIL_NEW
# Ask if we want to update the plugins...
printf "Update/Install Plugins? [Y/n]: "
read UPDATE_PLUGINS
# Save the GIT_NAME
if [ "$GIT_NAME_NEW" != "" ]
then
git config --global user.name "$GIT_NAME_NEW"
fi
# Save the GIT_EMAIL
if [ "$GIT_EMAIL_NEW" != "" ]
then
git config --global user.email "$GIT_EMAIL_NEW"
fi
# Where is the temp DIR for dotfiles?
DOTFILES_TMP="${HOME}/.dotfiles"
# Where do we have the XDG_CONFIG_HOME?
XDG_CONFIG_HOME="${HOME}/.config"
FONTS_DIRECTORY=${HOME}/.local/share/fonts
if [ -d .git ]; then
REPOSITORY="$(basename `git rev-parse --show-toplevel`)"
fi
# Create the XDG_CONFIG_HOME DIRECTORY
mkdir -p ${XDG_CONFIG_HOME}
# Check if we're not currently in a dotfiles repo
if [ "$REPOSITORY" != "dotfiles-1" ];
then
# Check if we already have a copy
if [ ! -d $DOTFILES_TMP ]
then
# Now clone the repo...
git clone https://github.com/ryeballar/dotfiles-1.git $DOTFILES_TMP
fi
cd $DOTFILES_TMP && git fetch && git checkout -f origin/$DOT_FILES_BRANCH
else
# Replace dotfiles directory with the current directory
DOTFILES_TMP=`pwd`
fi
# Check if we have ~/.vimrc.d
if [ -d ~/.vimrc.d ]
then
# Remove the OLD .vimrc.d/ DIR from home DIR
rm -r ~/.vimrc.d
fi
# Copy the .vimrc.d/ DIR to home DIR
cp -r $DOTFILES_TMP/.vimrc.d ~/
# Copy all our custom files!
cat $DOTFILES_TMP/.bash_profile > ~/.bash_profile
cat $DOTFILES_TMP/.bashrc > ~/.bashrc
cat $DOTFILES_TMP/.zsh_profile > ~/.zsh_profile
cat $DOTFILES_TMP/.zshrc > ~/.zshrc
cat $DOTFILES_TMP/.shrc > ~/.shrc
cat $DOTFILES_TMP/.nvmprofilerc > ~/.nvmprofilerc
cat $DOTFILES_TMP/coc-settings.json > ~/.config/nvim/coc-settings.json
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
if [ ! -f ~/.nvmrc ] || [ "$(cat ~/.nvmrc | xargs)" == "" ];
then
nvm install --lts
DOTFILES_NODE_VERSION=$(nvm current)
nvm alias default $DOTFILES_NODE_VERSION
echo $DOTFILES_NODE_VERSION > ~/.nvmrc
fi
if [[ ! "$(cat ~/.bashrc)" =~ 'nvmprofilerc' ]]; then
echo "" >> ~/.bashrc
echo "source ~/.nvmprofilerc" >> ~/.bashrc
fi
source ~/.bashrc
nvm use default
# Check if our plugin manager is installed
if [ ! -f ~/.vim/autoload/plug.vim ]
then
# Install our plugin manager
printf "Installing our plugin manager\n"
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# Setup the vimrc for temporary use!
echo "source ~/.vimrc.d/vimplug.vim" > ~/.vimrc
# Make some symlinks...
if [ ! -h $XDG_CONFIG_HOME/nvim ]
then
ln -s ~/.vim $XDG_CONFIG_HOME/nvim
fi
# Make some symlinks...
if [ ! -h $XDG_CONFIG_HOME/nvim/init.vim ]
then
ln -s ~/.vimrc $XDG_CONFIG_HOME/nvim/init.vim
fi
# Check if we even want to install/update plugins
if [ "$UPDATE_PLUGINS" != "n" ]
then
# Install Vim Plugins
printf "Installing Vim Plugins, Will take a while depending on connection speed!\n"
# Create fonts directory if it doesn't exist
mkdir -p $FONTS_DIRECTORY
# Download font
curl -sL https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v2.1.0/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Mono.otf > "${FONTS_DIRECTORY}/Droid Sans Mono Nerd Font Complete Mono.otf"
# update font cache
fc-cache -f -v
vim +PlugUpgrade +PlugClean! +PlugUpdate +qall
fi
cat $DOTFILES_TMP/.vimrc > ~/.vimrc
cat $DOTFILES_TMP/.tmux.conf > ~/.tmux.conf
cat $DOTFILES_TMP/.tmuxline.conf > ~/.tmuxline.conf
# Check if we have promptline setup already
if [ -d ~/.vim/plugged/promptline.vim ]
then
#Setup Promptline!
vim +"PromptlineSnapshot! ~/.promptline.sh lightline" +qall
fi
# Check if we have tmuxline setup already
if [ -d ~/.vim/plugged/tmuxline.vim ]
then
# Setup Tmuxline!
vim +Tmuxline +"TmuxlineSnapshot! ~/.tmuxline.conf" +qall
fi
# Install done! WEW!
printf "Install DONE! WEW!\n"