Compare commits

...

23 Commits

Author SHA1 Message Date
Jacopo De Simoi fdc7ed3b30 Add a comment about dropbox 1 month ago
Jacopo De Simoi 7ebe805f0f Try to push to the fork only when working on the work-tree 1 month ago
Jacopo De Simoi 6811cc2638 Force registering of async git_prompt_info 1 month ago
Jacopo De Simoi 4205d6de3a Fix theme with the async git prompt 1 month ago
Jacopo De Simoi 247d70e17a Fix branch not appearing in recent oh-my-zsh versions 1 month ago
Jacopo De Simoi 0571eb3ba3 Push on upgrade 1 month ago
Jacopo De Simoi 764fbcf1c7 Prevent stalling on remote mounts 1 month ago
Jacopo De Simoi 8cdc32a637 Fix issue with number of jobs not detected anymore 1 month ago
Jacopo De Simoi 5bba1b25f8 Fix whitespace 1 month ago
Jacopo De Simoi 0f8ede087e Tint the vertical bar according to exit code 1 month ago
Jacopo De Simoi c11fb56390 Fix jobs counting 1 month ago
Jacopo De Simoi 5b02ce0da6 Fix another typo (should fixup with previous commit) 1 month ago
Jacopo De Simoi 305b480e69 Add git_commits_behind 1 month ago
Jacopo De Simoi b5989b7a40 Add todo about exit status 1 month ago
Jacopo De Simoi ecea62f8b1 Tint the # if root 1 month ago
Jacopo De Simoi 08adc18188 add old single-line configuration 1 month ago
Jacopo De Simoi bdb3c470a9 Use with solarized colorscheme 1 month ago
Jacopo De Simoi b2f2a6c136 Unsure of what this is 1 month ago
Jacopo De Simoi f86360f531 use PoP-like marks for number of jobs 1 month ago
Jacopo De Simoi 2716cdbb3f Add number of jobs on the right 1 month ago
Jacopo De Simoi 4dce3e2283 Add commits ahead to prompt 1 month ago
Jacopo De Simoi 424f707451 Add variation on gentoo theme 1 month ago
Jacopo De Simoi e4a9d755a9 do not mess with ssh-agent identites 1 month ago
  1. 4
      lib/git.zsh
  2. 1
      plugins/per-directory-history/per-directory-history.plugin.zsh
  3. 149
      plugins/per-directory-history/per-directory-history.plugin.zsh
  4. 6
      plugins/ssh-agent/ssh-agent.plugin.zsh
  5. 66
      themes/gentoo-wilder.zsh-theme
  6. 24
      themes/gentoo-wildersingleline.zsh-theme
  7. 5
      tools/upgrade.sh

@ -162,11 +162,7 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt \
# or any of the other prompt variables
function _defer_async_git_register() {
# Check if git_prompt_info is used in a prompt variable
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
_omz_register_handler _omz_git_prompt_info
;;
esac
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)

@ -0,0 +1,149 @@
#!/usr/bin/env zsh
#
# This is a implementation of per directory history for zsh, some
# implementations of which exist in bash[1,2]. It also implements
# a per-directory-history-toggle-history function to change from using the
# directory history to using the global history. In both cases the history is
# always saved to both the global history and the directory history, so the
# toggle state will not effect the saved histories. Being able to switch
# between global and directory histories on the fly is a novel feature as far
# as I am aware.
#
#-------------------------------------------------------------------------------
# Configuration
#-------------------------------------------------------------------------------
#
# HISTORY_BASE a global variable that defines the base directory in which the
# directory histories are stored
#
#-------------------------------------------------------------------------------
# History
#-------------------------------------------------------------------------------
#
# The idea/inspiration for a per directory history is from Stewart MacArthur[1]
# and Dieter[2], the implementation idea is from Bart Schaefer on the the zsh
# mailing list[3]. The implementation is by Jim Hester in September 2012.
#
# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
# [2]: http://dieter.plaetinck.be/per_directory_bash
# [3]: http://www.zsh.org/mla/users/1997/msg00226.html
#
################################################################################
#
# Copyright (c) 2012 Jim Hester
#
# This software is provided 'as-is', without any express or implied warranty.
# In no event will the authors be held liable for any damages arising from the
# use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim
# that you wrote the original software. If you use this software in a product,
# an acknowledgment in the product documentation would be appreciated but is
# not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution..
#
################################################################################
#-------------------------------------------------------------------------------
# configuration, the base under which the directory histories are stored
#-------------------------------------------------------------------------------
[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
#-------------------------------------------------------------------------------
# toggle global/directory history used for searching - ctrl-G by default
#-------------------------------------------------------------------------------
function per-directory-history-toggle-history() {
if [[ $_per_directory_history_is_global == true ]]; then
_per-directory-history-set-directory-history
print -n "\nusing local history"
else
_per-directory-history-set-global-history
print -n "\nusing global history"
fi
zle .push-line
zle .accept-line
}
autoload per-directory-history-toggle-history
zle -N per-directory-history-toggle-history
bindkey '^G' per-directory-history-toggle-history
#-------------------------------------------------------------------------------
# implementation details
#-------------------------------------------------------------------------------
_per_directory_history_directory="$HISTORY_BASE${PWD:A}/history"
function _per-directory-history-change-directory() {
_per_directory_history_directory="$HISTORY_BASE${PWD:A}/history"
mkdir -p ${_per_directory_history_directory:h}
if [[ $_per_directory_history_is_global == false ]]; then
#save to the global history
fc -AI $HISTFILE
#save history to previous file
local prev="$HISTORY_BASE${OLDPWD:A}/history"
mkdir -p ${prev:h}
fc -AI $prev
#discard previous directory's history
local original_histsize=$HISTSIZE
HISTSIZE=0
HISTSIZE=$original_histsize
#read history in new file
if [[ -e $_per_directory_history_directory ]]; then
fc -R $_per_directory_history_directory
fi
fi
}
function _per-directory-history-addhistory() {
print -Sr -- ${1%%$'\n'}
fc -p $_per_directory_history_directory
}
function _per-directory-history-set-directory-history() {
if [[ $_per_directory_history_is_global == true ]]; then
fc -AI $HISTFILE
local original_histsize=$HISTSIZE
HISTSIZE=0
HISTSIZE=$original_histsize
if [[ -e "$_per_directory_history_directory" ]]; then
fc -R "$_per_directory_history_directory"
fi
fi
_per_directory_history_is_global=false
}
function _per-directory-history-set-global-history() {
if [[ $_per_directory_history_is_global == false ]]; then
fc -AI $_per_directory_history_directory
local original_histsize=$HISTSIZE
HISTSIZE=0
HISTSIZE=$original_histsize
if [[ -e "$HISTFILE" ]]; then
fc -R "$HISTFILE"
fi
fi
_per_directory_history_is_global=true
}
#add functions to the exec list for chpwd and zshaddhistory
chpwd_functions=(${chpwd_functions[@]} "_per-directory-history-change-directory")
zshaddhistory_functions=(${zshaddhistory_functions[@]} "_per-directory-history-addhistory")
#start in directory mode
mkdir -p ${_per_directory_history_directory:h}
_per_directory_history_is_global=true
_per-directory-history-set-directory-history

@ -74,8 +74,8 @@ function _add_identities() {
fi
# pass extra arguments to ssh-add
local args
zstyle -a :omz:plugins:ssh-agent ssh-add-args args
# local args
# zstyle -a :omz:plugins:ssh-agent ssh-add-args args
# if ssh-agent quiet mode, pass -q to ssh-add
zstyle -t :omz:plugins:ssh-agent quiet && args=(-q $args)
@ -93,7 +93,7 @@ function _add_identities() {
fi
fi
ssh-add "${args[@]}" ${^not_loaded}
# Ssh-add "${args[@]}" ${^not_loaded}
}
# Add a nifty symlink for screen/tmux if agent forwarding is enabled

@ -0,0 +1,66 @@
#! /bin/zsh
jobs_marker=( )
# Solarized
solarized_base03=$'\e[1;30m'
solarized_base02=$'\e[0;30m'
solarized_base01=$'\e[1;32m'
solarized_base00=$'\e[1;33m'
solarized_base0=$'\e[1;34m'
solarized_base1=$'\e[1;36m'
solarized_base2=$'\e[0;37m'
solarized_base3=$'\e[1;37m'
solarized_yellow=$'\e[0;33m'
solarized_orange=$'\e[1;31m'
solarized_red=$'\e[0;31m'
solarized_magenta=$'\e[0;35m'
solarized_violet=$'\e[1;35m'
solarized_blue=$'\e[0;34m'
solarized_cyan=$'\e[0;36m'
solarized_green=$'\e[0;32m'
dir_tint=$solarized_blue
jobs_tint=$solarized_green
root_tint=$solarized_magenta
function prompt_char {
if [ $UID -eq 0 ]; then echo "%{$root_tint%}#%{$reset_color%}" && return;
fi
is_curr_dir_remote || {git branch >/dev/null 2>/dev/null && echo '±' && return}
echo '%#'
}
function is_curr_dir_remote {
[[ $(pwd) =~ .*nextcloud.* ]] # || [[ $(pwd) =~ .*dropbox.* ]]
}
function git_stuff {
is_curr_dir_remote || echo -n $(git_prompt_info)$(git_commits_ahead)$(git_commits_behind)
}
# newline ⎡⎧⎛⎢
return_code_vertical_top="%(?.%{$reset_color%}.%{$solarized_magenta%})⎥%{$reset_color%} "
return_code_vertical="%(?.%{$reset_color%}.%{$solarized_magenta%})⎥%{$reset_color%} "
PROMPT="
$return_code_vertical_top"
# add username only from remote
[[ "$SSH_CONNECTION" != '' ]] && PROMPT+=$'%(!.%{\e[0;34m%}%}.%{\e[0;32m%}%}%n@)%m '
PROMPT+=$'%{$dir_tint%}%(!.%1~.%~)%{$reset_color%}$(git_stuff)
${return_code_vertical}$(prompt_char)%{$reset_color%} '
RPROMPT=$'%{$jobs_tint%}$jobs_marker[${(%):-%j}]%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{\033[1;32m%} · %{\033[0;36m%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[blue]%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{\e[0;35m%} !"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX="%{\033[0;36m%} "
ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX="↑%{$fg_bold[blue]%}"
ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX="%{\033[0;36m%} "
ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX="↓%{$fg_bold[blue]%}"

@ -0,0 +1,24 @@
function prompt_char {
if [ $UID -eq 0 ]; then echo "#" && return;
fi
git branch >/dev/null 2>/dev/null && echo '±' && return
echo '%#'
}
function get_nr_jobs() {
repeat $(jobs | wc -l) printf '▶'
}
PROMPT='
%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~)$(git_prompt_info)$(git_commits_ahead)
$(prompt_char)%{$reset_color%} '
RPROMPT='%{$fg_bold[green]%}$(get_nr_jobs)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{\033[0;36m%}·"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[blue]%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX="%{\033[0;36m%} "
ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX="↑%{$fg_bold[blue]%}"

@ -252,6 +252,11 @@ if LANG= git pull --quiet --rebase $remote $branch; then
# Save the commit prior to updating
git config oh-my-zsh.lastVersion "$last_commit"
# Push to fork
if [[ $remote == upstream ]]; then
git push --force origin $branch
fi
# Print changelog to the terminal
if [[ $interactive == true && $verbose_mode == default ]]; then
ZSH="$ZSH" command zsh -f "$ZSH/tools/changelog.sh" HEAD "$last_commit"

Loading…
Cancel
Save