diff options
Diffstat (limited to 'bash')
| -rw-r--r-- | bash/dot-bashrc | 15 | ||||
| -rw-r--r-- | bash/dot-config/bash/notes.bash | 44 | ||||
| -rw-r--r-- | bash/dot-config/shellcheckrc | 4 | ||||
| -rw-r--r-- | bash/dot-config/shellshort/bm-dirs | 2 | ||||
| -rw-r--r-- | bash/dot-config/shellshort/shortcutenvrc | 5 | ||||
| -rw-r--r-- | bash/dot-config/shellshort/shortcutrc | 4 | ||||
| -rw-r--r-- | bash/dot-config/shellshort/zshnameddirs | 4 | ||||
| -rw-r--r-- | bash/dot-profile | 3 |
8 files changed, 75 insertions, 6 deletions
diff --git a/bash/dot-bashrc b/bash/dot-bashrc index 0c0c2a2..cc15ea0 100644 --- a/bash/dot-bashrc +++ b/bash/dot-bashrc @@ -1,5 +1,6 @@ # ~/.bashrc # vim: ft=bash +# shellcheck shell=bash # If not running interactively, don't do anything [[ $- != *i* ]] && return @@ -10,15 +11,18 @@ export HISTSIZE=10000 shopt -s autocd shopt -s checkwinsize +shopt -u promptvars -source "${XDG_CONFIG_HOME:-$HOME/.config}"/bash/gentoo-color.bash +PS1='[\[\e[32m\]\u@\h\[\e[34m\] \W\[\e[00m\]]\$ ' function ls() { - command ls --color=auto --indicator-style=classify --human-readable --literal --group-directories-first -v "$@" # -v is for natural sort of numbers within text + command ls --color=auto --indicator-style=classify --human-readable --literal --group-directories-first -v "$@" # -v is for natural sort of numbers within text } # coreutils +alias diff='diff --color=auto' +alias grep='grep --color=auto' alias cp='cp -riv' alias ll='ls --all -l --human-readable' # -l = long listing format alias l='ls -l' @@ -34,21 +38,26 @@ alias p='sudo pacman' alias SS='sudo systemctl' alias Su='systemctl --user' alias v='nvim' +alias vn='NVIM_APPNAME=nvim-min nvim' alias vv='uv run nvim' -alias todo='nvim ~/notes.md' alias neofetch='fastfetch -c examples/13' alias cvim='nvim -c "cd ~/.config/nvim" -c "Ex"' +alias hm='home-manager --flake ~/nix' # source: https://wiki.archlinux.org/title/GnuPG#Configure_pinentry_to_use_the_correct_TTY GPG_TTY="$(tty)" export GPG_TTY gpg-connect-agent updatestartuptty /bye >/dev/null +# shellcheck source=functions.bash source "${XDG_CONFIG_HOME:-$HOME/.config}"/bash/functions.bash + +# shellcheck source=notes.bash source "${XDG_CONFIG_HOME:-$HOME/.config}"/bash/notes.bash bind '"\C-o":"\C-ulf\C-m"' +# shellcheck source=.config/shellshort/shortcutrc source "${XDG_CONFIG_HOME:-$HOME/.config}"/shellshort/shortcutrc export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git' diff --git a/bash/dot-config/bash/notes.bash b/bash/dot-config/bash/notes.bash index 82ed521..182f28b 100644 --- a/bash/dot-config/bash/notes.bash +++ b/bash/dot-config/bash/notes.bash @@ -1,4 +1,4 @@ -note() { +oldnote() { if (($# == 0)); then tmpfile=$(mktemp --tmpdir --suffix=.md note.XXXXXXXXXXX) echo "- [ ] $(date +'%m-%d-%Y %H:%M') " >> "$tmpfile" @@ -9,10 +9,50 @@ note() { fi } -todos() { +orgnote() { + local curdate="$(date +'%Y-%m-%d %a %H:%M')" + if (($# == 0)); then + local tmpfile=$(mktemp --tmpdir --suffix=.org note.XXXXXXXXXXX) + printf "* TODO :REVISIT:\n[%s]\n" "$curdate" >> "$tmpfile" + nvim -c 'norm ggf:h' -c 'startinsert!' "$tmpfile" + cat "$tmpfile" >> ~/org/refile.org + else + printf "* TODO %s :REVISIT:\n[%s]\n" "$*" "$curdate" >> ~/org/refile.org + fi +} + +nb() { + local curdate="$(date +'%Y-%m-%d %a %H:%M')" + if (($# == 0)); then + local tmpfile=$(mktemp --tmpdir --suffix=.notes note.XXXXXXXXXXX) + printf "[%s] " "$curdate" >> "$tmpfile" + local mtime_before=$(stat -c %Y "$tmpfile") + nvim -c 'norm gg$' -c 'startinsert!' "$tmpfile" + local mtime_after=$(stat -c %Y "$tmpfile") + if [ "$mtime_after" -ne "$mtime_before" ]; then + cat "$tmpfile" >> ~/refile.notes + fi + else + printf "[%s] %s" "$curdate" "$*" >> ~/refile.notes + fi +} + +oldtodos() { printf $'\e[01;33mINBOX\e[0m\n' bat -P -p ~/pkm/0_inbox.md echo printf $'\e[01;33mALL\e[0m\n' rg --color=always --no-line-number --no-heading --smart-case --glob "!.git" --glob "!0_inbox.md" --hyperlink-format='file://{path}' -- "-\\s\\[\\s\\]" ~/pkm/ } + +orgtodos() { + printf $'\e[01;33mINBOX\e[0m\n' + bat -P -p ~/org/refile.org + echo + printf $'\e[01;33mALL\e[0m\n' + rg --color=always --no-line-number --no-heading --smart-case --glob "!.git" --glob "!refile.org" --hyperlink-format='file://{path}' -- "\\*\\sTODO" ~/org/ +} + +todos() { + bat -P -p ~/refile.notes +} diff --git a/bash/dot-config/shellcheckrc b/bash/dot-config/shellcheckrc new file mode 100644 index 0000000..bc6fdad --- /dev/null +++ b/bash/dot-config/shellcheckrc @@ -0,0 +1,4 @@ +external-sources=true + +source-path=SCRIPTDIR +source-path=/home/moreka/.config/bash diff --git a/bash/dot-config/shellshort/bm-dirs b/bash/dot-config/shellshort/bm-dirs index e69de29..4ecd6c0 100644 --- a/bash/dot-config/shellshort/bm-dirs +++ b/bash/dot-config/shellshort/bm-dirs @@ -0,0 +1,2 @@ +mit $HOME/mit/18.650-spring-26/ +linatt $HOME/mit/linear-attention/ diff --git a/bash/dot-config/shellshort/shortcutenvrc b/bash/dot-config/shellshort/shortcutenvrc new file mode 100644 index 0000000..8f0b3fb --- /dev/null +++ b/bash/dot-config/shellshort/shortcutenvrc @@ -0,0 +1,5 @@ +# vim: filetype=sh +[ -n "mit" ] && export mit="/home/moreka/mit/18.650-spring-26/" +[ -n "linatt" ] && export linatt="/home/moreka/mit/linear-attention/" +[ -n "cala" ] && export cala="/home/moreka/.config/alacritty/alacritty.toml" +[ -n "cnir" ] && export cnir="/home/moreka/.config/niri/config.kdl" diff --git a/bash/dot-config/shellshort/shortcutrc b/bash/dot-config/shellshort/shortcutrc index e701151..e8571c1 100644 --- a/bash/dot-config/shellshort/shortcutrc +++ b/bash/dot-config/shellshort/shortcutrc @@ -1,3 +1,5 @@ # vim: filetype=sh -alias cala="$EDITOR /home/moreka/.config/alacritty/alacritty.toml" \ +alias mit="cd /home/moreka/mit/18.650-spring-26/ && ls -A" \ +linatt="cd /home/moreka/mit/linear-attention/ && ls -A" \ +cala="$EDITOR /home/moreka/.config/alacritty/alacritty.toml" \ cnir="$EDITOR /home/moreka/.config/niri/config.kdl" \ diff --git a/bash/dot-config/shellshort/zshnameddirs b/bash/dot-config/shellshort/zshnameddirs new file mode 100644 index 0000000..d7453ec --- /dev/null +++ b/bash/dot-config/shellshort/zshnameddirs @@ -0,0 +1,4 @@ +hash -d mit=/home/moreka/mit/18.650-spring-26/ +hash -d linatt=/home/moreka/mit/linear-attention/ +hash -d cala=/home/moreka/.config/alacritty/alacritty.toml +hash -d cnir=/home/moreka/.config/niri/config.kdl diff --git a/bash/dot-profile b/bash/dot-profile index 4e9b17f..ca4932c 100644 --- a/bash/dot-profile +++ b/bash/dot-profile @@ -14,6 +14,9 @@ export XDG_BIN_HOME="$HOME"/.local/bin PATH="${PATH}:${XDG_BIN_HOME}:$HOME/.nix-profile/bin" export PATH +XDG_DATA_DIRS="$HOME/.nix-profile/share:$XDG_DATA_DIRS" +export XDG_DATA_DIRS + export LESSHISTFILE="$XDG_CACHE_HOME"/lesshst export CARGO_HOME="$XDG_DATA_HOME"/cargo export TEXMFHOME="$XDG_DATA_HOME"/texmf |
