summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zshrc15
1 files changed, 15 insertions, 0 deletions
diff --git a/zshrc b/zshrc
index 694f7d7..71e7898 100644
--- a/zshrc
+++ b/zshrc
@@ -29,6 +29,7 @@ function zshPlug() {
}
}
+
# Plugins
zshPlug 'zsh-users/zsh-autosuggestions'
@@ -37,6 +38,7 @@ if which zoxide &> /dev/null; then
zshPlug 'ajeetdsouza/zoxide'
fi
+
# Key definition
# Use `Ctrl-v` + key-combination of interest to find key codes.
@@ -56,6 +58,7 @@ key[CtrlW]="\Cw"
key[Backspace]="\C?"
key[CtrlBackspace]="\CH"
+
# Color definition
typeset -A color
@@ -77,6 +80,7 @@ setopt correctall
setopt hist_ignore_all_dups
setopt interactivecomments
+
# Basic alias
if ! which exa &> /dev/null; then
@@ -95,10 +99,12 @@ alias grep='\grep --color=auto -Hn'
alias fd="fd --color auto --no-ignore"
alias rg="rg --color auto --no-ignore"
+
# Basic environment
export PS_FORMAT='pid,pgid,etime,user,comm'
+
# Colorful man pages
man() {
@@ -111,12 +117,14 @@ man() {
command man "$@"
}
+
# History
HISTFILE=~/.zshist
HISTSIZE=1000
SAVEHIST=1000
+
# Completion
autoload -Uz compinit && compinit
@@ -130,6 +138,7 @@ zstyle ':completion:*:descriptions' format "$color[lightOrange] -- %d --$color[n
zmodload zsh/complist
bindkey -M menuselect "$key[ShiftTab]" reverse-menu-complete
+
# Key mappings
# Set vim as default mode
@@ -182,6 +191,7 @@ bindkey -M viins "$key[CtrlW]" backward-kill-word
bindkey -M viins "$key[Backspace]" backward-delete-char
bindkey -M viins "$key[CtrlBackspace]" emacs-backward-kill-word
+
# Dirstack
DIRSTACKSIZE=8
@@ -192,6 +202,7 @@ function _goDir() {
cd -$1
}
+
# Prompt: git helper
function git_info() {
@@ -217,6 +228,7 @@ function git_info() {
echo -n "${GIT_PROMPT_PREFIX}${branch}${dirty}${ahead}${GIT_PROMPT_SUFFIX}"
}
+
# Prompt
function printBase16() {
@@ -284,6 +296,7 @@ function _uninstallMyPrompt() {
#_installMyPrompt
_installMyPromptBase16
+
# hooks see man zshmisc(1)
function preexec_cmdTime() {
@@ -304,9 +317,11 @@ function disableCmdTime() {
precmd_functions=(${precmd_functions#precmd_cmdTime})
}
+
# need to do after compinit
zshPlug 'zsh-users/zsh-syntax-highlighting'
+
# fzf
function load_fzf() {
[[ $- == *i* ]] || return