diff options
author | Yaroslav <contact@yaroslavps.com> | 2020-01-17 19:14:34 +0300 |
---|---|---|
committer | Yaroslav <contact@yaroslavps.com> | 2020-01-17 19:14:34 +0300 |
commit | 5eee5b44924bf9079a67d5bc7612bfad56ddeed3 (patch) | |
tree | 0408697aba64aa3f012f134bdc35316841a4b404 /dotfiles/.config/zsh/.zshrc | |
parent | 8f672e8a119e9efd23272f7cb0ff4550872f9d47 (diff) | |
download | swayrice-5eee5b44924bf9079a67d5bc7612bfad56ddeed3.tar.gz swayrice-5eee5b44924bf9079a67d5bc7612bfad56ddeed3.zip |
config restructuring and cleanup
Diffstat (limited to 'dotfiles/.config/zsh/.zshrc')
-rw-r--r-- | dotfiles/.config/zsh/.zshrc | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/dotfiles/.config/zsh/.zshrc b/dotfiles/.config/zsh/.zshrc new file mode 100644 index 0000000..889a88f --- /dev/null +++ b/dotfiles/.config/zsh/.zshrc @@ -0,0 +1,103 @@ +# Colors and prompt +autoload -U colors && colors +if [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then + . /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +fi + +autoload -Uz vcs_info +precmd_vcs_info() { vcs_info } +precmd_functions+=( precmd_vcs_info ) +setopt prompt_subst + +PROMPT=$'\n''%{[38;5;14m%}%B%~ ${reset_color}%F{yellow}${vcs_info_msg_0_}%f'$'\n''%F{green}→%f ' +RPROMPT='%{[38;5;14m%} %n%f@%F{red}%m%f' +zstyle ':vcs_info:git:*' formats ' %b' + +# Basic auto/tab complete: +autoload -U compinit +zstyle ':completion:*' menu select +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' completer _expand _complete _ignored _approximate +zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' +zmodload zsh/complist +compinit +_comp_options+=(globdots) # Include hidden files. + +zstyle :compinstall filename '/home/yaroslav/.zshrc' + +# History +HISTFILE=~/.cache/zsh_history +HISTSIZE=10000 +SAVEHIST=10000 +setopt appendhistory autocd beep notify + +# vi mode +bindkey -v + +# Use vim keys in tab complete menu: +bindkey -M menuselect 'H' vi-backward-char +bindkey -M menuselect 'K' vi-up-line-or-history +bindkey -M menuselect 'L' vi-forward-char +bindkey -M menuselect 'J' vi-down-line-or-history +bindkey -v '^?' backward-delete-char + +# Change cursor shape for different vi modes. +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'underscore' ]]; then + echo -ne '\e[3 q' + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} + +echo -ne '\e[5 q' # Use beam shape cursor on startup. +preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + +zle -N zle-keymap-select + +# Some aliases +alias v="nvim" +alias abook="abook -C $HOME/.config/abook/abookrc --datafile $HOME/Documents/contacts/addressbook" +alias eslint="./node_modules/.bin/eslint" +alias ls='ls -hN --color=auto --group-directories-first' +weath() { curl wttr.in/$1 ;} # Check the weather (give city or leave blank). + +# Generic shortcuts +alias music="ncmpcpp" +alias clock="ncmpcpp -s clock" +alias news="newsboat" +alias files="ranger" +alias audio="ncpamixer" +alias calendar="calcurse" +alias contacts="abook" +alias calc="R --no-save" + +# Mounting drive shortcuts +alias mnt="udisksctl mount -b" +alias umnt="udisksctl unmount -b" +alias dlock="udisksctl lock -b" +alias dulock="udisksctl unlock -b" + +# Internet +alias yt="youtube-dl --add-metadata -ic" # Download video link +alias yta="youtube-dl --add-metadata -xic" # Download only audio +alias YT="youtube-viewer" +alias starwars="telnet towel.blinkenlights.nl" + +# Audio and Music +alias mute="lmc mute" +alias vu="lmc up" +alias vd="lmc down" +alias play="mpc toggle" +alias next="mpc next" +alias prev="mpc prev" +alias pause="mpc pause" +alias beg="mpc seek 0%" +alias lilbak="mpc seek -10" +alias lilfor="mpc seek +10" +alias bigbak="mpc seek -120" +alias bigfor="mpc seek +120" |