many updates

This commit is contained in:
Solomon Laing 2023-02-04 19:18:17 +10:30
parent d938676e9f
commit c1ead62c03
6 changed files with 88 additions and 41 deletions

View File

@ -1,7 +1,7 @@
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
*) return ;;
esac
export PATH=$PATH:$HOME/.local/bin
@ -27,11 +27,30 @@ shopt -s checkwinsize
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias lsa='ls -lah'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# use lf to switch directories and bind it to ctrl-o
function lfcd() {
tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
function pomo() {
arg1=$1
shift
args="$*"
min=${arg1:?Example: pomo 25 Take a break}
sec=$((min * 60))
msg="${args:?Example: pomo 25 Take a break}"
while true; do
date '+%H:%M' && sleep "${sec:?}" && notify-send -u critical -t 0 -a pomo "${msg:?}"
done
}
# Alias definitions.
# You may want to put all your additions into a separate file like
@ -46,32 +65,32 @@ fi
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
set_exit_code() {
exit_code=$?
[[ $exit_code -eq 0 ]] || printf "$(tput setaf 1) $exit_code $(tput sgr0)"
exit_code=$?
[[ $exit_code -eq 0 ]] || printf "$(tput setaf 1) $exit_code $(tput sgr0)"
}
set_prompt() {
PS1_BAT="$(bash-status-bat)"
PS1_GIT="$(bash-status-git)"
PS1_BAT="$(bash-status-bat)"
PS1_GIT="$(bash-status-git)"
dir_perm=$(ls -ld | awk '{ print $3 }')
if [[ "$dir_perm" == "$USER" ]]; then
dir="\[\033[00;36m\]\w"
else
dir="\[\033[00;31m\]\w"
fi
dir_perm=$(ls -ld | awk '{ print $3 }')
if [[ "$dir_perm" == "$USER" ]]; then
dir="\[\033[00;36m\]\w"
else
dir="\[\033[00;31m\]\w"
fi
PS1L="\[\033[00;32m\]\u\[\033[00;34m\]@\[\033[01;32m\]\h \[\033[00m\]\$PS1_BAT $dir\[\033[00m\] $PS1_GIT"
PS1R=$(date +"%R:%S")
PS1=$(printf "%*s\r%s\n\[\033[00m\]\$(set_exit_code)-[ " "$(tput cols)" "$PS1R" "$PS1L")
PS1L="\[\033[00;32m\]\u\[\033[00;34m\]@\[\033[01;32m\]\h \[\033[00m\]\$PS1_BAT $dir\[\033[00m\] $PS1_GIT"
PS1R=$(date +"%R:%S")
PS1=$(printf "%*s\r%s\n\[\033[00m\]\$(set_exit_code)-[ " "$(tput cols)" "$PS1R" "$PS1L")
}
PROMPT_COMMAND=set_prompt

View File

@ -179,10 +179,10 @@ map gcs cd ~/.config/shell
map gcz cd ~/.config/zsh
map gcx1 cd ~/.config/x11
map gw cd ~/work
map gNN cd ~/notes/zk/
map gNi cd ~/notes/zk/inbox/
map gNN cd ~/notes/
map gNw cd ~/notes/zk/work/
map gNn cd ~/notes/zk/notes/
map gNz cd ~/notes/zk/zettel/
map gNZ cd ~/notes/zk/zet/
map gNj cd ~/notes/zk/journal/
map A rename # at the very end

View File

@ -131,13 +131,16 @@ return {
end,
},
{
"echasnovski/mini.pairs",
"windwp/nvim-autopairs",
event = "VeryLazy",
opts = {
disable_filetype = { "TelescopePrompt", "spectre_panel" },
ignored_next_char = "[%w%.*]", -- don't place autopairs when cursor sits infront of any character.
},
config = function(_, opts)
require("mini.pairs").setup(opts)
require("nvim-autopairs").setup(opts)
end,
},
{
"preservim/vim-markdown",
},

View File

@ -28,6 +28,11 @@ alias \
ccat="highlight --out-format=ansi" \
ip="ip -color=auto"
alias \
l="ls" \
ll="ls -l" \
lsa="ls -la"
# These common commands are just too long! Abbreviate them.
alias \
ka="killall" \

View File

@ -1,4 +1,9 @@
$include /etc/inputrc
Control-o: lfcd
Control-t: tms
Control-n: zk edit --interactive --sort modified-
set editing-mode vi
$if mode=vi

View File

@ -76,7 +76,7 @@ bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char
# use lf to switch directories and bind it to ctrl-l
# use lf to switch directories and bind it to ctrl-o
lfcd() {
tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT
@ -96,18 +96,19 @@ bindkey -s '^t' '^utms\n'
# zk related things
bindkey -s '^n' '^uzk edit --interactive --sort modified-\n'
function pomo() {
arg1=$1
shift
args="$*"
if [ -f /etc/hostname ]; then
HOST=$(cat /etc/hostname)
else
HOST=$(hostname)
fi
min=${arg1:?Example: pomo 25 Take a break}
sec=$((min * 60))
msg="${args:?Example: pomo 25 Take a break}"
if [ "$HOST" = "holocene" ] ; then
source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh
else
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
while true; do
date '+%H:%M' && sleep "${sec:?}" && notify-send -u critical -t 0 -a pomo "${msg:?}"
done
}
# Dracula Theme (for zsh-syntax-highlighting)
#
@ -200,6 +201,20 @@ ZSH_HIGHLIGHT_STYLES[arg0]='fg=#F8F8F2'
ZSH_HIGHLIGHT_STYLES[default]='fg=#F8F8F2'
ZSH_HIGHLIGHT_STYLES[cursor]='standout'
if [ -f /etc/hostname ]; then
HOST=$(cat /etc/hostname)
else
HOST=$(hostname)
fi
if [ "$HOST" = "holocene" ] ; then
source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh
else
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"