more stuff
This commit is contained in:
@ -1,23 +1,12 @@
|
|||||||
export PATH=$PATH:$HOME/bin
|
export PATH=$PATH:$HOME/bin
|
||||||
export PATH=$PATH:$HOME/scripts
|
export PATH=$PATH:$HOME/scripts
|
||||||
export MOCWORD_DATA=$HOME/mocword/mocword.sqlite
|
|
||||||
export BASH_PROFILE_SOURCED=true
|
|
||||||
|
|
||||||
export PATH=$PATH:.
|
export PATH=$PATH:.
|
||||||
export GOPATH=$HOME/go
|
export GOPATH=$HOME/go
|
||||||
export GO111MODULE=auto
|
export GO111MODULE=auto
|
||||||
export CLOUDSDK_PYTHON=python2
|
export CLOUDSDK_PYTHON=python2
|
||||||
|
|
||||||
export PATH=$PATH:$HOME/dev/scripts
|
|
||||||
|
|
||||||
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
|
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
|
||||||
export PATH="/usr/local/opt/bison/bin:$PATH"
|
|
||||||
export PATH="/usr/local/Cellar/openvpn/2.4.6/sbin:$PATH"
|
|
||||||
export PATH="$PATH:$GOPATH/bin"
|
|
||||||
export GOBIN=$GOPATH/bin
|
|
||||||
export PATH=$HOME/.npm-global/bin:$PATH
|
|
||||||
export PATH=$HOME/.local/bin:$PATH
|
|
||||||
|
|
||||||
export EDITOR='nvim'
|
export EDITOR='nvim'
|
||||||
|
|
||||||
HISTCONTROL=ignoreboth
|
HISTCONTROL=ignoreboth
|
||||||
@ -27,10 +16,6 @@ export DEVKITPRO=/opt/devkitpro
|
|||||||
export DEVKITARM=${DEVKITPRO}/devkitARM
|
export DEVKITARM=${DEVKITPRO}/devkitARM
|
||||||
export DEVKITPPC=${DEVKITPRO}/devkitPPC
|
export DEVKITPPC=${DEVKITPRO}/devkitPPC
|
||||||
|
|
||||||
export PATH=${DEVKITPRO}/tools/bin:$PATH
|
|
||||||
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
44
zsh/.zshrc
44
zsh/.zshrc
@ -1,14 +1,15 @@
|
|||||||
set -xv
|
# set -xv
|
||||||
|
|
||||||
|
# source ~/fig_prompt
|
||||||
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
if [ -f ${HOME}/.zplug/init.zsh ]; then
|
if [ -f ${HOME}/.zplug/init.zsh ]; then
|
||||||
source ${HOME}/.zplug/init.zsh
|
source ${HOME}/.zplug/init.zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zplug "zsh-users/zsh-syntax-highlighting", defer:2
|
# zplug "zsh-users/zsh-syntax-highlighting", defer:2
|
||||||
zplug "mafredri/zsh-async", from:"github", use:"async.zsh"
|
# zplug "mafredri/zsh-async", from:"github", use:"async.zsh"
|
||||||
|
|
||||||
unset PS1
|
|
||||||
source ~/.bash_profile
|
|
||||||
|
|
||||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
||||||
# Initialization code that may require console input (password prompts, [y/n]
|
# Initialization code that may require console input (password prompts, [y/n]
|
||||||
@ -18,7 +19,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
|
|||||||
fi
|
fi
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||||
plugins=(zsh-autosuggestions)
|
plugins=(zsh-async zsh-autosuggestions)
|
||||||
|
|
||||||
ZSH_THEME=powerlevel10k/powerlevel10k
|
ZSH_THEME=powerlevel10k/powerlevel10k
|
||||||
DISABLE_AUTO_TITLE=true
|
DISABLE_AUTO_TITLE=true
|
||||||
@ -192,10 +193,6 @@ POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=1
|
|||||||
typeset POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='▓▒░'
|
typeset POWERLEVEL9K_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL='▓▒░'
|
||||||
typeset POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='░▒▓'
|
typeset POWERLEVEL9K_RIGHT_PROMPT_FIRST_SEGMENT_START_SYMBOL='░▒▓'
|
||||||
|
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
|
||||||
|
|
||||||
# color customization
|
# color customization
|
||||||
|
|
||||||
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='216'
|
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='216'
|
||||||
@ -235,31 +232,10 @@ zstyle :bracketed-paste-magic paste-init pasteinit
|
|||||||
zstyle :bracketed-paste-magic paste-finish pastefinish
|
zstyle :bracketed-paste-magic paste-finish pastefinish
|
||||||
### Fix slowness of pastes
|
### Fix slowness of pastes
|
||||||
|
|
||||||
source ~/.aliases.sh
|
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
|
|
||||||
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
|
|
||||||
export PATH="/usr/local/opt/curl/bin:$PATH"
|
|
||||||
|
|
||||||
# "transport endpoint is not connected" errors
|
# "transport endpoint is not connected" errors
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
export FZF_DEFAULT_OPTS="--preview 'echo {}' --preview-window down:3:wrap --bind ?:toggle-preview"
|
export FZF_DEFAULT_OPTS="--preview 'echo {}' --preview-window down:3:wrap --bind ?:toggle-preview"
|
||||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
|
||||||
|
|
||||||
fixup_ssh_auth_sock() {
|
source ~/.bash_profile
|
||||||
if [[ -n ${SSH_AUTH_SOCK} && ! -e ${SSH_AUTH_SOCK} ]]
|
|
||||||
then
|
|
||||||
local new_sock=$(echo /tmp/ssh-*/agent.*(=UNom[1]))
|
|
||||||
if [[ -n ${new_sock} ]]
|
|
||||||
then
|
|
||||||
export SSH_AUTH_SOCK=${new_sock}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
if [[ -n ${SSH_AUTH_SOCK} ]]
|
|
||||||
then
|
|
||||||
autoload -U add-zsh-hook
|
|
||||||
add-zsh-hook preexec fixup_ssh_auth_sock
|
|
||||||
fi
|
|
||||||
|
@ -10,10 +10,19 @@ FIG_STATE_HASH_FILE="state.hash"
|
|||||||
# in here that do not change the Fig state.
|
# in here that do not change the Fig state.
|
||||||
BLACKBOX_IGNORE=">.*(xl|ll|figstatus|status|diff|root|exportedcl|preloading|debugfetchconfig)"
|
BLACKBOX_IGNORE=">.*(xl|ll|figstatus|status|diff|root|exportedcl|preloading|debugfetchconfig)"
|
||||||
|
|
||||||
|
# Choose an md5 tool that's available.
|
||||||
|
if command -v md5sum >> /dev/null; then
|
||||||
|
MD5TOOL=md5sum
|
||||||
|
elif command -v md5 >> /dev/null; then
|
||||||
|
MD5TOOL=md5
|
||||||
|
else
|
||||||
|
MD5TOOL=cat
|
||||||
|
fi
|
||||||
|
|
||||||
# Returns the root directory of the current Fig client. Should only be called
|
# Returns the root directory of the current Fig client. Should only be called
|
||||||
# from within a Fig client.
|
# from within a Fig client.
|
||||||
function get_fig_client_root() {
|
function get_fig_client_root() {
|
||||||
local root_dir="${PWD%/google3*}"
|
local root_dir="${$(pwd -P)%/google3*}"
|
||||||
echo "$root_dir"
|
echo "$root_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +30,7 @@ function get_fig_client_root() {
|
|||||||
# a Fig client.
|
# a Fig client.
|
||||||
function get_fig_client_name() {
|
function get_fig_client_name() {
|
||||||
local root_dir="$( get_fig_client_root )"
|
local root_dir="$( get_fig_client_root )"
|
||||||
local client_name="${root_dir##/google/*/}"
|
local client_name="${root_dir##/*google/*/}"
|
||||||
echo "$client_name"
|
echo "$client_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +52,10 @@ function get_fig_client_state_hash() {
|
|||||||
file="$( get_fig_client_root )/${file}"
|
file="$( get_fig_client_root )/${file}"
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
if [[ "$file" =~ ".*blackbox.log" ]]; then
|
if [[ "$file" =~ ".*blackbox.log" ]]; then
|
||||||
state_hash="${state_hash}\n$( egrep -v "${BLACKBOX_IGNORE}" "$file" | \
|
state_hash="${state_hash}\n$( egrep -a -v "${BLACKBOX_IGNORE}" "$file" \
|
||||||
md5sum )"
|
| ${MD5TOOL} )"
|
||||||
else
|
else
|
||||||
state_hash="${state_hash}\n$( md5sum "$file" )"
|
state_hash="${state_hash}\n$( ${MD5TOOL} "$file" )"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -99,8 +108,8 @@ function fig_status() {
|
|||||||
|
|
||||||
# Returns whether the current directory is (likely) a Fig-on-CITC client.
|
# Returns whether the current directory is (likely) a Fig-on-CITC client.
|
||||||
function is_fig_client() {
|
function is_fig_client() {
|
||||||
if [[ "$PWD" =~ /google/src/cloud/$USER/* ]] && \
|
if [[ "$(pwd -P)" =~ /google/src/cloud/$USER/* ]] && \
|
||||||
[[ -d ${PWD%%/google3*}/.hg ]]; then
|
[[ -d ${$(pwd -P)%%/google3*}/.hg ]]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
@ -123,6 +132,7 @@ function is_fig_client() {
|
|||||||
# FIG_PROMPT_DESCRIPTION: Replaced with $description
|
# FIG_PROMPT_DESCRIPTION: Replaced with $description
|
||||||
# FIG_PROMPT_CHANGENAME: Replaced with $changename
|
# FIG_PROMPT_CHANGENAME: Replaced with $changename
|
||||||
# FIG_PROMPT_HAS_SHELVE: Replaced with $has_shelve
|
# FIG_PROMPT_HAS_SHELVE: Replaced with $has_shelve
|
||||||
|
# FIG_PROMPT_SHORT: Replaced with $short
|
||||||
function get_fig_prompt_template() {
|
function get_fig_prompt_template() {
|
||||||
echo -n '%b:%B%F{white}['
|
echo -n '%b:%B%F{white}['
|
||||||
echo -n '%F{yellow}FIG_PROMPT_MODIFIED%F{green}FIG_PROMPT_ADDED'
|
echo -n '%F{yellow}FIG_PROMPT_MODIFIED%F{green}FIG_PROMPT_ADDED'
|
||||||
@ -145,7 +155,25 @@ function get_fig_prompt() {
|
|||||||
unknown=$figstatus[4]
|
unknown=$figstatus[4]
|
||||||
unexported=$figstatus[5]
|
unexported=$figstatus[5]
|
||||||
obsolete=$figstatus[6]
|
obsolete=$figstatus[6]
|
||||||
cl=$figstatus[7]
|
# Turn the cl number into a hyperlink.
|
||||||
|
# This can be disabled by setting the environment variable
|
||||||
|
# "FIG_PROMPT_NO_HYPERLINKS=1"
|
||||||
|
#
|
||||||
|
# This works in most terminals. Complete list can be found
|
||||||
|
# here: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
|
||||||
|
# According to the above link, there is no way to reliably determine whether
|
||||||
|
# a terminal emulator supports hyperlinks. Use color support as a way to
|
||||||
|
# attempt to determine hyperlink support. If a terminal emulator supports
|
||||||
|
# > 8 colors, it likely supports hyperlinks.
|
||||||
|
COLORS=$(tput colors 2> /dev/null)
|
||||||
|
if [ $? != 0 ] || [ $COLORS -le 8 ] || [ "${FIG_PROMPT_NO_HYPERLINKS:-unset}" != "unset" ]; then
|
||||||
|
# Colors are not supported; although this does not mean that hyperlinks
|
||||||
|
# are not supported, we will disable by default.
|
||||||
|
cl=$figstatus[7]
|
||||||
|
else
|
||||||
|
# Colors are supported; enable hyperlinks
|
||||||
|
cl="\e]8;;http://cl/${figstatus[7]}\e\\\\${figstatus[7]}\e]8;;\e\\\\ "
|
||||||
|
fi
|
||||||
description=$figstatus[8]
|
description=$figstatus[8]
|
||||||
branch=$figstatus[9]
|
branch=$figstatus[9]
|
||||||
if [ -z "$branch" ]; then
|
if [ -z "$branch" ]; then
|
||||||
@ -161,6 +189,7 @@ function get_fig_prompt() {
|
|||||||
if [ -d "$shelve_dir" ] && /bin/ls -1qA "$shelve_dir" | grep -q .; then
|
if [ -d "$shelve_dir" ] && /bin/ls -1qA "$shelve_dir" | grep -q .; then
|
||||||
has_shelve="!"
|
has_shelve="!"
|
||||||
fi
|
fi
|
||||||
|
short=$figstatus[14]
|
||||||
|
|
||||||
local tpl="$(get_fig_prompt_template)"
|
local tpl="$(get_fig_prompt_template)"
|
||||||
tpl="${tpl//FIG_PROMPT_MODIFIED/$modified}"
|
tpl="${tpl//FIG_PROMPT_MODIFIED/$modified}"
|
||||||
@ -173,6 +202,7 @@ function get_fig_prompt() {
|
|||||||
tpl="${tpl//FIG_PROMPT_DESCRIPTION/$description}"
|
tpl="${tpl//FIG_PROMPT_DESCRIPTION/$description}"
|
||||||
tpl="${tpl//FIG_PROMPT_CHANGENAME/$changename}"
|
tpl="${tpl//FIG_PROMPT_CHANGENAME/$changename}"
|
||||||
tpl="${tpl//FIG_PROMPT_HAS_SHELVE/$has_shelve}"
|
tpl="${tpl//FIG_PROMPT_HAS_SHELVE/$has_shelve}"
|
||||||
|
tpl="${tpl//FIG_PROMPT_SHORT/$short}"
|
||||||
echo "$tpl"
|
echo "$tpl"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,3 +253,30 @@ function fig_prop() {
|
|||||||
figstatus=("${(@f)$( fig_status )}")
|
figstatus=("${(@f)$( fig_status )}")
|
||||||
echo "${figstatus[$FIG_STATUS_INDICES[$1]]}"
|
echo "${figstatus[$FIG_STATUS_INDICES[$1]]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Collects the properties of the current Fig repository into the FIG_PROPS
|
||||||
|
# global associative array.
|
||||||
|
#
|
||||||
|
# Example usage:
|
||||||
|
# function my_hg_prompt {
|
||||||
|
# collect_fig_props
|
||||||
|
# echo "${FIG_PROPS["modified"]} ${FIG_PROPS["cl"]} ${FIG_PROPS["description"]}"
|
||||||
|
# }
|
||||||
|
# PROMPT='%n@%m[$(my_hg_prompt)] %#'
|
||||||
|
#
|
||||||
|
# See fig_prop for a list of valid properties
|
||||||
|
function collect_fig_props() {
|
||||||
|
if ! is_fig_client; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -Ag FIG_PROPS
|
||||||
|
|
||||||
|
figstatus=("${(@f)$( fig_status )}")
|
||||||
|
|
||||||
|
# Map to global associative array FIG_PROPS
|
||||||
|
for index in "${(@k)FIG_STATUS_INDICES}" ; do
|
||||||
|
FIG_PROPS[${index}]="${figstatus[${FIG_STATUS_INDICES[${index}]}]}"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user