Merge remote-tracking branch 'sorin/pull/329' into giddie-theme
Conflicts: modules/prompt/functions/prompt_giddie_setup
This commit is contained in:
commit
e564f53a5a
8 changed files with 38 additions and 43 deletions
|
@ -96,7 +96,7 @@ zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-va
|
||||||
|
|
||||||
# Populate hostname completion.
|
# Populate hostname completion.
|
||||||
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
||||||
${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//,/ }
|
${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2>/dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
|
||||||
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
|
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
|
||||||
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
||||||
)'
|
)'
|
||||||
|
|
|
@ -270,10 +270,6 @@ bindkey -M vicmd "v" edit-command-line
|
||||||
bindkey -M vicmd "u" undo
|
bindkey -M vicmd "u" undo
|
||||||
bindkey -M vicmd "$key_info[Control]R" redo
|
bindkey -M vicmd "$key_info[Control]R" redo
|
||||||
|
|
||||||
# Switch to command mode.
|
|
||||||
bindkey -M viins "jk" vi-cmd-mode
|
|
||||||
bindkey -M viins "kj" vi-cmd-mode
|
|
||||||
|
|
||||||
if (( $+widgets[history-incremental-pattern-search-backward] )); then
|
if (( $+widgets[history-incremental-pattern-search-backward] )); then
|
||||||
bindkey -M vicmd "?" history-incremental-pattern-search-backward
|
bindkey -M vicmd "?" history-incremental-pattern-search-backward
|
||||||
bindkey -M vicmd "/" history-incremental-pattern-search-forward
|
bindkey -M vicmd "/" history-incremental-pattern-search-forward
|
||||||
|
|
|
@ -56,6 +56,7 @@ Aliases
|
||||||
- `gcO` checks out paths to work tree using the *HEAD* commit.
|
- `gcO` checks out paths to work tree using the *HEAD* commit.
|
||||||
- `gcf` amends the tip of the current branch using the same log message as
|
- `gcf` amends the tip of the current branch using the same log message as
|
||||||
*HEAD*.
|
*HEAD*.
|
||||||
|
- `gcF` amends the tip of the current branch.
|
||||||
- `gcp` applies changes introduced by existing commits.
|
- `gcp` applies changes introduced by existing commits.
|
||||||
- `gcP` applies changes introduced by existing commits without committing.
|
- `gcP` applies changes introduced by existing commits without committing.
|
||||||
- `gcr` reverts existing commits by reverting patches and recording new
|
- `gcr` reverts existing commits by reverting patches and recording new
|
||||||
|
@ -292,7 +293,7 @@ Second, format how the above attributes are displayed in prompts.
|
||||||
'prompt' ' git(%b)' \
|
'prompt' ' git(%b)' \
|
||||||
'rprompt' '[%R]'
|
'rprompt' '[%R]'
|
||||||
|
|
||||||
Last, add `$git_info[prompt]` to `$PROMPT` and `$git_info[prompt]` to
|
Last, add `$git_info[prompt]` to `$PROMPT` and `$git_info[rprompt]` to
|
||||||
`$RPROMPT` respectively and call `git-info` in the `prompt_name_preexec` hook
|
`$RPROMPT` respectively and call `git-info` in the `prompt_name_preexec` hook
|
||||||
function.
|
function.
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ alias gcm='git commit --message'
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
alias gcO='git checkout HEAD --'
|
alias gcO='git checkout HEAD --'
|
||||||
alias gcf='git commit --amend --reuse-message HEAD'
|
alias gcf='git commit --amend --reuse-message HEAD'
|
||||||
|
alias gcF='git commit --amend'
|
||||||
alias gcp='git cherry-pick --ff'
|
alias gcp='git cherry-pick --ff'
|
||||||
alias gcP='git cherry-pick --no-commit'
|
alias gcP='git cherry-pick --no-commit'
|
||||||
alias gcr='git revert'
|
alias gcr='git revert'
|
||||||
|
|
|
@ -7,8 +7,8 @@ Installing GNU utilities on non-GNU systems in `$PATH` without a prefix, i.e.
|
||||||
`ls` instead of `gls`, is not recommended since scripts that target other
|
`ls` instead of `gls`, is not recommended since scripts that target other
|
||||||
utilities will be broken.
|
utilities will be broken.
|
||||||
|
|
||||||
However, for interactive use, prefixed commands can be wrapped in their
|
This module wraps GNU utilities in functions without a prefix for interactive
|
||||||
non-prefixed counterparts.
|
use.
|
||||||
|
|
||||||
This module must be loaded **before** the *utility* module.
|
This module must be loaded **before** the *utility* module.
|
||||||
|
|
||||||
|
|
|
@ -1,48 +1,45 @@
|
||||||
#
|
#
|
||||||
# A colourful, friendly, multiline theme with some handy features:
|
# A colourful, friendly, multiline theme with some handy features:
|
||||||
#
|
#
|
||||||
# * Simple VCS branch, staged, and unstaged indication.
|
|
||||||
# * Prompt character is different in a VCS repository.
|
|
||||||
# * Last command exit status is displayed clearly if it was non-zero.
|
|
||||||
#
|
|
||||||
# This theme is particularly well-suited to the pastel colours used by KDE's
|
|
||||||
# Konsole terminal emulator.
|
|
||||||
#
|
|
||||||
# Screenshot: http://i.imgur.com/rCo3S.png
|
|
||||||
#
|
|
||||||
# Authors:
|
# Authors:
|
||||||
# Paul Gideon Dann <pdgiddie@gmail.com>
|
# Paul Gideon Dann <pdgiddie@gmail.com>
|
||||||
#
|
#
|
||||||
|
# Features:
|
||||||
# TODO: Currently only tailored to git.
|
# - Simple VCS branch, staged, and unstaged indication.
|
||||||
|
# - Prompt character is different in a VCS repository.
|
||||||
|
# - Last command exit status is displayed when non-zero.
|
||||||
|
#
|
||||||
|
# Screenshots:
|
||||||
|
# http://i.imgur.com/rCo3S.png
|
||||||
|
#
|
||||||
|
|
||||||
function prompt_giddie_precmd {
|
function prompt_giddie_precmd {
|
||||||
vcs_info
|
|
||||||
|
|
||||||
# Replace "/home/<user>" with "~"
|
# Replace "/home/<user>" with "~"
|
||||||
prompt_custom_wd=${PWD/#$HOME/\~}
|
_prompt_giddie_pwd="${PWD/#$HOME/~}"
|
||||||
|
|
||||||
# Choose prompt symbol based on whether on not we're in a repository.
|
# Choose prompt symbol based on whether or not we are in a repository.
|
||||||
{ git branch 2>&1 } >/dev/null
|
if (( $+commands[git] )) && git rev-parse 2> /dev/null; then
|
||||||
if (( $? == 0 )); then
|
_prompt_giddie_symbol='±'
|
||||||
prompt_symbol='±'
|
vcs_info
|
||||||
else
|
else
|
||||||
prompt_symbol=')'
|
_prompt_giddie_symbol=')'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This will be displayed additionally if the last exit status was non-zero.
|
|
||||||
prompt_exit_status="%F{red}%B-> [%?]%b%f"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function prompt_giddie_setup {
|
function prompt_giddie_setup {
|
||||||
autoload -Uz vcs_info
|
setopt LOCAL_OPTIONS
|
||||||
autoload -Uz add-zsh-hook
|
unsetopt XTRACE KSH_ARRAYS
|
||||||
add-zsh-hook precmd prompt_giddie_precmd
|
|
||||||
|
|
||||||
prompt_opts=(cr percent subst)
|
prompt_opts=(cr percent subst)
|
||||||
|
|
||||||
zstyle ':omz:completion' indicator '%F{green}...%f'
|
# Load required functions.
|
||||||
zstyle ':omz:prompt' vicmd '%F{yellow}--- VI-COMMAND ---%f'
|
autoload -Uz vcs_info
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
# Add hook to call our function before each command
|
||||||
|
add-zsh-hook precmd prompt_giddie_precmd
|
||||||
|
|
||||||
|
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
|
||||||
|
zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{yellow}--- VI-COMMAND ---%f'
|
||||||
zstyle ':vcs_info:*' enable git
|
zstyle ':vcs_info:*' enable git
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u'
|
zstyle ':vcs_info:*' formats ' on %F{magenta}%b%f%c%u'
|
||||||
|
@ -50,13 +47,13 @@ function prompt_giddie_setup {
|
||||||
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
|
zstyle ':vcs_info:*' stagedstr '%F{green}+%f'
|
||||||
zstyle ':vcs_info:*' unstagedstr '%F{green}!%f'
|
zstyle ':vcs_info:*' unstagedstr '%F{green}!%f'
|
||||||
|
|
||||||
PROMPT='%(?..${prompt_exit_status}
|
# Define prompts.
|
||||||
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${prompt_custom_wd}%f${vcs_info_msg_0_}
|
PROMPT='%(?..%F{red}%B-> [%?]%b%f
|
||||||
%F{blue}${prompt_symbol}%f '
|
)%F{magenta}%n%f@%F{yellow}%m%f|%F{green}${_prompt_giddie_pwd}%f${vcs_info_msg_0_}
|
||||||
|
%F{blue}${_prompt_giddie_symbol}%f '
|
||||||
RPROMPT=
|
RPROMPT=
|
||||||
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
|
SPROMPT='zsh: correct %F{magenta}%R%f to %F{green}%r%f [nyae]? '
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_giddie_setup "$@"
|
prompt_giddie_setup "$@"
|
||||||
|
|
||||||
# vim: ft=zsh
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
|
||||||
# Load manually installed rbenv into the shell session.
|
# Load manually installed rbenv into the shell session.
|
||||||
elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then
|
elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then
|
||||||
path=("$HOME/.rbenv/bin" $path)
|
path=("$HOME/.rbenv/bin" $path)
|
||||||
eval "$(rbenv init - zsh)"
|
eval "$(rbenv init - --no-rehash zsh)"
|
||||||
|
|
||||||
# Load package manager installed rbenv into the shell session.
|
# Load package manager installed rbenv into the shell session.
|
||||||
elif (( $+commands[rbenv] )); then
|
elif (( $+commands[rbenv] )); then
|
||||||
eval "$(rbenv init - zsh)"
|
eval "$(rbenv init - --no-rehash zsh)"
|
||||||
|
|
||||||
# Install local gems according to operating system conventions.
|
# Install local gems according to operating system conventions.
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{
|
{
|
||||||
# Compile the completion dump to increase startup speed.
|
# Compile the completion dump to increase startup speed.
|
||||||
zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
|
zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
|
||||||
if [[ "$zcompdump" -nt "${zcompdump}.zwc" || ! -s "${zcompdump}.zwc" ]]; then
|
if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
|
||||||
zcompile "$zcompdump"
|
zcompile "$zcompdump"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue