Compare commits

...

3 Commits

5 changed files with 179 additions and 17 deletions

17
.zshrc
View File

@@ -1,3 +1,8 @@
# Homebrew initialization
if [ -d '/opt/homebrew' ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n] # Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below. # confirmations, etc.) must go above this block; everything else may go below.
@@ -68,7 +73,6 @@ plugins=(
systemd systemd
k k
extract extract
z
sudo sudo
fzf-tab fzf-tab
# web-search # web-search
@@ -137,6 +141,12 @@ plugins=(
fpath+=$ZSH/custom/plugins/zsh-completions/src fpath+=$ZSH/custom/plugins/zsh-completions/src
# Setup Homebrew completions for macOS
if [[ "$OSTYPE" == "darwin"* ]] && command -v brew &> /dev/null; then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
fi
autoload -U compinit && compinit -C -d ~/.cache/zsh/.zcompdump # zsh-completions autoload -U compinit && compinit -C -d ~/.cache/zsh/.zcompdump # zsh-completions
# autoload bashcompinit # bash completions # autoload bashcompinit # bash completions
# bashcompinit # bashcompinit
@@ -150,7 +160,7 @@ alias myip="wget -qO- https://wtfismyip.com/text" # quickly show external ip add
alias l="ls --hyperlink=auto -lAhrtF" # show all except . .. , sort by recent, / at the end of folders, clickable alias l="ls --hyperlink=auto -lAhrtF" # show all except . .. , sort by recent, / at the end of folders, clickable
alias e="exit" alias e="exit"
alias ip="ip --color=auto" alias ip="ip --color=auto"
## Install EZA to use this. The better ls command ## EZA - the better ls command
alias a='eza -la --git --colour-scale all -g --smart-group --icons always --hyperlink' # the new ls; add --hyperlink if you like alias a='eza -la --git --colour-scale all -g --smart-group --icons always --hyperlink' # the new ls; add --hyperlink if you like
alias aa='eza -la --git --colour-scale all -g --smart-group --icons always -s modified -r --hyperlink' # sort by new alias aa='eza -la --git --colour-scale all -g --smart-group --icons always -s modified -r --hyperlink' # sort by new
@@ -215,4 +225,7 @@ source $ZSH/oh-my-zsh.sh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPS="--extended" export FZF_DEFAULT_OPS="--extended"
# Initialize zoxide (smarter cd command)
eval "$(zoxide init zsh)"
alias k="k -h" # show human readable file sizes, in kb, mb etc alias k="k -h" # show human readable file sizes, in kb, mb etc

View File

@@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# Save the original working directory
ORIGINAL_DIR="$(pwd)"
# Flags to determine if the arguments were passed # Flags to determine if the arguments were passed
cp_hist_flag=false cp_hist_flag=false
noninteractive_flag=false noninteractive_flag=false
@@ -48,35 +51,123 @@ install_packages() {
echo "Homebrew is not installed. Installing Homebrew..." echo "Homebrew is not installed. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi fi
brew install zsh git wget fontconfig brew install zsh git wget fontconfig eza zoxide
;; ;;
ubuntu|debian) ubuntu|debian)
sudo apt-get update sudo apt-get update
sudo apt-get install -y zsh git wget fontconfig sudo apt-get install -y zsh git wget fontconfig
# Install eza if not already installed
if ! command -v eza &> /dev/null; then
echo "Installing eza..."
# Install GPG if not present
if ! command -v gpg &> /dev/null; then
sudo apt install -y gpg
fi
# Add eza repository and install
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza
fi
# Install zoxide if not already installed
if ! command -v zoxide &> /dev/null; then
echo "Installing zoxide..."
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
fi
;; ;;
fedora) fedora)
sudo dnf install -y zsh git wget fontconfig sudo dnf install -y zsh git wget fontconfig
# Install eza if not already installed
if ! command -v eza &> /dev/null; then
echo "Installing eza..."
# For Fedora versions prior to 42
if ! sudo dnf install -y eza; then
echo "eza not available in official repository, installing from cargo..."
if command -v cargo &> /dev/null; then
cargo install eza
else
echo "cargo not found. Please install Rust/cargo first or install eza manually."
fi
fi
fi
# Install zoxide if not already installed
if ! command -v zoxide &> /dev/null; then
echo "Installing zoxide..."
# zoxide is available in Fedora 32+
if ! sudo dnf install -y zoxide; then
echo "zoxide not available in official repository, installing from install script..."
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
fi
fi
;; ;;
centos|rhel) centos|rhel)
sudo yum install -y zsh git wget fontconfig sudo yum install -y zsh git wget fontconfig
# Install eza if not already installed
if ! command -v eza &> /dev/null; then
echo "Installing eza..."
# Install from cargo as primary method
if command -v cargo &> /dev/null; then
cargo install eza
else
echo "cargo not found. Installing from binary..."
wget -c https://github.com/eza-community/eza/releases/latest/download/eza_x86_64-unknown-linux-gnu.tar.gz -O - | tar xz
sudo chmod +x eza
sudo chown root:root eza
sudo mv eza /usr/local/bin/eza
fi
fi
# Install zoxide if not already installed
if ! command -v zoxide &> /dev/null; then
echo "Installing zoxide..."
# Try dnf first (RHEL 8+ and CentOS Stream have zoxide in EPEL), fallback to install script
if ! (command -v dnf &> /dev/null && sudo dnf install -y zoxide); then
echo "Installing zoxide from install script..."
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
fi
fi
;; ;;
arch|manjaro) arch|manjaro)
sudo pacman -Syu --noconfirm zsh git wget fontconfig sudo pacman -Syu --noconfirm zsh git wget fontconfig eza zoxide
;; ;;
*) *)
echo "Unsupported operating system. Please install zsh, git, wget, and fontconfig manually." echo "Unsupported operating system. Please install zsh, git, wget, and fontconfig manually."
# Try to install eza from binary for unsupported systems
if ! command -v eza &> /dev/null; then
echo "Installing eza from binary..."
wget -c https://github.com/eza-community/eza/releases/latest/download/eza_x86_64-unknown-linux-gnu.tar.gz -O - | tar xz
sudo chmod +x eza
sudo chown root:root eza
sudo mv eza /usr/local/bin/eza
fi
# Try to install zoxide for unsupported systems
if ! command -v zoxide &> /dev/null; then
echo "Installing zoxide from install script..."
curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
fi
exit 1 exit 1
;; ;;
esac esac
} }
# Check if required packages are installed, if not, install them # Check if required packages are installed, if not, install them
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null; then if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null && command -v eza &> /dev/null && command -v zoxide &> /dev/null; then
echo -e "ZSH, Git, wget, and fontconfig are already installed\n" echo -e "ZSH, Git, wget, fontconfig, eza, and zoxide are already installed\n"
else else
echo "Installing required packages..." echo "Installing required packages..."
install_packages install_packages
echo -e "zsh, wget, git, and fontconfig Installed\n" echo -e "zsh, wget, git, fontconfig, eza, and zoxide Installed\n"
fi fi
if [ -f ~/.gitconfig.backup ]; then if [ -f ~/.gitconfig.backup ]; then
@@ -128,25 +219,25 @@ if [ -f ~/.zcompdump ]; then
fi fi
if [ -d $ZSH/plugins/zsh-autosuggestions ]; then if [ -d $ZSH/plugins/zsh-autosuggestions ]; then
cd $ZSH/plugins/zsh-autosuggestions && git pull git -C $ZSH/plugins/zsh-autosuggestions pull
else else
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions $ZSH/plugins/zsh-autosuggestions git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions $ZSH/plugins/zsh-autosuggestions
fi fi
if [ -d $ZSH/custom/plugins/zsh-syntax-highlighting ]; then if [ -d $ZSH/custom/plugins/zsh-syntax-highlighting ]; then
cd $ZSH/custom/plugins/zsh-syntax-highlighting && git pull git -C $ZSH/custom/plugins/zsh-syntax-highlighting pull
else else
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting
fi fi
if [ -d $ZSH/custom/plugins/zsh-completions ]; then if [ -d $ZSH/custom/plugins/zsh-completions ]; then
cd $ZSH/custom/plugins/zsh-completions && git pull git -C $ZSH/custom/plugins/zsh-completions pull
else else
git clone --depth=1 https://github.com/zsh-users/zsh-completions $ZSH/custom/plugins/zsh-completions git clone --depth=1 https://github.com/zsh-users/zsh-completions $ZSH/custom/plugins/zsh-completions
fi fi
if [ -d $ZSH/custom/plugins/zsh-history-substring-search ]; then if [ -d $ZSH/custom/plugins/zsh-history-substring-search ]; then
cd $ZSH/custom/plugins/zsh-history-substring-search && git pull git -C $ZSH/custom/plugins/zsh-history-substring-search pull
else else
git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search $ZSH/custom/plugins/zsh-history-substring-search git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search $ZSH/custom/plugins/zsh-history-substring-search
fi fi
@@ -163,14 +254,14 @@ wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/pa
fc-cache -fv ~/.fonts fc-cache -fv ~/.fonts
if [ -d $ZSH/custom/themes/powerlevel10k ]; then if [ -d $ZSH/custom/themes/powerlevel10k ]; then
cd $ZSH/custom/themes/powerlevel10k && git pull git -C $ZSH/custom/themes/powerlevel10k pull
else else
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH/custom/themes/powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH/custom/themes/powerlevel10k
fi fi
curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s p10k curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s p10k
if [ -d ~/.fzf ]; then if [ -d ~/.fzf ]; then
cd ~/.fzf && git pull git -C ~/.fzf pull
~/.fzf/install --all --key-bindings --completion --no-update-rc ~/.fzf/install --all --key-bindings --completion --no-update-rc
else else
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
@@ -178,17 +269,28 @@ else
fi fi
if [ -d $ZSH/custom/plugins/k ]; then if [ -d $ZSH/custom/plugins/k ]; then
cd $ZSH/custom/plugins/k && git pull git -C $ZSH/custom/plugins/k pull
else else
git clone --depth 1 https://github.com/supercrabtree/k $ZSH/custom/plugins/k git clone --depth 1 https://github.com/supercrabtree/k $ZSH/custom/plugins/k
fi fi
if [ -d $ZSH/custom/plugins/fzf-tab ]; then if [ -d $ZSH/custom/plugins/fzf-tab ]; then
cd $ZSH/custom/plugins/fzf-tab && git pull git -C $ZSH/custom/plugins/fzf-tab pull
else else
git clone --depth 1 https://github.com/Aloxaf/fzf-tab $ZSH/custom/plugins/fzf-tab git clone --depth 1 https://github.com/Aloxaf/fzf-tab $ZSH/custom/plugins/fzf-tab
fi fi
# Import existing z data into zoxide if available
if command -v zoxide &> /dev/null; then
for z_file in ~/.z ~/.local/share/z/data ~/.zlua ~/.fasd; do
if [ -f "$z_file" ]; then
echo -e "Importing existing z data from $z_file into zoxide\n"
zoxide import --from=z "$z_file" 2>/dev/null || echo "Failed to import $z_file, continuing..."
break
fi
done
fi
# if git clone --depth 1 https://github.com/todotxt/todo.txt-cli.git ~/.config/ezsh/todo; then : # if git clone --depth 1 https://github.com/todotxt/todo.txt-cli.git ~/.config/ezsh/todo; then :
@@ -242,4 +344,7 @@ else
fi fi
fi fi
# Restore original working directory
cd "$ORIGINAL_DIR"
exit exit

29
install_nvm.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Save the original working directory
ORIGINAL_DIR="$(pwd)"
# Install nvm (Node Version Manager) if it is not already installed
if command -v nvm &> /dev/null; then
echo -e "nvm is already installed\n"
else
echo -e "Installing nvm (Node Version Manager)\n"
# Using the official install script (https://github.com/nvm-sh/nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# Load nvm for the remainder of this script
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.nvm}"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
fi
# OPTIONAL: Install the latest LTS version of Node.js
# Uncomment the following line if you would like to automatically install it
nvm install --lts
# Apply the "basic" zsh configuration patch (downloads zshrc/basic.zsh to ~/.config/zshrc/basic.zsh)
curl -s https://git.miomio.moe/mio/easyzsh/raw/branch/master/patch.sh | bash -s basic
# Restore original working directory
cd "$ORIGINAL_DIR"
echo -e "\nAll basic packages have been installed. Restart your terminal or run 'source ~/.zshrc' to start using them.\n"

4
zshrc/nvm.zsh Normal file
View File

@@ -0,0 +1,4 @@
# Initialize nvm (Node Version Manager)
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.nvm}"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

11
zshrc/personal.zsh Normal file
View File

@@ -0,0 +1,11 @@
# This my personal zshrc configs. Feel free to use it and modify according to your needs
# Place all your .zshrc configurations (including this one) in a single or multiple files under ~/.config/ezsh/zshrc/ folder
# Additional OH-MY-ZSH plugins to enable
plugins+=(lol httpie docker docker-compose pyenv pip)
# Remove OH-MY-ZSH plugins from the default config
plugins=(${plugins:#(zsh-autosuggestions|lol)})
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv status command_execution_time background_jobs todo ram load rvm time)