dots

Dotfiles for Linux
git clone https://git.ckiri.com/cmk/dots.git
Log | Files | Refs | README

dot-zshrc (1348B)


      1 # load version control information
      2 autoload -Uz vcs_info
      3 
      4 # enable the vcs variable & format it
      5 zstyle ':vcs_info:*' enable git
      6 zstyle ':vcs_info:git:*' formats ' (%b)'
      7 
      8 # define the precmd hook function
      9 precmd() {
     10     vcs_info
     11     if test -n "$SSH_CLIENT"
     12     then
     13 	print -Pn "\e]0;SSH %n@%m in %/\a" # show session info on window title
     14     else
     15 	print -Pn "\e]0;%n@%m in %/\a"
     16     fi
     17 }
     18 
     19 # check if connected via ssh
     20 fmt_prompt() {
     21     if test -n "$SSH_CLIENT"
     22     then
     23         print "SSH %n@%m %3~${vcs_info_msg_0_}%(?.. E:%?) %# "
     24     else
     25         print "%3~${vcs_info_msg_0_}%(?.. E:%?) %# "
     26     fi
     27 }
     28 
     29 # prompt configuration
     30 setopt PROMPT_SUBST
     31 PROMPT='$(fmt_prompt)'
     32 
     33 # shell history configuration
     34 HISTSIZE=100000
     35 SAVEHIST=100000
     36 setopt SHARE_HISTORY # share history between sessions
     37 HISTFILE=~/.cache/zsh/history # history cache directory
     38 
     39 # tab-completion
     40 autoload -U compinit
     41 zstyle ':completion:*' menu select
     42 zmodload zsh/complist
     43 compinit
     44 _comp_options+=(globdots) # Include hidden files.
     45 
     46 # keymaps
     47 export KEYTIMEOUT=1
     48 bindkey -v # vi-mode
     49 bindkey -M menuselect 'h' vi-backward-char
     50 bindkey -M menuselect 'k' vi-up-line-or-history
     51 bindkey -M menuselect 'l' vi-forward-char
     52 bindkey -M menuselect 'j' vi-down-line-or-history
     53 bindkey -M vicmd '/' history-incremental-search-backward
     54 
     55 # Aliases
     56 alias nano="${EDITOR}"
     57 alias open="xdg-open"