.zshrc cleanup

This commit is contained in:
2019-03-15 15:37:57 -04:00
parent dd972cc41e
commit 0b43f26f8f

142
.zshrc
View File

@@ -7,8 +7,9 @@ export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"
#ZSH_THEME="avit"
# ZSH_THEME="robbyrussell"
# ZSH_THEME="avit"
ZSH_THEME="bureau"
# Uncomment the following line to use case-sensitive completion.
@@ -55,60 +56,20 @@ COMPLETION_WAITING_DOTS="true"
# Add wisely, as too many plugins slow down shell startup.
plugins=(git zsh-autosuggestions zsh-completions)
source $ZSH/oh-my-zsh.sh
# User configuration
##########
# HISTORY
##########
HISTFILE=$HOME/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt EXTENDED_HISTORY
setopt HIST_VERIFY
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Dont record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Dont record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Dont write duplicate entries in the history file.
setopt inc_append_history
setopt share_history
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
# ---------------------------------------------------------------------------------------------------------------------
# ==> Source External Configs
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
#------------------------------------------------history start
## HISTORY - ideas from https://github.com/mrnugget/dotfiles/blob/master/zshrc
###########
source $ZSH/oh-my-zsh.sh
source $HOME/.zsh_aliases
source $HOME/.zsh_functions
# ---------------------------------------------------------------------------------------------------------------------
# ==> History
#
HISTFILE=$HOME/.zsh_history
HISTSIZE=50000
@@ -125,70 +86,45 @@ setopt HIST_SAVE_NO_DUPS # Dont write duplicate entries in the history f
setopt inc_append_history
setopt share_history
#-----------------------------------------------history end
#------------------------------------------------keybindings start
# KEY BINDINGS - also from https://github.com/mrnugget/dotfiles/blob/master/zshrc
# ---------------------------------------------------------------------------------------------------------------------
# ==> KEY BINDINGS - from https://dougblack.io/words/zsh-vi-mode.html
#
# Vim Keybindings
bindkey -v
# Open line in Vim by pressing 'v' in Command-Mode
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# Push current line to buffer stack, return to PS1
bindkey "^Q" push-input
# Make up/down arrow put the cursor at the end of the line
# instead of using the vi-mode mappings for these keys
bindkey "\eOA" up-line-or-history
bindkey "\eOB" down-line-or-history
bindkey "\eOC" forward-char
bindkey "\eOD" backward-char
# CTRL-R to search through history
bindkey '^R' history-incremental-search-backward
# CTRL-S to search forward in history
bindkey '^S' history-incremental-search-forward
# Accept the presented search result
bindkey '^Y' accept-search
# Use the arrow keys to search forward/backward through the history,
# using the first word of what's typed in as search word
bindkey '^[[A' history-search-backward
bindkey '^[[B' history-search-forward
# Use the same keys as bash for history forward/backward: Ctrl+N/Ctrl+P
bindkey '^P' history-search-backward
bindkey '^N' history-search-forward
# Backspace working the way it should
bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^?' backward-delete-char
bindkey '^[[3~' delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward
# Some emacs keybindings won't hurt nobody
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line
#function zle-line-init zle-keymap-select {
# VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
# RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/}$(git_custom_status) $EPS1"
# zle reset-prompt
#}
#------------------------------------------------keybindings end
function zle-line-init zle-keymap-select {
RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
RPS2=$RPS1
zle reset-prompt
}
# Source zsh aliases
zle -N zle-line-init
zle -N zle-keymap-select
export KEYTIMEOUT=1
# ---------------------------------------------------------------------------------------------------------------------
# ==> FZF
#
source $HOME/.zsh_aliases
# Source zsh functions
#
source $HOME/.zsh_functions
# FZF Specific
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Include hidden files
export FZF_DEFAULT_COMMAND='find .'
# set PATH so it includes user's private bin if it exists
# ---------------------------------------------------------------------------------------------------------------------
# ==> set PATH so it includes user's private ~/bin if it exists
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
# Remap CapsLock Key to Escape
setxkbmap -option caps:escape