mine-hyprdots/zsh/.zshrc

238 lines
5.5 KiB
Bash
Raw Normal View History

2025-03-19 22:08:27 +05:30
export ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
2025-05-03 12:50:32 +05:30
#export PATH="$HOME/.local/bin:$PATH"
export PATH=$PATH:/opt/kafka/bin
2025-03-19 22:08:27 +05:30
export PATH=$HOME/.config/rofi/scripts:$PATH
export STARSHIP_CONFIG=~/.config/starship/starship.toml
export EDITOR=/bin/nvim
2025-03-18 17:37:46 +05:30
if [ ! -d "$ZINIT_HOME" ]; then
2025-04-13 22:35:25 +05:30
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
2025-03-18 17:37:46 +05:30
fi
source "${ZINIT_HOME}/zinit.zsh"
2025-04-27 13:07:00 +05:30
zinit ice lucid as"program" pick"bin/git-dsf"
zinit load so-fancy/diff-so-fancy
2025-03-18 17:37:46 +05:30
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
2025-06-09 19:46:42 +05:30
zinit light romkatv/gitstatus
2025-03-18 17:37:46 +05:30
zinit light zsh-users/zsh-history-substring-search
2025-06-09 19:46:42 +05:30
2025-03-18 17:37:46 +05:30
zinit snippet OMZP::git
zinit snippet OMZP::sudo
#zinit snippet OMZP::archLinux
zinit snippet OMZP::aws
zinit snippet OMZP::kubectl
#zinit snippet OMZP::go
zinit snippet OMZP::kubectx
#zinit snippet OMZP::docker
zinit snippet OMZP::command-not-found
zinit snippet OMZP::terraform
autoload -Uz compinit && compinit
2025-03-19 22:08:27 +05:30
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
2025-03-18 17:37:46 +05:30
2025-06-09 19:46:42 +05:30
zstyle ':completion:*:git-checkout:*' sort false
zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
zstyle ':fzf-tab:*' fzf-flags --color=fg:1,fg+:2 --bind=tab:accept
zstyle ':fzf-tab:*' use-fzf-default-opts yes
zstyle ':fzf-tab:*' switch-group '<' '>'
2025-03-18 17:37:46 +05:30
# # Keybindings
bindkey -e
bindkey '^[ ' autosuggest-execute
bindkey '^[Z ' autosuggest-accept
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^[w' kill-region
2025-03-19 22:08:27 +05:30
cd_up() {
2025-04-13 22:35:25 +05:30
cd ..
zle reset-prompt
2025-03-19 22:08:27 +05:30
}
zle -N cd_up
bindkey '^H' cd_up
cd_menu() {
2025-04-13 22:35:25 +05:30
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
2025-03-19 22:08:27 +05:30
}
zle -N cd_menu
bindkey '^L' cd_menu
2025-03-18 17:37:46 +05:30
HISTSIZE=5001
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
2025-06-09 19:46:42 +05:30
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
2025-03-18 17:37:46 +05:30
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
# # Shell integrations
eval "$(fzf --zsh)"
2025-06-09 10:28:15 +05:30
export _ZO_ECHO='0'
2025-03-18 17:37:46 +05:30
eval "$(zoxide init --cmd cd zsh)"
2025-03-19 22:08:27 +05:30
eval $(thefuck --alias)
eval "$(atuin init zsh)"
eval "$(starship init zsh)"
2025-03-18 17:37:46 +05:30
2025-03-19 22:08:27 +05:30
alias vim='nvim'
2025-03-30 15:27:16 +05:30
2025-04-01 22:55:19 +05:30
alias gh-create='gh repo create --private --source=. --remote=origin && git push -u --all && gh browse'
2025-05-04 08:35:55 +05:30
add(){
2025-06-06 18:54:56 +05:30
git add --patch
2025-05-04 08:35:55 +05:30
}
commit(){
2025-06-06 18:54:56 +05:30
bash ~/work/main/dotsh/gh/commit
2025-05-04 08:35:55 +05:30
}
push(){
2025-06-06 18:54:56 +05:30
git push
}
ms(){
2025-06-06 18:54:56 +05:30
touch "$1" && chmod +x "$1"
}
2025-03-30 15:27:16 +05:30
alias kls='kubectl get all'
2025-03-19 17:09:17 +05:30
alias jump='nvim $(fzf -m --preview="bat --color=always {}")'
2025-06-09 10:28:15 +05:30
alias ls='eza -l --icons --level=0 --tree --sort=Name'
2025-03-18 17:37:46 +05:30
alias search='eval "~/.local/bin/search.sh"'
2025-03-19 22:08:27 +05:30
alias cod='code .'
# Tmux
alias t='tmux new -s '
alias tt='tmux a -t'
2025-06-09 10:28:15 +05:30
alias fbat="fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'"
2025-03-19 22:08:27 +05:30
2025-03-19 17:09:17 +05:30
alias seek='pacseek'
alias y='yazi'
2025-03-19 22:08:27 +05:30
alias ci='cdi'
alias ....='cd ../..'
alias ..='cd ..'
alias ~='cd ~'
2025-03-19 17:09:17 +05:30
2025-04-13 22:35:25 +05:30
edit() {
vim ~/.config/$1
}
2025-03-23 09:20:18 +05:30
cpcf() {
local file
2025-04-13 22:35:25 +05:30
2025-03-23 09:20:18 +05:30
file=$(fzf --query="$1" --preview 'bat --color=always {}' --preview-window 'right:60%' --bind 'ctrl-d:preview-page-down,ctrl-u:preview-page-up')
2025-04-13 22:35:25 +05:30
2025-03-23 09:20:18 +05:30
if [ -n "$file" ]; then
cat "$file" | wl-copy
echo "Copied: $file"
else
echo "No file selected."
fi
}
2025-06-08 07:56:01 +05:30
mount_gdrive() {
2025-06-09 10:28:15 +05:30
rclone mount gdrive: ~/mnt/gdrive
2025-06-08 07:56:01 +05:30
}
2025-03-19 17:09:17 +05:30
gh_open() {
2025-04-13 22:35:25 +05:30
xdg-open "https://github.com/ad1822/$1"
2025-03-19 17:09:17 +05:30
}
2025-03-18 17:37:46 +05:30
2025-03-19 17:25:16 +05:30
backup_dots(){
2025-04-13 22:35:25 +05:30
exec syncAll.sh
2025-03-19 17:25:16 +05:30
}
2025-03-19 22:08:27 +05:30
fcd(){
2025-04-13 22:35:25 +05:30
local dir
dir=$(find ${1:-.} -type d -not -path '*/\.*' 2> /dev/null | fzf +m) && cd "$dir"
2025-03-19 22:08:27 +05:30
}
2025-03-19 17:09:17 +05:30
extract() {
2025-04-13 22:35:25 +05:30
if [ -f "$1" ]; then
case "$1" in
*.tar.gz) tar -xzf "$1" ;;
*.tar.xz) tar -xf "$1" ;;
*.tar.bz2) tar -xjf "$1" ;;
*.gz) gunzip "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "'$1' cannot be extracted" ;;
esac
else
echo "'$1' is not a valid file"
fi
2025-03-18 17:37:46 +05:30
}
2025-03-19 17:09:17 +05:30
killp() {
2025-04-13 22:35:25 +05:30
ps aux | fzf | awk '{print $2}' | xargs kill -9
2025-03-19 17:09:17 +05:30
}
2025-03-18 17:37:46 +05:30
2025-03-19 22:08:27 +05:30
j() {
2025-04-13 22:35:25 +05:30
local dir
dir=$(eza -1 --color=always --icons --group-directories-first | fzf --ansi) && cd "$(echo "$dir" | awk '{print $NF}')"
2025-03-19 17:09:17 +05:30
}
2025-03-18 17:37:46 +05:30
2025-03-19 22:08:27 +05:30
take() {
mkdir -p "$1" && cd "$1"
}
2025-03-18 17:37:46 +05:30
2025-04-05 20:05:27 +05:30
c() {
2025-04-13 22:35:25 +05:30
cd "$1" && ls
2025-04-05 20:05:27 +05:30
}
2025-05-26 18:29:29 +05:30
music() {
2025-06-06 18:54:56 +05:30
xdg-open https://music.youtube.com/
2025-05-26 18:29:29 +05:30
}
2025-03-18 17:37:46 +05:30
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/bin/terraform terraform
2025-03-24 13:08:38 +05:30
complete -C '/usr/bin/aws_completer' aws
2025-03-30 15:27:16 +05:30
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
2025-04-27 13:07:00 +05:30
export PATH="$HOME/.cargo/bin:$PATH"
2025-05-03 12:50:32 +05:30
#fortune | cowsay
# Todo Manager Alias
alias todo='~/.todo/todo_tui.sh'
alias todocli='~/.todo/todo_cli.sh'
2025-05-16 14:49:57 +05:30
2025-06-06 18:54:56 +05:30
# fastfetch
2025-06-08 07:56:01 +05:30
#if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
# if tmux has-session -t default 2>/dev/null; then
# tmux new-window -t default
# tmux attach-session -t default
# else
# tmux new-session -s default
# fi
#fi