zsh: reorganize

This commit is contained in:
Grigory Shipunov 2020-12-03 01:16:54 +01:00
parent 9e9e8afd5a
commit 1b61337582
No known key found for this signature in database
GPG key ID: 77BB6C3E4771EE7C
4 changed files with 59 additions and 21 deletions

44
zsh/zsh-common Normal file
View file

@ -0,0 +1,44 @@
# Edit the command in editor
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
#### Aliases
# add some color
alias grep="grep --color"
alias ls="ls --color=auto"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# ls shorthand
alias ll="ls -h -l"
alias l="ls -h -l -A"
alias l.="ls -d .*"
# easy edit
alias e=$EDITOR
alias v=$VISUAL
# pager
export PAGER="less --quit-if-one-screen"
# platform-specific config
unamestr=$(uname 2> /dev/null)
case "$unamestr" in
"Darwin")
alias ls="ls -G" # macos ls is weird
alias o="open"
alias cpy="pbcopy"
alias pst="pbpaste"
export HOMEBREW_NO_AUTO_UPDATE=1
;;
"Linux")
alias o="xdg-open"
alias cpy="xclip -selection clipboard"
alias pst="xclip -selection clipboard -o"
# use dircolors, if we have them
if [[ -f $HOME/.dir_colors ]]; then
eval $(dircolors -b $HOME/.dir_colors)
fi
;;
esac