-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
154 lines (117 loc) · 4.15 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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=5001
SAVEHIST=5001
unsetopt beep
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/pertz/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots)
# User configuration
####################################################################################################################################################
_z_cd() {
cd "$@" || return "$?"
if [ "$_ZO_ECHO" = "1" ]; then
echo "$PWD"
fi
}
z() {
if [ "$#" -eq 0 ]; then
_z_cd ~
elif [ "$#" -eq 1 ] && [ "$1" = '-' ]; then
if [ -n "$OLDPWD" ]; then
_z_cd "$OLDPWD"
else
echo 'zoxide: $OLDPWD is not set'
return 1
fi
else
_zoxide_result="$(zoxide query -- "$@")" && _z_cd "$_zoxide_result"
fi
}
zi() {
_zoxide_result="$(zoxide query -i -- "$@")" && _z_cd "$_zoxide_result"
}
alias za='zoxide add'
alias zq='zoxide query'
alias zqi='zoxide query -i'
alias zr='zoxide remove'
zri() {
_zoxide_result="$(zoxide query -i -- "$@")" && zoxide remove "$_zoxide_result"
}
_zoxide_hook() {
zoxide add "$(pwd -L)"
}
chpwd_functions=(${chpwd_functions[@]} "_zoxide_hook")
###############################################################################################################
stty stop undef # Disable ctrl-s to freeze terminal.
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then export EDITOR='vim'
else
export EDITOR='nvim'
fi
# Compilation flags
export ARCHFLAGS="-arch x86_64"
## enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
# alias ll='ls -l'
# alias lla='ls -alF'
# alias la='ls -A'
# alias l='ls -CF'
alias ls='eza --color always --group-directories-first --git --git-repos'
alias ll='eza -l --icons --color always --group-directories-first --git --git-repos'
alias lla='eza -alF --icons --color always --group-directories-first --git --git-repos'
alias la='ls -A --color always --group-directories-first --git --git-repos'
alias bat='batcat'
export EDITOR='vim'
export VISUAL='vim'
#set -o vi
export KEYTIMEOUT=1
# Define the userpart section of the prompt
local userpart='%F{green}%n@%m%f:'
# autoload -Uz vcs_info
# precmd_vcs_info() { vcs_info }
# precmd_functions+=( precmd_vcs_info )
# setopt prompt_subst
# RPROMPT='${vcs_info_msg_0_}'
# PROMPT='${vcs_info_msg_0_}%# '
# zstyle ':vcs_info:git:*' formats '%b'
# Combine all the parts to form the PS1 prompt
PROMPT='${userpart}%F{blue}%~%F{red}${vcs_info_msg_0_}%f$ '
#setopt PROMPT_SUBST ; PS1='[%F{green}%n@%m %F{blue}%c%F{red}$(__git_ps1 " (%s)")%f]\$ '
#ZSH: precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
#PROMPT='%F{green}%*%f %F{blue}%~%f %F{red}${vcs_info_msg_0_}%f$ '
setopt PROMPT_SUBST ; PS1='[%F{green}%n@%m%f:%F{blue}%~%F{red}$(__git_ps1 "(%s)")%f]\$ '
alias weather='curl "wttr.in/Jyväskylä"'
alias battery='cat /sys/class/power_supply/BAT0/capacity'
alias monitor='xrandr --output DisplayPort-1 --mode 1920x1080 --rate 240'
export PATH="$PATH:/opt/nvim/"
source ~/.git-prompt.sh
# Load zsh-syntax-highlighting; should be last.
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh