forked from sorin-ionescu/prezto
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
85 lines (70 loc) · 2.88 KB
/
zshrc
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
# vim: set ft=zsh
# Profile loading the shell using `ZPROF=1 zsh -i`
[ -z "$ZPROF" ] || zmodload zsh/zprof
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
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
# TODO: Look to using the simple https://github.com/zplug/zplug method of loading
# just the bits I want instead of maintaining a bunch of unused scripts in this repo
# Source Prezto.
if [ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]; then
# shellcheck disable=SC1090
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
_exists() { (( $+commands[$1] )) }
#### ---:[ Aliases ]:--- ###
alias rm='nocorrect rm'
alias l='ls -lg'
alias ll='ls -lga'
alias ..='cd ..'
alias path='echo -e ${PATH//:/\\n}'
alias less="less -RMFXK"
alias more="less"
alias unzip="unzip -qq"
alias myprocs="ps aux | grep $USER"
alias nocmt="grep -v '^$\|^\s*\#'"
_exists bat && alias cat=bat && export BAT_THEME="Monokai Extended"
_exists exa && alias ls=exa
_exists rg && rg() { $commands[rg] -p "$@" | less -RMFXK; }
_exists prettyping && alias ping="prettyping --nolegend"
_exists htop && alias top=htop
_exists nvim && alias vi=nvim
# Lazy Git aliases
alias gcom="git com"
alias gup="git up" # Uses the `up` alias in my .gitconfigcd
alias gst="git status"
alias g='git'
alias gb='git branch'
alias gbc='git switch -c'
alias gc='git commit --verbose'
alias gco='git switch'
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
alias gp='git push'
_exists hub && {
alias git=hub
alias ci="hub ci-status"
}
take() { mkdir -p $@ && cd ${@:$#} }
# Pull in AWS autocomplete manually as it doesn't work automatically - https://github.com/sorin-ionescu/prezto/issues/1142
_exists aws && {
[ -f /usr/local/opt/awscli/share/zsh/site-functions/aws_zsh_completer.sh ] && source /usr/local/opt/awscli/share/zsh/site-functions/aws_zsh_completer.sh
}
# Pull in the Azure autocomplete. Cache it as it can be slow at times
_exists azure && {
cache="${ZDOTDIR:-$HOME}/.zprezto/modules/completion/azure-cache.zsh"
[ ! -f "$cache" ] && azure --completion > "$cache"
source "$cache"
}
unfunction _exists
HB_CNF_HANDLER="/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh"
[ -f "$HB_CNF_HANDLER" ] && source "$HB_CNF_HANDLER"
[ -f "$HOME/.fzf.zsh" ] && source "$HOME/.fzf.zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f "$HOME/.secrets" ] && source "$HOME/.secrets"
# This must always be last.
[ -z "$ZPROF" ] || zprof