Readd zshrc
This commit is contained in:
@@ -0,0 +1,149 @@
|
|||||||
|
## Prompt
|
||||||
|
autoload -Uz vcs_info
|
||||||
|
autoload -U colors && colors
|
||||||
|
precmd_vcs_info() { vcs_info }
|
||||||
|
precmd_functions+=( precmd_vcs_info )
|
||||||
|
setopt prompt_subst
|
||||||
|
export PROMPT="%{$fg[yellow]%}%m %{$fg_bold[blue]%}%~ %{$fg_bold[green]%}\$vcs_info_msg_0_ %{$reset_color%}"
|
||||||
|
zstyle ':vcs_info:git:*' formats '%b'
|
||||||
|
|
||||||
|
export RPROMPT=""
|
||||||
|
|
||||||
|
## Exports
|
||||||
|
export TERM="xterm-256color"
|
||||||
|
export EDITOR="vim"
|
||||||
|
export LANG="en_US.UTF-8"
|
||||||
|
export PATH=$PATH:$HOME/.local/bin:$HOME/scripts
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
alias vimrc="vim ~/.vimrc"
|
||||||
|
alias zshrc="vim ~/.zshrc"
|
||||||
|
|
||||||
|
alias dotf="cd ~/dotfiles/dotfiles"
|
||||||
|
alias dotdrop="~/dotfiles/dotdrop.sh" --cfg="~/dotfiles/config.yaml"
|
||||||
|
|
||||||
|
alias fonts="/home/$USER/.local/share/fonts"
|
||||||
|
alias listfonts="fc-list :scalable=true:spacing=mono: family"
|
||||||
|
alias cachefonts="fc-cache -f -v"
|
||||||
|
|
||||||
|
alias w="vim ~/vimwiki/index.md"
|
||||||
|
alias r="ranger"
|
||||||
|
alias s="cd ~/scripts/"
|
||||||
|
alias c='clear'
|
||||||
|
|
||||||
|
alias l='ls -lFh' #size,show type,human readable
|
||||||
|
alias la='ls -lAFh' #long list,show almost all,show type,human readable
|
||||||
|
alias ll='ls -l' #long list
|
||||||
|
|
||||||
|
alias rm='rm -i' # Ask before removal
|
||||||
|
alias cp='cp -i' # Ask before removal
|
||||||
|
alias mv='mv -i' # Ask before removal
|
||||||
|
|
||||||
|
alias gaa="git add ."
|
||||||
|
alias gst="git status"
|
||||||
|
alias gd="git diff"
|
||||||
|
alias gc="git commit -v"
|
||||||
|
alias gc!="git commit -v --amend"
|
||||||
|
alias gl="git pull"
|
||||||
|
alias gp="git push"
|
||||||
|
alias glog="git log --oneline --decorate --graph"
|
||||||
|
|
||||||
|
## Local Aliases
|
||||||
|
if [ -f ~/.zshrc_local ]; then
|
||||||
|
source ~/.zshrc_local
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Keybinds
|
||||||
|
bindkey -s "^e" "ranger\n"
|
||||||
|
|
||||||
|
## Completion
|
||||||
|
unsetopt menu_complete # do not autoselect the first completion entry
|
||||||
|
unsetopt flowcontrol
|
||||||
|
setopt auto_menu # show completion menu on successive tab press
|
||||||
|
setopt complete_in_word
|
||||||
|
setopt always_to_end
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit -C
|
||||||
|
_comp_options+=(globdots)
|
||||||
|
|
||||||
|
# Case Insensitive completion
|
||||||
|
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||||
|
|
||||||
|
## Directory navigation
|
||||||
|
setopt autocd autopushd
|
||||||
|
|
||||||
|
## History command configuration
|
||||||
|
setopt extended_history # record timestamp of command in HISTFILE
|
||||||
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
setopt share_history # share command history data inside tmux
|
||||||
|
export HISTFILE="$HOME/.zsh_history"
|
||||||
|
|
||||||
|
## ssh-agent
|
||||||
|
if [ -f ~/.ssh/agent.env ] ; then
|
||||||
|
. ~/.ssh/agent.env > /dev/null
|
||||||
|
if ! kill -0 $SSH_AGENT_PID > /dev/null 2>&1; then
|
||||||
|
echo "Stale agent file found. Spawning a new agent. "
|
||||||
|
eval `ssh-agent | tee ~/.ssh/agent.env`
|
||||||
|
ssh-add
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Starting ssh-agent"
|
||||||
|
eval `ssh-agent | tee ~/.ssh/agent.env`
|
||||||
|
ssh-add
|
||||||
|
fi
|
||||||
|
|
||||||
|
## vi-mode
|
||||||
|
bindkey -v
|
||||||
|
export KEYTIMEOUT=1
|
||||||
|
|
||||||
|
# Updates editor information when the keymap changes.
|
||||||
|
function zle-keymap-select() {
|
||||||
|
zle reset-prompt
|
||||||
|
zle -R
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N zle-keymap-select
|
||||||
|
|
||||||
|
function vi_mode_prompt_info() {
|
||||||
|
MODE_INDICATOR="%{$fg_bold[green]%}<<<%{$reset_color%}"
|
||||||
|
echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# define right prompt, regardless of whether the theme defined it
|
||||||
|
RPS1='$(vi_mode_prompt_info)'
|
||||||
|
RPS2=$RPS1
|
||||||
|
|
||||||
|
# Enable backspace to delete in vi-mode
|
||||||
|
bindkey -v '^?' backward-delete-char
|
||||||
|
|
||||||
|
## fzf
|
||||||
|
export FZF_DEFAULT_OPTS='--preview="head {}" --layout=reverse --bind=tab:down --bind=btab:up'
|
||||||
|
|
||||||
|
## fzf Bindings in zsh (C-r and C-t)
|
||||||
|
if [[ -x $(which fzf 2> /dev/null) ]]
|
||||||
|
then
|
||||||
|
source ~/.vim/bundle/fzf/shell/key-bindings.zsh
|
||||||
|
else
|
||||||
|
bindkey '^R' history-incremental-search-backward
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Use C-z for 'fg'
|
||||||
|
fancy-ctrl-z () {
|
||||||
|
if [[ $#BUFFER -eq 0 ]]; then
|
||||||
|
BUFFER="fg"
|
||||||
|
zle accept-line
|
||||||
|
else
|
||||||
|
zle push-input
|
||||||
|
zle clear-screen
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
zle -N fancy-ctrl-z
|
||||||
|
bindkey '^Z' fancy-ctrl-z
|
||||||
|
|
||||||
|
## Nord dir colors
|
||||||
|
test -r "~/.dir_colors" && eval $(dircolors ~/.dir_colors)
|
||||||
|
|||||||
Reference in New Issue
Block a user