-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
113 lines (96 loc) · 2.84 KB
/
Copy path.zshrc
File metadata and controls
113 lines (96 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# ================================================
# ZSH CONFIG: Oh My Zsh + Autosuggestions
# ================================================
# -------------------------------
# Start ssh-agent if not already running
# -------------------------------
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
fi
# -------------------------------
# Persistent command history
# -------------------------------
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
# History options
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt INC_APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt HIST_FIND_NO_DUPS
# -------------------------------
# Oh My Zsh setup
# -------------------------------
export ZSH="$HOME/.oh-my-zsh"
# Choose a theme (default Zsh theme)
ZSH_THEME="robbyrussell"
# Enable plugins
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
# Load Oh My Zsh
if [ -d "$ZSH" ]; then
source $ZSH/oh-my-zsh.sh
fi
# -------------------------------
# zsh-autosuggestions
# -------------------------------
if [ -f ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
# -------------------------------
# zsh-syntax-highlighting
# -------------------------------
if [ -f ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
# -------------------------------
# Custom prompt fallback
# -------------------------------
set_prompt() {
if [[ "$PWD" == "$HOME" ]]; then
PROMPT='%F{cyan}~%f %# '
else
PROMPT='%F{cyan}%~%f %# '
fi
}
autoload -Uz add-zsh-hook
add-zsh-hook chpwd set_prompt
add-zsh-hook precmd set_prompt
set_prompt
# -------------------------------
# Aliases & Extras
# -------------------------------
alias ll='exa -lah --git' # Use exa instead of ls
alias gs='git status'
alias gp='git push'
alias gd='git diff'
alias ls='eza -lh --color=auto --sort=modified'
# -------------------------------
export TERM=xterm-256color
#--------------------------------
# Keybindings
#--------------------------------
# Move to the start of the line
bindkey '^A' beginning-of-line
# Move to the end of the line
bindkey '^E' end-of-line
# Force Enter (Ctrl+M) to execute commands
bindkey '^M' accept-line #important
# Initialize fasd
eval "$(fasd --init auto)"
# Search and Load folder sl
sl() {
dir=$(find $HOME -type d -iname "$1" 2>/dev/null | head -n 1)
if [ -n "$dir" ]; then
cd "$dir" || return
echo "→ Moved to: $dir"
else
echo "No match found for: $1"
fi
}