Compare commits
2 Commits
495b8c110f
...
38bbc87472
Author | SHA1 | Date |
---|---|---|
|
38bbc87472 | |
|
dd884ff057 |
21
.bashrc
21
.bashrc
|
@ -205,6 +205,21 @@ CDPATH="."\
|
|||
":${HOME}/projects/aoc/2023"
|
||||
|
||||
################################## 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 () {
|
||||
__have vi || { log.err 'vi missing' ; return 1 ; }
|
||||
|
@ -245,11 +260,11 @@ viw () {
|
|||
vi "${@}" "$(type -P "${first}")"
|
||||
}
|
||||
|
||||
#################################### paruuu (posix) ####################################
|
||||
################################# yolo (posix) #################################
|
||||
# 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
|
||||
paruuu () {
|
||||
yolo () {
|
||||
__have iw || { log.err 'iw missing' ; exit 1 ; }
|
||||
__have paru || { log.err 'paru missing' ; exit 2 ; }
|
||||
__have pacman || { log.err 'pacman missing' ; exit 3 ; }
|
||||
|
|
|
@ -43,9 +43,9 @@ vim.opt.updatetime = 50
|
|||
vim.opt.paste = false
|
||||
vim.opt.splitright = false
|
||||
|
||||
-- vim.diagnostic.config({
|
||||
-- virtual_lines = false,
|
||||
-- virtual_text = false,
|
||||
-- underline = false,
|
||||
-- signs = true,
|
||||
-- })
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = false,
|
||||
virtual_text = false,
|
||||
underline = false,
|
||||
signs = true,
|
||||
})
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#! /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
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#! /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
|
||||
|
|
|
@ -2,20 +2,23 @@
|
|||
|
||||
set -e
|
||||
|
||||
[ -z "$1" ] && { xargs -n 1 -d '\n' "$0"; exit 0; }
|
||||
[ -z "${1}" ] && { xargs -n 1 -d '\n' "${0}"; exit 0; }
|
||||
|
||||
title=$*
|
||||
title_len=${#title}
|
||||
[ $title_len -gt 78 ] && { printf '%s\n' "$title"; exit 0; }
|
||||
missing=$((80 - title_len - 2))
|
||||
i=0
|
||||
while [ $i -lt $((missing / 2)) ]; do
|
||||
[ -z "${HTITLE_WIDTH}" ] && HTITLE_WIDTH="80" || HTITLE_WIDTH="$((HTITLE_WIDTH + 0))"
|
||||
[ "${HTITLE_WIDTH}" -lt 0 ] && HTITLE_WIDTH="0"
|
||||
|
||||
title="${*}"
|
||||
title_len="${#title}"
|
||||
[ "${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 '#'
|
||||
i=$((i+1))
|
||||
i="$((i+1))"
|
||||
done
|
||||
printf ' %s ' "$title"
|
||||
while [ $i -lt $missing ]; do
|
||||
printf ' %s ' "${title}"
|
||||
while [ "${i}" -lt "${missing}" ]; do
|
||||
printf '#'
|
||||
i=$((i+1))
|
||||
i="$((i+1))"
|
||||
done
|
||||
printf '\n'
|
||||
|
|
Loading…
Reference in New Issue