update
This commit is contained in:
parent
188269046b
commit
ba4d19fba7
3 changed files with 56 additions and 7 deletions
28
zshenv
28
zshenv
|
@ -1,4 +1,24 @@
|
|||
# Global exports
|
||||
export VISUAL=vim
|
||||
export EDITOR=vim
|
||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||
##
|
||||
# Env variables
|
||||
##
|
||||
|
||||
# Sets VISUAL and EDITOR env var depending on available binaries
|
||||
if type nvim &> /dev/null; then
|
||||
export VISUAL=nvim
|
||||
export EDITOR=nvim
|
||||
elif type vim &> /dev/null; then
|
||||
export VISUAL=vim
|
||||
export EDITOR=vim
|
||||
else
|
||||
export VISUAL=vi
|
||||
export EDITOR=vi
|
||||
fi
|
||||
|
||||
# Sets BROWSER variable
|
||||
if type qutebrowser &> /dev/null; then
|
||||
export BROWSER=qutebrowser
|
||||
elif type firefox &> /dev/null; then
|
||||
export BROWSER=firefox
|
||||
elif type chromium &> /dev/null; then
|
||||
export BROWSER=chromium
|
||||
fi
|
||||
|
|
16
zshps
16
zshps
|
@ -1,3 +1,12 @@
|
|||
_if_array_contains() {
|
||||
local i=${1}; shift
|
||||
local eArray=(${@})
|
||||
|
||||
for e in ${eArray[@]}; do
|
||||
[[ "${e}" = "${i}" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
# Prompt Shell builder
|
||||
# [1] Connection security
|
||||
# Connected on remote machine, via ssh (good).
|
||||
|
@ -16,11 +25,12 @@
|
|||
|
||||
|
||||
# [2] User type
|
||||
groupList=($(groups))
|
||||
# Root
|
||||
if [[ ${USER} = "root" ]]; then
|
||||
USER_PS="%F{red}%n%f"
|
||||
# Admin
|
||||
elif groups | grep -qw sudo; then
|
||||
elif _if_array_contains prod ${groupList[@]} || _if_array_contains wheel ${groupList[@]} || _if_array_contains sudo ${groupList[@]}; then
|
||||
USER_PS="%F{yellow}%n%f"
|
||||
# Normal
|
||||
else
|
||||
|
@ -82,8 +92,7 @@
|
|||
function load_color() {
|
||||
# Load vars
|
||||
# Small load
|
||||
SLOAD=30
|
||||
# Medium load
|
||||
SLOAD=30 # Medium load
|
||||
MLOAD=60
|
||||
# Large load
|
||||
LLOAD=80
|
||||
|
@ -144,3 +153,4 @@ precmd() {
|
|||
disk_color
|
||||
buildPS
|
||||
}
|
||||
|
||||
|
|
19
zshrc
19
zshrc
|
@ -22,3 +22,22 @@ done
|
|||
for usrc in "${usrcArray[@]}"; do
|
||||
[[ -f "${usrc}" ]] && source "${usrc}"
|
||||
done
|
||||
|
||||
# History
|
||||
export HISTFILE="${XDG_DATA_HOME}/zsh/zhistory"
|
||||
export HISTSIZE=1000000000
|
||||
export SAVEHIST=$HISTSIZE
|
||||
setopt BANG_HIST # Treat the '!' character specially during expansion.
|
||||
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
|
||||
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
|
||||
setopt SHARE_HISTORY # Share history between all sessions.
|
||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
|
||||
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
|
||||
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
|
||||
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
|
||||
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
|
||||
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
|
||||
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
|
||||
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
|
||||
setopt HIST_BEEP # Beep when accessing nonexistent history.
|
||||
|
||||
|
|
Loading…
Reference in a new issue