updates
This commit is contained in:
parent
9f38b5f6cd
commit
058b5a8c65
3
.bash_aliases
Normal file
3
.bash_aliases
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
alias tt='toot tui'
|
||||||
|
alias tf='toot follow'
|
||||||
|
alias ts='toot search'
|
7
.bash_logout
Normal file
7
.bash_logout
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# ~/.bash_logout: executed by bash(1) when login shell exits.
|
||||||
|
|
||||||
|
# when leaving the console clear the screen to increase privacy
|
||||||
|
|
||||||
|
if [ "$SHLVL" = 1 ]; then
|
||||||
|
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
|
||||||
|
fi
|
46
.bashrc
46
.bashrc
|
@ -76,21 +76,21 @@ esac
|
||||||
if [ -x /usr/bin/dircolors ]; then
|
if [ -x /usr/bin/dircolors ]; then
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
#alias dir='dir --color=auto'
|
alias dir='dir --color=auto'
|
||||||
#alias vdir='vdir --color=auto'
|
alias vdir='vdir --color=auto'
|
||||||
|
|
||||||
#alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
#alias fgrep='fgrep --color=auto'
|
alias fgrep='fgrep --color=auto'
|
||||||
#alias egrep='egrep --color=auto'
|
alias egrep='egrep --color=auto'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# colored GCC warnings and errors
|
# colored GCC warnings and errors
|
||||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||||
|
|
||||||
# some more ls aliases
|
# some more ls aliases
|
||||||
#alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
#alias la='ls -A'
|
alias la='ls -A'
|
||||||
#alias l='ls -CF'
|
alias l='ls -CF'
|
||||||
|
|
||||||
# Alias definitions.
|
# Alias definitions.
|
||||||
# You may want to put all your additions into a separate file like
|
# You may want to put all your additions into a separate file like
|
||||||
|
@ -111,33 +111,3 @@ if ! shopt -oq posix; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
. "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
# Only load liquidprompt in interactive shells, not from a script or from scp
|
|
||||||
# echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# Initialize starship prompt
|
|
||||||
__main() {
|
|
||||||
local major="${BASH_VERSINFO[0]}"
|
|
||||||
local minor="${BASH_VERSINFO[1]}"
|
|
||||||
|
|
||||||
if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then
|
|
||||||
source <(/home/$USER/.cargo/bin/starship init bash --print-full-init)
|
|
||||||
else
|
|
||||||
source /dev/stdin <<<"$(/home/$USER/.cargo/bin/starship init bash --print-full-init)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
__main
|
|
||||||
unset -f __main
|
|
||||||
|
|
||||||
# pnpm
|
|
||||||
export PNPM_HOME="/home/$USER/.local/share/pnpm"
|
|
||||||
case ":$PATH:" in
|
|
||||||
*":$PNPM_HOME:"*) ;;
|
|
||||||
*) export PATH="$PNPM_HOME:$PATH" ;;
|
|
||||||
esac
|
|
||||||
# pnpm end
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# shell built-ins
|
# shell built-ins
|
||||||
alias cat = bat
|
alias cat = bat
|
||||||
|
|
||||||
|
# clamav aliases
|
||||||
|
alias cs = clamscan --recursive=yes --infected
|
||||||
|
|
||||||
# toot aliases
|
# toot aliases
|
||||||
alias tt = toot tui
|
alias tt = toot tui
|
||||||
alias ts = toot search
|
alias ts = toot search
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
syntax on
|
|
||||||
|
|
||||||
set number
|
|
||||||
set encoding=utf-8
|
|
||||||
set textwidth=80
|
|
|
@ -27,3 +27,10 @@ alias ..="cd .."
|
||||||
alias gitacp="git add . && git commit -m 'updates' && git push"
|
alias gitacp="git add . && git commit -m 'updates' && git push"
|
||||||
alias gitinit="git init && git add . && git commit -m 'init'"
|
alias gitinit="git init && git add . && git commit -m 'init'"
|
||||||
alias gits="git status --show-stash"
|
alias gits="git status --show-stash"
|
||||||
|
|
||||||
|
alias tt='toot tui'
|
||||||
|
alias tf='toot follow'
|
||||||
|
alias ts='toot search'
|
||||||
|
|
||||||
|
alias aup='sudo apt-get install --only-upgrade'
|
||||||
|
alias upl='sudo apt-get update && sudo apt list --upgradable'
|
||||||
|
|
106
.zshrc
106
.zshrc
|
@ -1,101 +1,15 @@
|
||||||
. "$HOME/.zsh_aliases"
|
. "$HOME/.zsh_aliases"
|
||||||
. "$HOME/.cargo/env"
|
|
||||||
|
|
||||||
# ZSH has a quirk where `preexec` is only run if a command is actually run (i.e
|
if [[ -x /usr/bin/dircolors ]]; then
|
||||||
# pressing ENTER at an empty command line will not cause preexec to fire). This
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||||
# can cause timing issues, as a user who presses "ENTER" without running a command
|
alias ls='ls --color=auto'
|
||||||
# will see the time to the start of the last command, which may be very large.
|
alias dir='dir --color=auto'
|
||||||
|
alias vdir='vdir --color=auto'
|
||||||
# To fix this, we create STARSHIP_START_TIME upon preexec() firing, and destroy it
|
alias grep='grep --color=auto'
|
||||||
# after drawing the prompt. This ensures that the timing for one command is only
|
alias fgrep='fgrep --color=auto'
|
||||||
# ever drawn once (for the prompt immediately after it is run).
|
alias egrep='egrep --color=auto'
|
||||||
|
|
||||||
zmodload zsh/parameter # Needed to access jobstates variable for STARSHIP_JOBS_COUNT
|
|
||||||
|
|
||||||
# Defines a function `__starship_get_time` that sets the time since epoch in millis in STARSHIP_CAPTURED_TIME.
|
|
||||||
if [[ $ZSH_VERSION == ([1-4]*) ]]; then
|
|
||||||
# ZSH <= 5; Does not have a built-in variable so we will rely on Starship's inbuilt time function.
|
|
||||||
__starship_get_time() {
|
|
||||||
STARSHIP_CAPTURED_TIME=$(/home/oliver/.cargo/bin/starship time)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
zmodload zsh/datetime
|
|
||||||
zmodload zsh/mathfunc
|
|
||||||
__starship_get_time() {
|
|
||||||
(( STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000)) ))
|
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The two functions below follow the naming convention `prompt_<theme>_<hook>`
|
if [[ -f ~/.zsh_aliases ]]; then
|
||||||
# for compatibility with Zsh's prompt system. See
|
. ~/.zsh_aliases
|
||||||
# https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Functions/Prompts/promptinit#L155
|
|
||||||
|
|
||||||
# Runs before each new command line.
|
|
||||||
prompt_starship_precmd() {
|
|
||||||
# Save the status, because subsequent commands in this function will change $?
|
|
||||||
STARSHIP_CMD_STATUS=$? STARSHIP_PIPE_STATUS=(${pipestatus[@]})
|
|
||||||
|
|
||||||
# Calculate duration if a command was executed
|
|
||||||
if (( ${+STARSHIP_START_TIME} )); then
|
|
||||||
__starship_get_time && (( STARSHIP_DURATION = STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME ))
|
|
||||||
unset STARSHIP_START_TIME
|
|
||||||
# Drop status and duration otherwise
|
|
||||||
else
|
|
||||||
unset STARSHIP_DURATION STARSHIP_CMD_STATUS STARSHIP_PIPE_STATUS
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use length of jobstates array as number of jobs. Expansion fails inside
|
|
||||||
# quotes so we set it here and then use the value later on.
|
|
||||||
STARSHIP_JOBS_COUNT=${#jobstates}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Runs after the user submits the command line, but before it is executed and
|
|
||||||
# only if there's an actual command to run
|
|
||||||
prompt_starship_preexec() {
|
|
||||||
__starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add hook functions
|
|
||||||
autoload -Uz add-zsh-hook
|
|
||||||
add-zsh-hook precmd prompt_starship_precmd
|
|
||||||
add-zsh-hook preexec prompt_starship_preexec
|
|
||||||
|
|
||||||
# Set up a function to redraw the prompt if the user switches vi modes
|
|
||||||
starship_zle-keymap-select() {
|
|
||||||
zle reset-prompt
|
|
||||||
}
|
|
||||||
|
|
||||||
## Check for existing keymap-select widget.
|
|
||||||
# zle-keymap-select is a special widget so it'll be "user:fnName" or nothing. Let's get fnName only.
|
|
||||||
__starship_preserved_zle_keymap_select=${widgets[zle-keymap-select]#user:}
|
|
||||||
if [[ -z $__starship_preserved_zle_keymap_select ]]; then
|
|
||||||
zle -N zle-keymap-select starship_zle-keymap-select;
|
|
||||||
else
|
|
||||||
# Define a wrapper fn to call the original widget fn and then Starship's.
|
|
||||||
starship_zle-keymap-select-wrapped() {
|
|
||||||
$__starship_preserved_zle_keymap_select "$@";
|
|
||||||
starship_zle-keymap-select "$@";
|
|
||||||
}
|
|
||||||
zle -N zle-keymap-select starship_zle-keymap-select-wrapped;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export STARSHIP_SHELL="zsh"
|
|
||||||
|
|
||||||
# Set up the session key that will be used to store logs
|
|
||||||
STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767
|
|
||||||
STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars.
|
|
||||||
export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess.
|
|
||||||
|
|
||||||
VIRTUAL_ENV_DISABLE_PROMPT=1
|
|
||||||
|
|
||||||
setopt promptsubst
|
|
||||||
|
|
||||||
PROMPT='$(/home/oliver/.cargo/bin/starship prompt --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")'
|
|
||||||
|
|
||||||
RPROMPT='$(/home/oliver/.cargo/bin/starship prompt --right --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")'
|
|
||||||
|
|
||||||
PROMPT2="$(/home/oliver/.cargo/bin/starship prompt --continuation)"
|
|
||||||
|
|
||||||
# Only load liquidprompt in interactive shells, not from a script or from scp
|
|
||||||
# echo $- | grep -q i 2>/dev/null && . /usr/share/liquidprompt/liquidprompt
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue