189 lines
5.4 KiB
Plaintext
189 lines
5.4 KiB
Plaintext
cd ~
|
|
|
|
# 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
|
|
|
|
# --- Homebrew Initialization (Primary) ---
|
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
|
|
|
VI_MODE_SET_CURSOR=true
|
|
MODE_INDICATOR="%F{yellow}+%f"
|
|
bindkey -v
|
|
bindkey 'jk' vi-cmd-mode
|
|
|
|
# Visual feedback for vi mode
|
|
function zle-keymap-select {
|
|
if [[ $KEYMAP == vicmd ]]; then
|
|
echo -ne "\e[2 q" # Block
|
|
else
|
|
echo -ne "\e[6 q" # Beam
|
|
fi
|
|
}
|
|
zle -N zle-keymap-select
|
|
echo -ne "\e[6 q" # Start with beam
|
|
precmd() { echo -ne "\e[6 q" } # Reset to beam before prompt
|
|
bindkey '^[[A' history-substring-search-up
|
|
bindkey '^[[B' history-substring-search-down
|
|
|
|
export LC_CTYPE=en_GB.UTF-8
|
|
export LC_ALL=en_GB.UTF-8
|
|
export LANG=en_GB.UTF-8
|
|
export EDITOR='/usr/bin/nvim'
|
|
export MAVEN_OPTS='-Dstyle.color=always'
|
|
|
|
# Options
|
|
setopt AUTO_CD
|
|
setopt CORRECT
|
|
setopt HIST_IGNORE_DUPS
|
|
setopt SHARE_HISTORY
|
|
|
|
# History
|
|
HISTSIZE=10000
|
|
SAVEHIST=10000
|
|
HISTFILE=~/.zsh_history
|
|
|
|
# # to customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
|
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
|
|
|
export PYENV_ROOT="$HOME/.pyenv"
|
|
export JDK8_HOME="$HOME/.jdks/jdk-1.8"
|
|
export JDK8_32_HOME="$HOME/.jdks/jdk-1.8-i586"
|
|
export JDK21_HOME="$HOME/.jdks/jdk-21"
|
|
export JDK25_HOME="$HOME/.jdks/jdk-25"
|
|
export JAVA_HOME="$JDK25_HOME"
|
|
export GROOVY_HOME="$HOME/devtools/groovy"
|
|
export M2_HOME="$HOME/devtools/maven"
|
|
export NODE_ENV=development
|
|
export GDK_BACKEND=x11
|
|
|
|
# PATH Configuration (Homebrew and Local Bin prioritized)
|
|
export PATH="$HOME/.local/bin:$PATH:$JAVA_HOME/bin:$M2_HOME/bin:$GROOVY_HOME/bin:$PYENV_ROOT/bin:$HOME/.npm-global/bin:/snap/bin"
|
|
|
|
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
|
|
export ZSH="/home/riz/.oh-my-zsh"
|
|
# ZSH_THEME="powerlevel10k/powerlevel10k"
|
|
|
|
plugins=(
|
|
git
|
|
vi-mode
|
|
zsh-autosuggestions
|
|
zsh-history-substring-search
|
|
zsh-completions
|
|
fzf-tab
|
|
zsh-syntax-highlighting
|
|
)
|
|
|
|
# fzf-tab settings
|
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
|
|
zstyle ':fzf-tab:complete:*' fzf-flags --color=fg:1,fg+:2 --height=50%
|
|
zstyle ':completion:*:descriptions' format '[%d]'
|
|
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
|
|
|
source <(fzf --zsh)
|
|
export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border --preview 'bat --style=numbers --color=always --line-range :500 {}'"
|
|
export FZF_CTRL_T_OPTS="--preview 'bat --style=numbers --color=always --line-range :500 {}'"
|
|
export FZF_ALT_C_OPTS="--preview 'eza --tree --icons --color=always {} | head -200'"
|
|
|
|
# General Aliases
|
|
alias ai='gemini'
|
|
alias vi=nvim
|
|
alias g=git
|
|
alias lg=lazygit
|
|
alias code="/mnt/c/Users/reazul.ashraf/AppData/Local/Programs/Microsoft\ VS\ Code/bin/code"
|
|
alias pbcopy='xclip -selection clipboard'
|
|
alias pbpaste='xclip -selection clipboard -o'
|
|
|
|
# --- Gold Standard Tool Mapping (Deduplicated & High Performance) ---
|
|
# Homebrew provides these; aliases ensure they are used consistently.
|
|
alias ls='eza --icons --group-directories-first'
|
|
alias la='eza --icons -la --group-directories-first --git'
|
|
alias tree='eza --tree --icons'
|
|
alias cat='bat'
|
|
alias find='fd'
|
|
alias ff='fd'
|
|
alias grep='rg'
|
|
alias sed='sd'
|
|
alias awk='choose'
|
|
alias ps='procs'
|
|
alias top='btm'
|
|
alias curl='xh'
|
|
alias zip='ouch'
|
|
alias tar='ouch'
|
|
alias diff='delta'
|
|
alias tldr='tealdeer'
|
|
# --------------------------------------------------------------------
|
|
|
|
# Navigation
|
|
alias ..='cd ..'
|
|
alias ...='cd ../..'
|
|
alias ....='cd ../../..'
|
|
alias .....='cd ../../../..'
|
|
|
|
# Functions
|
|
fcd() {
|
|
local dir
|
|
dir=$(fd -t d 2>/dev/null | fzf --preview 'eza --tree --icons --color=always {} | head -200') && cd "$dir"
|
|
}
|
|
|
|
alias jdk8home="export JAVA_HOME=$JDK8_HOME"
|
|
alias jdk8home32="export JAVA_HOME=$JDK8_32_HOME"
|
|
alias jdk21home="export JAVA_HOME=$JDK21_HOME"
|
|
alias jdk25home="export JAVA_HOME=$JDK25_HOME"
|
|
|
|
java() {
|
|
$JAVA_HOME/bin/java $@
|
|
}
|
|
|
|
gsquash() {
|
|
git reset --soft head~$(git rev-list --count head ^$1)
|
|
echo "To complete then do, git push --force"
|
|
}
|
|
|
|
# Development Helpers
|
|
dmvn() {
|
|
ws="/mnt/c/users/reazul.ashraf/workspace/uichannel-commission-bootstrap"
|
|
id="$(docker run -t -d -u root:root -v /home/riz/.m2:/volume/.m2 -w $ws -v $ws:$ws:rw,z -v $ws@tmp:$ws@tmp:rw,z maven:3-openjdk-8-slim cat)"
|
|
docker exec -ti $id ls -alp $ws
|
|
docker kill $id
|
|
}
|
|
|
|
sonarscan() {
|
|
MAVEN_OPTS="-Dsonar.branch.name=$(git branch --show-current)" JAVA_HOME=$JDK21_HOME mvn org.sonarsource.scanner.maven:sonar-maven-plugin:RELEASE:sonar -DskipTests
|
|
}
|
|
|
|
# Environment Initializations
|
|
eval "$(zoxide init --cmd z zsh)"
|
|
|
|
# pnpm
|
|
export PNPM_HOME="/home/riz/.local/share/pnpm"
|
|
case ":$PATH:" in
|
|
*":$PNPM_HOME:"*) ;;
|
|
*) export PATH="$PNPM_HOME:$PATH" ;;
|
|
esac
|
|
|
|
export GOOGLE_CLOUD_PROJECT=inse-r-and-d
|
|
export XDG_DATA_DIRS="/usr/local/share:/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
|
alias ghostty="ghostty 2>/dev/null"
|
|
alias gimp='GDK_BACKEND=x11 gimp'
|
|
export PYTHONWARNINGS="ignore:Your system is avx2 capable:RuntimeWarning"
|
|
|
|
# Cargo / Local Bin
|
|
[ -f "$HOME/.local/bin/env" ] && . "$HOME/.local/bin/env"
|
|
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
|
|
|
|
# Autosuggestions color (make it readable)
|
|
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=cyan'
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
|
|
export STARSHIP_DEVICE_COLOR="orange"
|
|
export STARSHIP_CONFIG=~/.config/starship_linux.toml
|
|
eval "$(starship init zsh)"
|
|
|
|
|
|
alias refresh-vpn='powershell.exe -ExecutionPolicy Bypass -File "C:\Users\reazul.ashraf\scripts\refresh_wsl_vpn.ps1"'
|
|
|
|
export GEMINI_CLI_HOME="/mnt/c/Users/reazul.ashraf"
|