From ff7c336bd517594e1bab1c27cd504b5a6f62e547 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Appel Date: Tue, 21 Feb 2023 01:08:55 -0500 Subject: added zsh config --- .gitignore | 2 ++ README.md | 1 + zsh/zshrc | 41 +++++++++++++++++++++++++++++++++++++++++ zsh/zshvimodes | 23 +++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 zsh/zshrc create mode 100644 zsh/zshvimodes diff --git a/.gitignore b/.gitignore index f8ba0cc..9eb4ecf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store *packer_compiled.lua +zsh/zshalias +zsh/zshenv diff --git a/README.md b/README.md index 8805b4e..ce0477a 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,4 @@ My personal configuration of various programs * neovim * tmux +* zsh diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100644 index 0000000..9772843 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,41 @@ +# The following lines were added by compinstall + +zstyle ':completion:*' completer _complete _ignored _approximate +zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=* r:|=*' +zstyle ':completion:*' max-errors 3 +zstyle ':completion:*' prompt '%e' +zstyle ':completion:*' squeeze-slashes true +zstyle :compinstall filename '/home/goose/.zshrc' + +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' menu select=1 +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s + +autoload -U compinit +compinit +# End of lines added by compinstall +# Lines configured by zsh-newuser-install +HISTFILE=~/.cache/zsh/zshhist +HISTSIZE=1000 +SAVEHIST=1000 +setopt autocd +unsetopt beep +bindkey -v +# End of lines configured by zsh-newuser-install + +# Plugins +source ~/.config/zsh/zshvimodes + +# Prompt +setopt PROMPT_SUBST +PROMPT='%F{green}%n%f%F{cyan}@%f%F{blue}%m%#%f%F{magenta}%~>%f' +RPROMPT='%B${vim_mode}%b%(?..[%?])' + + +source ~/.profile +source ~/.config/zsh/zshenv +source ~/.config/zsh/zshalias + +#wal colorscheme +[ -f "$HOME/.cache/wal/colors-tty.sh" ] && source ~/.cache/wal/colors-tty.sh ; true diff --git a/zsh/zshvimodes b/zsh/zshvimodes new file mode 100644 index 0000000..ab60972 --- /dev/null +++ b/zsh/zshvimodes @@ -0,0 +1,23 @@ +#vim_ins_mode="%{$fg[cyan]%}[INS]%{$reset_color%}" +vim_ins_mode="" +vim_cmd_mode="%{$fg[green]%}[CMD]%{$reset_color%}" +vim_mode=$vim_ins_mode + +function zle-keymap-select { + vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}" + zle reset-prompt +} +zle -N zle-keymap-select + +function zle-line-finish { + vim_mode=$vim_ins_mode +} +zle -N zle-line-finish + +# Fix a bug when you C-c in CMD mode and you'd be prompted with CMD mode indicator, while in fact you would be in INS mode +# Fixed by catching SIGINT (C-c), set vim_mode to INS and then repropagate the SIGINT, so if anything else depends on it, we will not break it +# Thanks Ron! (see comments) +function TRAPINT() { + vim_mode=$vim_ins_mode + return $(( 128 + $1 )) +} -- cgit v1.2.3