-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sh
executable file
·51 lines (37 loc) · 1.57 KB
/
config.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
#!/usr/bin/env bash
SCRIPT_DIR=$(dirname "$(readlink -f "${0}")")
function overwrite_dotfile() {
# parameter
# $1 overwrite file
# $2 overwrited file
[[ "${1}" == "" || "${2}" == "" ]] && echo "Argument error" && exit 1
local overwrite_file="${1}"
local overwrited_file="${2}"
if [[ ! -f "${overwrited_file}" ]]; then
echo "${overwrited_file} not exist" && touch "${overwrited_file}"
fi
cat "${overwrite_file}" >"${overwrited_file}"
}
echo "${SCRIPT_DIR}"
echo "===== git config ====="
GIT_CONFIG_DIR="${SCRIPT_DIR}/git"
cat "${GIT_CONFIG_DIR}"/.gitconfig >"${HOME}"/.gitconfig
cat "${GIT_CONFIG_DIR}"/.gitignore >"${HOME}"/.gitignore
cat "${GIT_CONFIG_DIR}"/.global.gitignore >"${HOME}"/.global.gitignore
cat "${GIT_CONFIG_DIR}"/.xyz.gitconfig >"${HOME}"/.xyz.gitconfig
echo "===== zsh config ====="
cat "${SCRIPT_DIR}"/.bash_profile >"${HOME}"/.bash_profile
cat "${SCRIPT_DIR}"/.zshenv >"${HOME}"/.zshenv
cat "${SCRIPT_DIR}"/.zprofile >"${HOME}"/.zprofile
cat "${SCRIPT_DIR}"/.zshrc >"${HOME}"/.zshrc
cat "${SCRIPT_DIR}"/.zlogin >"${HOME}"/.zlogin
cat "${SCRIPT_DIR}"/.aliasrc >"${HOME}"/.aliasrc
cat "${SCRIPT_DIR}"/.functionrc >"${HOME}"/.functionrc
echo "===== bash config ====="
cat "${SCRIPT_DIR}"/.bashrc >"${HOME}"/.bashrc
echo "===== vim config ====="
overwrite_dotfile "${SCRIPT_DIR}/.vimrc" "${HOME}/.vimrc"
overwrite_dotfile "${SCRIPT_DIR}/.vscode.vimrc" "${HOME}/.vscode.vimrc"
rm -rf "${HOME}/.vim/" && cp -r .vim "${HOME}/.vim"
echo "===== neovim config ====="
rm -rf "${HOME}/.config/nvim" && cp -r .config/nvim "${HOME}/.config/nvim"