diff --git a/dotfiles/zpreztorc b/dotfiles/zpreztorc index fbb2a5f..14e8d09 100644 --- a/dotfiles/zpreztorc +++ b/dotfiles/zpreztorc @@ -29,14 +29,11 @@ zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto_custom zstyle ':prezto:load' pmodule \ 'environment' \ 'terminal' \ - 'editor' \ 'completion' \ - 'matir' \ 'git' \ 'python' \ 'syntax-highlighting' \ - 'history-substring-search' \ - 'prompt' + 'history-substring-search' # # Autosuggestions diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 6ab2a47..0d4042d 100755 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -25,6 +25,7 @@ setopt \ pushdtohome \ sharehistory unsetopt beep histbeep listbeep flowcontrol +# vi keybindings bindkey -v # Allow core files @@ -56,7 +57,7 @@ unsetopt cdablevars # Deduplicate the path typeset -U path -# Keybindings +# Additional Keybindings bindkey '^[[A' history-search-backward bindkey '^[[B' history-search-forward # ctrl-arrow keys @@ -66,7 +67,7 @@ bindkey '^P' up-history bindkey '^N' down-history bindkey '^?' backward-delete-char bindkey '^h' backward-delete-char -# ok, a few convenience bindings +# ok, a few emacs convenience bindings bindkey '^w' backward-kill-word bindkey '^r' history-incremental-search-backward @@ -74,13 +75,17 @@ bindkey '^r' history-incremental-search-backward if [[ $- == *i* ]] ; then if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi # zsh-only-ism to avoid error if glob doesn't expand - for file in $HOME/.zshrc.d/*(N) ; do source "$file" ; done - # extra completions - fpath=(~/.zshrc.completions $fpath) + for file in $HOME/.zshrc.d/*.zsh(N) ; do source "$file" ; done + # extra completions, prompt + fpath=(~/.zshrc.completions ~/.zshrc.d/matir_prompt $fpath) # Completion zstyle :compinstall filename "${HOME}/.zshrc" zstyle ':completion:*' users root ${USER} + # Modules after fpath autoload -Uz compinit && compinit + autoload -Uz promptinit && promptinit + # Prompt + prompt matir fi # In case ack is named ack-grep diff --git a/dotfiles/zprezto_custom/matir/functions/prompt_matir_setup b/dotfiles/zshrc.d/matir_prompt/prompt_matir_setup similarity index 75% rename from dotfiles/zprezto_custom/matir/functions/prompt_matir_setup rename to dotfiles/zshrc.d/matir_prompt/prompt_matir_setup index 4adec18..3a33a8b 100644 --- a/dotfiles/zprezto_custom/matir/functions/prompt_matir_setup +++ b/dotfiles/zshrc.d/matir_prompt/prompt_matir_setup @@ -30,25 +30,23 @@ function prompt_matir_setup { PROMPT+='%{$fg[blue]%}${vcs_info_msg_0_}' # VCS info PROMPT+='%{$fg[white]%}%#%{$reset_color%} ' # prompt symbol - # Editor options - zstyle ':prezto:module:editor:info:keymap:primary' format '' - zstyle ':prezto:module:editor:info:keymap:primary:insert' format 'I' - zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format 'O' - zstyle ':prezto:module:editor:info:keymap:alternate' format ' [VICMD]' - zstyle ':prezto:module:editor:info:completing' format '...' - # Rprompt setup local show_return="✘ " - # Default is to show the return value - if zstyle -T ':prezto:module:prompt' show-return-val; then - show_return+='%? ' - fi RPROMPT='%(?:: %{$fg[red]%}' RPROMPT+=${show_return} + RPROMPT+='%? ' RPROMPT+='%{$reset_color%})' - RPROMPT+='${editor_info[keymap]}' + RPROMPT+='${PROMPT_VIMODE}' } +function zle-keymap-select { + # Add prompt info + PROMPT_VIMODE="${${KEYMAP/vicmd/ [VICMD]}/(main|viins)/}" + zle reset-prompt +} + +zle -N zle-keymap-select + function prompt_matir_precmd { vcs_info if (( $+functions[python-info] )); then