Compare commits

...

2 Commits

Author SHA1 Message Date
tosu 38bbc87472 Update 2024-06-27 14:46:34 +02:00
tosu dd884ff057 Fix man 2024-06-27 14:45:30 +02:00
5 changed files with 40 additions and 22 deletions

21
.bashrc
View File

@ -205,6 +205,21 @@ CDPATH="."\
":${HOME}/projects/aoc/2023" ":${HOME}/projects/aoc/2023"
################################## FUNCTIONS ################################### ################################## FUNCTIONS ###################################
################################ man (wrapper) #################################
# Depends on mktemp, nvim, man
man () (
__have mktemp || { log.err 'mktemp missing' ; exit 1 ; }
__have nvim || { log.err 'nvim missing' ; exit 2 ; }
__have man || { log.err 'man missing' ; exit 3 ; }
set -euo pipefail
trap '/bin/rm -f -- "${raw_manpage}"' EXIT
raw_manpage="$(mktemp)"
2>/dev/null MANPAGER=cat command man "$@" > "${raw_manpage}"
command nvim +Man! -- "${raw_manpage}"
command rm -f -- "${raw_manpage}"
)
################################# vix (posix) ################################## ################################# vix (posix) ##################################
vix () { vix () {
__have vi || { log.err 'vi missing' ; return 1 ; } __have vi || { log.err 'vi missing' ; return 1 ; }
@ -245,11 +260,11 @@ viw () {
vi "${@}" "$(type -P "${first}")" vi "${@}" "$(type -P "${first}")"
} }
#################################### paruuu (posix) #################################### ################################# yolo (posix) #################################
# Update arch linux system with pacman, paru and ssid whitelist # Update arch linux system with pacman, paru and ssid whitelist
# Clears cache and removes orphans. Arguably dangerous. # Clears cache and removes orphans. Arguably dangerous, but YOLO
# Depends on iw, paru, pacman, rankmirrors, sudo, curl # Depends on iw, paru, pacman, rankmirrors, sudo, curl
paruuu () { yolo () {
__have iw || { log.err 'iw missing' ; exit 1 ; } __have iw || { log.err 'iw missing' ; exit 1 ; }
__have paru || { log.err 'paru missing' ; exit 2 ; } __have paru || { log.err 'paru missing' ; exit 2 ; }
__have pacman || { log.err 'pacman missing' ; exit 3 ; } __have pacman || { log.err 'pacman missing' ; exit 3 ; }

View File

@ -43,9 +43,9 @@ vim.opt.updatetime = 50
vim.opt.paste = false vim.opt.paste = false
vim.opt.splitright = false vim.opt.splitright = false
-- vim.diagnostic.config({ vim.diagnostic.config({
-- virtual_lines = false, virtual_lines = false,
-- virtual_text = false, virtual_text = false,
-- underline = false, underline = false,
-- signs = true, signs = true,
-- }) })

View File

@ -1,2 +1,2 @@
#! /bin/sh - #! /bin/sh -
exec xrandr --output DP-1 --auto --output eDP-1 --off exec xrandr --output DP-1 --auto --output eDP-1 --off --output HDMI-1 --off

View File

@ -1,2 +1,2 @@
#! /bin/sh - #! /bin/sh -
exec xrandr --output HDMI-1 --auto --output eDP-1 --off exec xrandr --output HDMI-1 --auto --output eDP-1 --off --output DP-1 --off

View File

@ -2,20 +2,23 @@
set -e set -e
[ -z "$1" ] && { xargs -n 1 -d '\n' "$0"; exit 0; } [ -z "${1}" ] && { xargs -n 1 -d '\n' "${0}"; exit 0; }
title=$* [ -z "${HTITLE_WIDTH}" ] && HTITLE_WIDTH="80" || HTITLE_WIDTH="$((HTITLE_WIDTH + 0))"
title_len=${#title} [ "${HTITLE_WIDTH}" -lt 0 ] && HTITLE_WIDTH="0"
[ $title_len -gt 78 ] && { printf '%s\n' "$title"; exit 0; }
missing=$((80 - title_len - 2)) title="${*}"
i=0 title_len="${#title}"
while [ $i -lt $((missing / 2)) ]; do [ "${title_len}" -gt "$((HTITLE_WIDTH - 2))" ] && { printf '%s\n' "${title}"; exit 0; }
missing="$((HTITLE_WIDTH - title_len - 2))"
i="0"
while [ "${i}" -lt "$((missing / 2))" ]; do
printf '#' printf '#'
i=$((i+1)) i="$((i+1))"
done done
printf ' %s ' "$title" printf ' %s ' "${title}"
while [ $i -lt $missing ]; do while [ "${i}" -lt "${missing}" ]; do
printf '#' printf '#'
i=$((i+1)) i="$((i+1))"
done done
printf '\n' printf '\n'