dotfiles

Config files from my daily system
Index Commits Files Refs README
.zshrc_root (4327B)
   1 #                 _
   2 #         _______| |__  _ __ ___
   3 #        |_  / __| '_ \| '__/ __|
   4 #         / /\__ \ | | | | | (__
   5 #        /___|___/_| |_|_|  \___|
   6 #                                
   7 #         by github.com/klewer-martin
   8 #
   9 
  10 HISTFILE=$HOME/.cache/zsh_history
  11 HISTSIZE=1000000
  12 SAVEHIST=$HISTSIZE
  13 ZDOTDIR=$HOME/.config/zsh
  14 
  15 # Do not save less pager history file
  16 LESSHISTFILE=/dev/null
  17 
  18 setopt appendhistory
  19 setopt hist_ignore_all_dups
  20 setopt INC_APPEND_HISTORY  
  21 setopt SHARE_HISTORY
  22 
  23 # If not running interactively, don't do anything
  24 [[ $- != *i* ]] && return
  25 
  26 # Add plugins (because I don't use a plugin manager)
  27 source $HOME/.config/zsh/plugged/zsh-autosuggestions/zsh-autosuggestions.zsh
  28 source $HOME/.config/zsh/plugged/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  29 source $HOME/.config/zsh/plugged/zsh-history-substring-search/zsh-history-substring-search.zsh
  30 
  31 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff0000"
  32 
  33 # Add my personal scripts folder to path
  34 PATH="$PATH:$HOME/soydev/scripts:$HOME/soydev/scripts/statusbar:$HOME/.local/bin:$HOME/go/bin"
  35 
  36 # Set EDITOR and TERM values
  37 export EDITOR=/usr/bin/nvim
  38 
  39 # export TERM='alacritty'
  40 export TERM='xterm-256color'
  41 
  42 PROMPT_EOL_MARK=''
  43 
  44 # vi mode
  45 bindkey -v
  46 export KEYTIMEOUT=1
  47 
  48 # Basic auto/tab complete:
  49 autoload -U compinit
  50 zstyle ':completion:*' menu select
  51 zstyle :compinstall filename '/home/mk/.zshrc'
  52 zmodload zsh/complist
  53 compinit
  54 _comp_options+=(globdots)        # Include hidden files.
  55 
  56 # Use vim keys in tab complete menu:
  57 bindkey -M menuselect 'h' vi-backward-char
  58 bindkey -M menuselect 'k' vi-up-line-or-history
  59 bindkey -M menuselect 'l' vi-forward-char
  60 bindkey -M menuselect 'j' vi-down-line-or-history
  61 
  62 bindkey -v '^?' backward-delete-char
  63 bindkey '^R' history-incremental-pattern-search-backward
  64 
  65 # Change cursor shape for different vi modes.
  66 function zle-keymap-select {
  67   if [[ ${KEYMAP} == vicmd ]] ||
  68      [[ $1 = 'block' ]]; then
  69     echo -ne '\e[1 q'
  70   elif [[ ${KEYMAP} == main ]] ||
  71        [[ ${KEYMAP} == viins ]] ||
  72        [[ ${KEYMAP} = '' ]] ||
  73        [[ $1 = 'beam' ]]; then
  74     echo -ne "\e[5 q"
  75   fi
  76 }
  77 zle -N zle-keymap-select
  78 
  79 zle-line-init() {
  80     zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
  81     echo -ne "\e[5 q"
  82 }
  83 zle -N zle-line-init
  84 
  85 echo -ne '\e[5 q' # Use beam shape cursor on startup.
  86 
  87 preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
  88 
  89 # This is for ranger to display previews properly
  90 set preview_images_method ueberzug
  91 
  92 # Load colors and set a colored prompt:
  93 autoload -U colors && colors
  94 # PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[magenta]%}%M %{$fg[cyan]%}%1~%{$fg[red]%}]%{$reset_color%}%(?..%F{red})$%b%{$reset_color%} "
  95 PS1="%B%{$fg[red]%}[%n%{$fg[green]%} %{$fg[cyan]%}%1~%{$fg[red]%}]%{$reset_color%}%(?..%F{red})#%b%{$reset_color%} "
  96 
  97 # Edit line in vim with ctrl-e:
  98 autoload edit-command-line; zle -N edit-command-line
  99 bindkey '^f' edit-command-line
 100 
 101 setopt autocd
 102 
 103 # This fix my keybord in terminal; (I use st)
 104 autoload -Uz up-line-or-beginning-search
 105 autoload -Uz down-line-or-beginning-search
 106 zle -N up-line-or-beginning-search
 107 zle -N down-line-or-beginning-search
 108 
 109 bindkey '^[[P'    delete-char                    # delete      delete previous char
 110 bindkey '^[[3~'   delete-char                    # delete      delete previous char
 111 bindkey '^[[H'    beginning-of-line             # home       go to the beginning of line
 112 bindkey '^[[F'    end-of-line                   # end        go to the end of line
 113 bindkey '^[[1;5C' forward-word                  # ctrl+right go forward one word
 114 bindkey '^[[1;5D' backward-word                 # ctrl+left  go backward one word
 115 bindkey '^H'      backward-kill-word            # ctrl+bs    delete previous word
 116 bindkey '^[[M'      kill-word                     # ctrl+del   delete next word
 117 
 118 # Source aliases file
 119 source $HOME/.config/zsh/aliases.sh
 120 
 121 # Dynamic window title with zsh shell.
 122 # Shows current directory and running (multi-line) command.
 123 case "$TERM" in (rxvt|rxvt-*|st|st-*|*xterm*|(dt|k|E)term)
 124     local term_title () { print -n "\e]0;${(j: :q)@}\a" }
 125     precmd () {
 126       local DIR="$(print -P '%~ #')"
 127       term_title "$DIR" "zsh"
 128     }
 129     preexec () {
 130       local DIR="$(print -P '%~ #')"
 131       local CMD="${(j:\n:)${(f)1}}"
 132       term_title "$DIR" "$CMD"
 133     }
 134   ;;
 135 esac
 136 
 137 # Enable mouse support for less pager on tmux
 138 [[ ! -z "$TMUX" ]] && export LESS='--mouse'