-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
112 lines (91 loc) · 2.95 KB
/
setup.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
#!/bin/bash
# Check if Zsh is installed, if not, install it.
if ! which zsh > /dev/null; then
echo "Installing Zsh..."
sudo apt install zsh
fi
# Check if zplug is installed, if not, install it.
if [ ! -d ~/.zplug ]; then
echo "Installing zplug..."
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
# Set Zsh as the default shell
sudo chsh -s $(which zsh) $(whoami)
# Check if Neovim is installed, if not, install it.
if ! which nvim > /dev/null; then
echo "Installing Neovim..."
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage --appimage-extract
./squashfs-root/AppRun --version
# Optional: exposing nvim globally.
sudo mv squashfs-root /
sudo ln -s /squashfs-root/AppRun /usr/bin/nvim
# Clone the NvChad repository.
mv ~/.config/nvim ~/.config/nvim.bak
rm -rf ~/.local/share/nvim
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1
fi
# Create or overwrite the .zshrc file.
cat > ~/.zshrc <<EOF
# =====================
# Z-plug Plugin Manager
# =====================
# Source Z-plug
source ~/.zplug/init.zsh
# Plugins
zplug 'romkatv/powerlevel10k', as:theme, depth:1
zplug 'zsh-users/zsh-autosuggestions'
zplug 'zsh-users/zsh-history-substring-search'
zplug 'marlonrichert/zsh-autocomplete'
zplug 'hlissner/zsh-autopair'
# Check and install plugins if necessary
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo
zplug install
fi
fi
# Load plugins
zplug load
# =====================
# Keybindings and History
# =====================
# Keybindings for history substring search
bindkey "\$terminfo[kcuu1]" history-substring-search-up
bindkey "\$terminfo[kcud1]" history-substring-search-down
# History settings
SAVEHIST=1000
export HISTFILE=~/.zsh_history
setopt share_history
# =====================
# Custom Aliases and Functions
# =====================
alias rm='rm -r'
alias cp='cp -r'
alias ls='ls -hlF --color=auto'
alias ..='cd ../'
alias tree="tree -alI 'node_modules|.git'"
alias grep='grep --color=always'
alias grepFind='grep --exclude-dir=node_modules -nr . -e'
alias mkdir='mkdir -p'
alias vim='nvim'
# =====================
# Powerlevel10k Customization
# =====================
# Load Powerlevel10k instant prompt
if [[ -r "\${XDG_CACHE_HOME:-\$HOME/.cache}/p10k-instant-prompt-\${(%):-%n}.zsh" ]]; then
source "\${XDG_CACHE_HOME:-\$HOME/.cache}/p10k-instant-prompt-\${(%):-%n}.zsh"
fi
# To customize the prompt, run \`p10k configure\` or edit ~/.p10k.zsh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# =====================
# Additional Customizations
# =====================
# Add your additional customizations below this section
# Example: Export environment variables
# export MY_VARIABLE="example_value"
EOF
# Inform the user
echo "Zsh configuration and dependencies installed. Please restart your shell."