2022-10-17 22:35:06 -04:00
|
|
|
if test -f /usr/share/doc/fzf/examples/completion.zsh &> /dev/null; then
|
|
|
|
source /usr/share/doc/fzf/examples/completion.zsh
|
|
|
|
fi
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2024-01-25 20:29:19 -05:00
|
|
|
ssh_ids=$(find "$HOME/.ssh" -type f -name "id*" | grep -v '\.pub')
|
|
|
|
if [[ "$ssh_ids" != "" ]]; then
|
|
|
|
eval "$(ssh-agent -s)" &> /dev/null
|
|
|
|
for id in $(echo $ssh_ids); do
|
|
|
|
ssh-add "$id" &> /dev/null
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2020-04-21 12:39:18 -04:00
|
|
|
HISTFILE=~/.histfile
|
2024-01-22 13:30:45 -05:00
|
|
|
HISTSIZE=SAVEHIST=100000000
|
2020-04-21 12:39:18 -04:00
|
|
|
setopt appendhistory autocd notify
|
|
|
|
setopt menu_complete
|
|
|
|
unsetopt beep
|
|
|
|
bindkey -v
|
2020-04-21 13:54:09 -04:00
|
|
|
|
2020-06-12 18:44:25 -04:00
|
|
|
autoload -Uz up-line-or-beginning-search
|
|
|
|
autoload -Uz down-line-or-beginning-search
|
|
|
|
zle -N up-line-or-beginning-search
|
|
|
|
zle -N down-line-or-beginning-search
|
|
|
|
bindkey '\eOA' up-line-or-beginning-search
|
|
|
|
bindkey '\e[A' up-line-or-beginning-search
|
|
|
|
bindkey '\eOB' down-line-or-beginning-search
|
|
|
|
bindkey '\e[B' down-line-or-beginning-search
|
2020-04-21 13:54:09 -04:00
|
|
|
|
|
|
|
export EDITOR="vim"
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2020-04-21 12:39:18 -04:00
|
|
|
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
|
|
|
|
zstyle ':completion:*' matcher-list '+' '+m:{[:lower:]}={[:upper:]}' '+m:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+r:|[._-]=** r:|=** l:|=*'
|
2020-04-21 13:54:09 -04:00
|
|
|
zstyle :compinstall filename '~/.zshrc'
|
2021-10-06 13:15:39 -04:00
|
|
|
zstyle ':completion:*' ignored-patterns '*.class'
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2020-04-21 12:39:18 -04:00
|
|
|
autoload -Uz compinit
|
|
|
|
compinit
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2020-04-21 12:39:18 -04:00
|
|
|
# enable color support of ls and also add handy aliases
|
|
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
|
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
alias egrep='egrep --color=auto'
|
|
|
|
fi
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2023-12-13 12:23:16 -05:00
|
|
|
export PATH=~/.bin:$HOME/.dotnet:~/.local/bin:/usr/local/go/bin:$PATH
|
2020-04-21 12:39:18 -04:00
|
|
|
|
2024-01-22 14:04:24 -05:00
|
|
|
fignore=(o class swp)
|
2020-04-21 12:39:18 -04:00
|
|
|
|
|
|
|
function SetTtyColors() {
|
2024-01-09 10:12:38 -05:00
|
|
|
echo -en "\e]P0""2c2d27" # black 1
|
|
|
|
echo -en "\e]P1""f92672" # darkgrey 2
|
|
|
|
echo -en "\e]P2""00aa00" # darkred 3
|
|
|
|
echo -en "\e]P3""f92672" # red 4
|
|
|
|
echo -en "\e]P4""4444aa" # darkgreen 5
|
|
|
|
echo -en "\e]P5""a6e22e" # green 6
|
|
|
|
echo -en "\e]P6""f59762" # brown 7
|
|
|
|
echo -en "\e]P7""fdfff1" # yellow 8
|
|
|
|
echo -en "\e]P8""f92672" # darkblue 9
|
|
|
|
echo -en "\e]P9""f92672" # blue 10
|
|
|
|
echo -en "\e]PA""55ff55" # darkmagenta 11
|
|
|
|
echo -en "\e]PB""f92672" # magenta 12
|
|
|
|
echo -en "\e]PC""66d9ef" # darkcyan 13
|
|
|
|
echo -en "\e]PD""ae81ff" # cyan 14
|
|
|
|
echo -en "\e]PE""a1efe4" # lightgray 15
|
|
|
|
echo -en "\e]PF""fdfff1" # white 16
|
2020-04-21 12:39:18 -04:00
|
|
|
clear
|
|
|
|
}
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2020-04-21 12:39:18 -04:00
|
|
|
if [ "$TERM" = "linux" ]; then
|
|
|
|
SetTtyColors
|
|
|
|
fi
|
2020-02-09 12:29:17 -05:00
|
|
|
|
2023-12-13 15:09:02 -05:00
|
|
|
source ~/.shell_aliases
|
|
|
|
source ~/.zsh_local
|
|
|
|
|
2024-02-18 01:15:03 -05:00
|
|
|
function dconf-dump {
|
|
|
|
local ignore_section=false
|
2024-02-19 00:28:03 -05:00
|
|
|
# Ignores certain values/sections that shouldn't be synced
|
|
|
|
dconf dump / | grep -v "gtk-theme='" | while read -r line; do
|
2024-02-19 00:12:19 -05:00
|
|
|
if [[ "$line" == "[org/gnome/desktop/background]" ]] || [[ "$line" == "[org/gnome/shell/extensions/gsconnect"* ]]; then
|
|
|
|
ignore_section=true
|
|
|
|
elif [[ "$line" == "["* ]]; then
|
|
|
|
ignore_section=false
|
|
|
|
fi
|
|
|
|
if ! $ignore_section; then
|
|
|
|
echo "$line"
|
2024-02-18 01:15:03 -05:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2024-02-17 14:40:50 -05:00
|
|
|
function push-dconf {
|
2024-02-17 14:06:08 -05:00
|
|
|
if command -v scpace &> /dev/null; then
|
2024-02-19 00:12:19 -05:00
|
|
|
rm /tmp/dconf-dump &> /dev/null
|
2024-02-18 01:15:03 -05:00
|
|
|
dconf-dump > /tmp/dconf-dump || return 1
|
2024-02-17 14:19:30 -05:00
|
|
|
scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump'
|
2024-02-17 14:06:08 -05:00
|
|
|
else
|
|
|
|
echo "An alias for scpace has not been defined on this device!"
|
|
|
|
fi
|
2024-02-17 14:40:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function pushdot {
|
|
|
|
cd "$DOT_DIR" || return 1
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
git commit -a && git push -u origin main && push-dconf
|
|
|
|
else
|
|
|
|
git commit -a -m "$@" && git push -u origin main && push-dconf
|
|
|
|
fi
|
2020-02-09 12:36:34 -05:00
|
|
|
cd -
|
|
|
|
}
|
2020-04-23 11:46:53 -04:00
|
|
|
|
|
|
|
function getdot {
|
2023-12-13 15:09:02 -05:00
|
|
|
cd "$DOT_DIR" || return 1
|
2024-01-16 06:42:13 -05:00
|
|
|
git pull && ./copy.sh
|
2024-02-17 14:06:08 -05:00
|
|
|
if command -v scpace &> /dev/null; then
|
2024-02-18 22:20:01 -05:00
|
|
|
rm /tmp/dconf-dump
|
2024-02-17 14:19:30 -05:00
|
|
|
scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump
|
2024-02-19 00:42:52 -05:00
|
|
|
dconf-dump > /tmp/current-dconf-dump
|
2024-02-19 00:47:38 -05:00
|
|
|
if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then
|
|
|
|
echo
|
|
|
|
echo "Incoming conf changes:"
|
|
|
|
echo
|
|
|
|
git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump
|
|
|
|
fi
|
2024-02-17 14:06:08 -05:00
|
|
|
dconf load / < /tmp/dconf-dump || return 1
|
|
|
|
else
|
|
|
|
echo "An alias for scpace has not been defined on this device!"
|
|
|
|
fi
|
2024-01-22 20:38:11 -05:00
|
|
|
cd - > /dev/null
|
2020-04-23 11:46:53 -04:00
|
|
|
}
|
2020-04-26 20:17:35 -04:00
|
|
|
|
2022-10-17 22:35:06 -04:00
|
|
|
if which starship &> /dev/null; then
|
|
|
|
eval "$(starship init zsh)"
|
|
|
|
fi
|
|
|
|
|
2024-01-22 13:30:45 -05:00
|
|
|
last_get_file="/tmp/.$(whoami)-dotfiles-last-get"
|
|
|
|
current_date="$(date '+%Y-%m-%d')"
|
|
|
|
if test -d "$DOT_DIR" && [[ "$current_date" != "$(cat "$last_get_file")" ]] &> /dev/null; then
|
|
|
|
echo "$current_date" > "$last_get_file"
|
|
|
|
getdot
|
|
|
|
fi
|
|
|
|
|
2024-01-24 21:33:45 -05:00
|
|
|
export nvm_loaded=false
|
|
|
|
|
|
|
|
alias nvm="load_nvm; nvm"
|
|
|
|
alias node="load_nvm; node"
|
|
|
|
|
|
|
|
function load_nvm {
|
|
|
|
if $nvm_loaded; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
unalias nvm
|
|
|
|
unalias node
|
|
|
|
export NVM_DIR="$HOME/.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
|
|
|
|
export nvm_loaded=true
|
|
|
|
}
|
2023-09-27 12:21:12 -04:00
|
|
|
|
2023-12-13 13:39:18 -05:00
|
|
|
test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh && source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
2023-12-13 13:42:44 -05:00
|
|
|
test -f "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh"
|
2024-01-22 14:04:24 -05:00
|
|
|
test -f ~/.cargo/env && source ~/.cargo/env
|