-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
131 lines (103 loc) · 2.87 KB
/
.zshrc
File metadata and controls
131 lines (103 loc) · 2.87 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#############################
# 🎨 PROMPT PERSONNALISÉ
#############################
# Active la coloration du prompt avec nom de dossier et branche Git
autoload -Uz vcs_info
precmd() {
vcs_info
}
# Couleurs
autoload -Uz colors && colors
setopt PROMPT_SUBST
# Personnalisation du prompt sans symbole `%` à la fin
PROMPT=$'%F{117}😎 ${vcs_info_msg_0_}\n%F{33}%~ \$ %f'
RPROMPT=''
# Active l'info de branche Git
zstyle ':vcs_info:git:*' formats '(%b)'
#############################
# 🌍 VARIABLES D'ENVIRONNEMENT
#############################
# Node.js
export NODE_PATH="/usr/local/lib/node_modules:$NODE_PATH"
# Git : désactive l’édition automatique de message de merge
export GIT_MERGE_AUTOEDIT='no'
# Éditeurs par défaut
if command -v code >/dev/null 2>&1; then
export EDITOR="code --wait"
else
export EDITOR="${EDITOR:-vim}"
fi
export VISUAL="$EDITOR"
export GIT_EDITOR="$EDITOR"
export SVN_EDITOR="$EDITOR"
#############################
# 🛣️ CHEMINS
#############################
# Ajoute les chemins importants à ton $PATH
USR_PATHS="/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin"
export PATH="$USR_PATHS:$PATH"
#############################
# 🧰 FONCTIONS UTILITAIRES
#############################
# 💻 Aller rapidement sur le bureau
function desktop {
cd "$HOME/Desktop/$*"
}
# 🔍 Chercher un processus (usage : `psg node`)
function psg {
local FIRST=${1[1]}
local REST=${1[2,-1]}
ps aux | grep "[$FIRST]$REST"
}
# 📂 Crée un dossier et y entre
function mkcd {
mkdir -p "$1" && cd "$1"
}
# 🧩 Décompresse n'importe quel fichier
function extract {
if [[ -f "$1" ]]; then
case "$1" in
*.tar.bz2) tar xvjf "$1" ;;
*.tar.gz) tar xvzf "$1" ;;
*.tar.xz) tar xvJf "$1" ;;
*.zip) unzip "$1" ;;
*.rar) unrar x "$1" ;;
*) echo "'$1' ne peut pas être extrait automatiquement." ;;
esac
else
echo "'$1' n'est pas un fichier valide."
fi
}
#############################
# 🪄 ALIAS
#############################
# 📁 Liste détaillée des fichiers
alias l='ls -lah'
# 🧙♂️ Git
alias gcl="git clone"
alias gst="git status"
alias gl="git pull"
alias gp="git push"
alias gpo="git push origin"
alias gd="git diff | mate"
alias gc="git commit -v"
alias gca="git commit -v -a"
alias gcam="git commit -am"
alias gb="git branch"
alias gba="git branch -a"
alias gbb="git checkout -b"
alias gi="git rebase -i origin/main"
alias gr="git rebase origin/main"
#############################
# ⚙️ COMPLÉTION & COMPORTEMENTS
#############################
# Active la complétion (native avec Zsh)
autoload -Uz compinit && compinit
# Ignore la casse dans les complétions
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# Active l'historique partagé entre les onglets
setopt share_history
# Sauvegarde l’historique dans un fichier
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000