Changes in: zsh,

This commit is contained in:
Gopher 2025-03-19 22:08:27 +05:30
parent e023c6c240
commit 9872af2f32

View file

@ -1,29 +1,25 @@
if [[ -f "/opt/homebrew/bin/brew" ]] then export ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# If you're using macOS, you'll want this enabled export PATH=$HOME/.config/rofi/scripts:$PATH
eval "$(/opt/homebrew/bin/brew shellenv)" export STARSHIP_CONFIG=~/.config/starship/starship.toml
fi export EDITOR=/bin/nvim
# Set the directory we want to store zinit and plugins
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
# # Download Zinit, if it's not there yet
if [ ! -d "$ZINIT_HOME" ]; then if [ ! -d "$ZINIT_HOME" ]; then
mkdir -p "$(dirname $ZINIT_HOME)" mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi fi
# # Source/Load zinit
source "${ZINIT_HOME}/zinit.zsh" source "${ZINIT_HOME}/zinit.zsh"
# # Add in zsh plugins
zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab zinit light Aloxaf/fzf-tab
zinit light xylous/gitstatus zinit light xylous/gitstatus
# zinit ice wait'0' # Load asynchronously
# zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-history-substring-search zinit light zsh-users/zsh-history-substring-search
# # Add in snippets
zinit snippet OMZP::git zinit snippet OMZP::git
zinit snippet OMZP::sudo zinit snippet OMZP::sudo
#zinit snippet OMZP::archLinux #zinit snippet OMZP::archLinux
@ -35,13 +31,8 @@ zinit snippet OMZP::kubectx
zinit snippet OMZP::command-not-found zinit snippet OMZP::command-not-found
zinit snippet OMZP::terraform zinit snippet OMZP::terraform
# # Load completions
autoload -Uz compinit && compinit autoload -Uz compinit && compinit
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
#."$HOME/"
# zinit cdreplay -q
# # Keybindings # # Keybindings
@ -52,8 +43,26 @@ bindkey '^p' history-search-backward
bindkey '^n' history-search-forward bindkey '^n' history-search-forward
bindkey '^[w' kill-region bindkey '^[w' kill-region
cd_up() {
cd ..
zle reset-prompt
}
zle -N cd_up
bindkey '^H' cd_up
cd_menu() {
local dir
dir=$(eza -1 --color=always --icons --group-directories-first | fzf --ansi --preview 'eza --tree --level=1 --icons --color=always {}')
[[ -n "$dir" ]] && cd "$dir" && zle reset-prompt
}
zle -N cd_menu
bindkey '^L' cd_menu
zle -N cd_menu
bindkey '^L' cd_menu
# # History
HISTSIZE=5001 HISTSIZE=5001
HISTFILE=~/.zsh_history HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE SAVEHIST=$HISTSIZE
@ -66,32 +75,35 @@ setopt hist_save_no_dups
setopt hist_ignore_dups setopt hist_ignore_dups
setopt hist_find_no_dups setopt hist_find_no_dups
# # Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
# # Aliases
alias vim='nvim'
#alias man='tldr'
# # Shell integrations # # Shell integrations
eval "$(fzf --zsh)" eval "$(fzf --zsh)"
eval "$(zoxide init --cmd cd zsh)" eval "$(zoxide init --cmd cd zsh)"
eval $(thefuck --alias)
eval "$(atuin init zsh)"
eval "$(starship init zsh)"
alias vim='nvim'
alias jump='nvim $(fzf -m --preview="bat --color=always {}")' alias jump='nvim $(fzf -m --preview="bat --color=always {}")'
alias ls='eza -l -i --header --tree --level=1 --all --sort=Name' alias ls='eza -l -i --header --tree --level=1 --all --sort=Name'
alias search='eval "~/.local/bin/search.sh"' alias search='eval "~/.local/bin/search.sh"'
alias code='code .' alias cod='code .'
alias tnew='tmux new -s '
alias tatt='tmux a -t' # Tmux
alias ..='cd ..' alias t='tmux new -s '
alias ....='cd ../..' alias tt='tmux a -t'
alias ~='cd ~'
alias seek='pacseek' alias seek='pacseek'
alias y='yazi' alias y='yazi'
alias ci='cdi'
alias ....='cd ../..'
alias ..='cd ..'
alias ~='cd ~'
gh_open() { gh_open() {
xdg-open "https://github.com/ad1822/$1" xdg-open "https://github.com/ad1822/$1"
@ -102,6 +114,10 @@ backup_dots(){
} }
fcd(){
local dir
dir=$(find ${1:-.} -type d -not -path '*/\.*' 2> /dev/null | fzf +m) && cd "$dir"
}
extract() { extract() {
if [ -f "$1" ]; then if [ -f "$1" ]; then
@ -125,52 +141,17 @@ killp() {
ps aux | fzf | awk '{print $2}' | xargs kill -9 ps aux | fzf | awk '{print $2}' | xargs kill -9
} }
j() {
local dir
dir=$(eza -1 --color=always --icons --group-directories-first | fzf --ansi) && cd "$(echo "$dir" | awk '{print $NF}')"
}
take() { take() {
mkdir -p "$1" && cd "$1" mkdir -p "$1" && cd "$1"
} }
#fastfetch #fastfetch
#wl-paste --watch cliphist store &
eval $(thefuck --alias)
eval "$(atuin init zsh)"
eval "$(starship init zsh)"
export FZF_DEFAULT_OPTS=" \
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--color=selected-bg:#45475a \
--multi"
#alias connectGit='
#if ! pgrep -u "$USER" ssh-agent > /dev/null; then
# eval "$(ssh-agent -s)"
#fi
#ssh-add ~/.ssh/id_ed25519
#'
fcd(){
local dir
dir=$(find ${1:-.} -type d -not -path '*/\.*' 2> /dev/null | fzf +m) && cd "$dir"
}
export PATH=$HOME/.config/rofi/scripts:$PATH
export STARSHIP_CONFIG=~/.config/starship/starship.toml
export EDITOR=/bin/nvim
#. "/home/archer/.deno/env"
#export PATH="$HOME/anaconda3/bin:$PATH"
# bun completions
#[ -s "/home/archer/.bun/_bun" ] && source "/home/archer/.bun/_bun"
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
#eval "$(ssh agent -s)" > /dev/null
[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases
autoload -U +X bashcompinit && bashcompinit autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/bin/terraform terraform complete -o nospace -C /usr/bin/terraform terraform