From b8ac424046f71f66d70ac7220a7be3a035109fcd Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Fri, 8 Aug 2014 18:06:15 +0200 Subject: zshrc: split aliases and functions out to aliases.zsh --- zsh/.zshrc | 38 +------------------------------------- zsh/aliases.zsh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 zsh/aliases.zsh diff --git a/zsh/.zshrc b/zsh/.zshrc index 2f5c278..e4a6859 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -62,38 +62,6 @@ autoload -U edit-command-line zle -N edit-command-line bindkey -M vicmd 'e' edit-command-line -########################### -## Aliasing and keybinding -## -alias wefree='weechat -a -r "/connect Freenode"' -alias ms='mbsync -c "$XDG_CONFIG_HOME/mbsyncrc" theos' - -ls_options='-A -F --color=auto --group-directories-first' -alias ls="ls $ls_options" -alias lsa="ls $ls_options -hAX" -alias lla="ls $ls_options -lhA" - -alias df='df -h' -alias ncmpcpp='ncmpcpp -c ~/.config/ncmpcpp/config' -alias '...'='../..' -alias mkdir='mkdir -vp' -alias acp='acp -g' -alias amv='amv -g' - -have() { command -v "$1" >&/dev/null; } - -# Colored man -man() { - env LESS_TERMCAP_mb=$(printf "\e[1;31m") \ - LESS_TERMCAP_md=$(printf "\e[1;31m") \ - LESS_TERMCAP_me=$(printf "\e[0m") \ - LESS_TERMCAP_se=$(printf "\e[0m") \ - LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ - LESS_TERMCAP_ue=$(printf "\e[0m") \ - LESS_TERMCAP_us=$(printf "\e[1;32m") \ - man "$@" -} - typeset -A key key[Home]=${terminfo[khome]} @@ -118,6 +86,7 @@ key[PageDown]=${terminfo[knp]} [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history +source "$ZDOTDIR"/aliases.zsh # Finally, make sure the terminal is in application mode, when zle is # active. Only then are the values from $terminfo valid. @@ -132,10 +101,5 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then zle -N zle-line-finish fi -alias sprin='curl -F "sprunge=<-" http://sprunge.us' -sprfile() { - curl -F "sprunge=<$1" http://sprunge.us -} - [[ -S '/run/user/1000/keyring/gpg' ]] && export GPG_AGENT_INFO='/run/user/1000/keyring/gpg:0:1' [[ -S '/run/user/1000/keyring/ssh' ]] && export SSH_AUTH_SOCK='/run/user/1000/keyring/ssh' diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh new file mode 100644 index 0000000..05f152b --- /dev/null +++ b/zsh/aliases.zsh @@ -0,0 +1,37 @@ +## +# Aliases and functions +# + +alias '...'='../..' + +ls_options=('--almost-all' '--classify' '--color=auto' + '--human-readable' '--group-directories-first') +alias ls='ls "${ls_options[@]}"' +alias ll='ls "${ls_options[@]}" -l' + +alias mkdir='mkdir -vp' +alias df='df -h' + +alias acp='acp -g' +alias amv='amv -g' + +alias ncmpcpp='ncmpcpp -c ~/.config/ncmpcpp/config' +alias wefree='weechat -a -r "/connect Freenode"' +alias ms='mbsync -c "$XDG_CONFIG_HOME/mbsyncrc" theos' + +alias sprin='curl -F "sprunge=<-" http://sprunge.us' +sprfile() { + curl -F "sprunge=<$1" http://sprunge.us +} + +# Colored man +man() { + env LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + man "$@" +} -- cgit v1.2.3-70-g09d2