From 9872af2f3256656506123596869ce2f9a7175a70 Mon Sep 17 00:00:00 2001 From: Gopher Date: Wed, 19 Mar 2025 22:08:27 +0530 Subject: [PATCH] Changes in: zsh, --- zsh/.zshrc | 125 +++++++++++++++++++++++------------------------------ 1 file changed, 53 insertions(+), 72 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 709f4f2..2453f56 100755 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,29 +1,25 @@ -if [[ -f "/opt/homebrew/bin/brew" ]] then - # If you're using macOS, you'll want this enabled - eval "$(/opt/homebrew/bin/brew shellenv)" -fi +export ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +export PATH=$HOME/.config/rofi/scripts:$PATH +export STARSHIP_CONFIG=~/.config/starship/starship.toml +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 mkdir -p "$(dirname $ZINIT_HOME)" git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" fi -# # Source/Load zinit source "${ZINIT_HOME}/zinit.zsh" -# # Add in zsh plugins zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-autosuggestions zinit light Aloxaf/fzf-tab zinit light xylous/gitstatus +# zinit ice wait'0' # Load asynchronously +# zinit light zsh-users/zsh-autosuggestions + zinit light zsh-users/zsh-history-substring-search -# # Add in snippets zinit snippet OMZP::git zinit snippet OMZP::sudo #zinit snippet OMZP::archLinux @@ -35,13 +31,8 @@ zinit snippet OMZP::kubectx zinit snippet OMZP::command-not-found zinit snippet OMZP::terraform -# # Load completions autoload -Uz compinit && compinit - -#."$HOME/" - - -# zinit cdreplay -q +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' # # Keybindings @@ -52,8 +43,26 @@ bindkey '^p' history-search-backward bindkey '^n' history-search-forward 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 HISTFILE=~/.zsh_history SAVEHIST=$HISTSIZE @@ -66,35 +75,38 @@ setopt hist_save_no_dups setopt hist_ignore_dups setopt hist_find_no_dups -# # Completion styling zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' menu no zstyle ':fzf-tab:complete:cd:*' 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 eval "$(fzf --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 ls='eza -l -i --header --tree --level=1 --all --sort=Name' alias search='eval "~/.local/bin/search.sh"' -alias code='code .' -alias tnew='tmux new -s ' -alias tatt='tmux a -t' -alias ..='cd ..' -alias ....='cd ../..' -alias ~='cd ~' +alias cod='code .' + +# Tmux +alias t='tmux new -s ' +alias tt='tmux a -t' + alias seek='pacseek' alias y='yazi' +alias ci='cdi' +alias ....='cd ../..' +alias ..='cd ..' +alias ~='cd ~' gh_open() { - xdg-open "https://github.com/ad1822/$1" + xdg-open "https://github.com/ad1822/$1" } backup_dots(){ @@ -102,6 +114,10 @@ backup_dots(){ } +fcd(){ + local dir + dir=$(find ${1:-.} -type d -not -path '*/\.*' 2> /dev/null | fzf +m) && cd "$dir" +} extract() { if [ -f "$1" ]; then @@ -125,52 +141,17 @@ killp() { 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() { mkdir -p "$1" && cd "$1" } + #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 complete -o nospace -C /usr/bin/terraform terraform