ci: format

This commit is contained in:
Barrett Ruth 2026-03-03 00:42:25 -05:00
parent 310bd074e7
commit 25b821a4fd
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
8 changed files with 374 additions and 331 deletions

View file

@ -226,12 +226,16 @@ return {
enabled_languages = { 'cpp', 'python' },
default_language = 'cpp',
overrides = {
cpp = { template = '~/.config/nix/config/cp/template_single.cc' },
cpp = {
template = '~/.config/nix/config/cp/template_single.cc',
},
},
},
cses = {
overrides = {
cpp = { template = '~/.config/nix/config/cp/template_single.cc' },
cpp = {
template = '~/.config/nix/config/cp/template_single.cc',
},
},
},
},
@ -242,10 +246,19 @@ return {
hooks = {
setup = {
contest = function(state)
local dir = vim.fn.fnamemodify(state.get_source_file(state.get_language()), ':h')
local dir = vim.fn.fnamemodify(
state.get_source_file(state.get_language()),
':h'
)
local path = dir .. '/.clang-format'
if vim.fn.filereadable(path) == 0 then
vim.fn.system({ 'cp', vim.fn.expand('~/.config/nix/config/cp/.clang-format'), path })
vim.fn.system({
'cp',
vim.fn.expand(
'~/.config/nix/config/cp/.clang-format'
),
path,
})
end
end,
code = function(_)
@ -257,9 +270,15 @@ return {
end,
},
on = {
enter = function(_) vim.opt_local.winbar = '' end,
run = function(_) require('config.lsp').format() end,
debug = function(_) require('config.lsp').format() end,
enter = function(_)
vim.opt_local.winbar = ''
end,
run = function(_)
require('config.lsp').format()
end,
debug = function(_)
require('config.lsp').format()
end,
},
},
filename = function(_, _, problem_id)
@ -267,6 +286,9 @@ return {
end,
}
end,
after = function()
vim.cmd.packadd('fzf-lua')
end,
},
{
'barrettruth/preview.nvim',

View file

@ -10,7 +10,8 @@ end
vim.api.nvim_create_autocmd('VimEnter', {
once = true,
callback = function()
vim.o.statusline = ' %{v:lua._fugitive_stl()}' .. vim.o.statusline:sub(2)
vim.o.statusline = ' %{v:lua._fugitive_stl()}'
.. vim.o.statusline:sub(2)
end,
})

View file

@ -32,11 +32,13 @@ in
configurationLimit = 5;
gfxmodeEfi = "1920x1200,auto";
fontSize = 36;
mirroredBoots = [{
mirroredBoots = [
{
path = "/boot";
efiSysMountPoint = "/efi";
devices = [ "nodev" ];
}];
}
];
};
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/efi";

View file

@ -48,13 +48,13 @@ keyboard)
colemak) current="Colemak" ;;
*) current="QWERTY" ;;
esac
choice=$(printf 'QWERTY\nDvorak\nColemak' | \
choice=$(printf 'QWERTY\nDvorak\nColemak' |
awk -v cur="$current" '{
prefix = ($0 == cur) ? " > " : " "
printf "%s%s\t%s\n", prefix, $0, $0
}' | \
}' |
fuzzel --dmenu --prompt="kbd: " --no-icons --lines=3 \
--with-nth=1 --accept-nth=2 --width=24)
--with-nth=1 --accept-nth=2 --font="monospace:size=12" --width=23)
[ -z "$choice" ] && exit 0
case "$choice" in
QWERTY) variant="" ;;
@ -106,11 +106,11 @@ audio)
active_prefix=$(printf " >%$((pad - 3))s" "")
header=$(printf "%s%s\n%s%s" "$indent" "Device name" "$indent" "$sep")
count=$(printf '%s\n' "$rows" | wc -l)
choice=$(printf '%s\n' "$rows" | \
choice=$(printf '%s\n' "$rows" |
awk -F'\t' -v w1="$w1" -v indent="$indent" -v active_prefix="$active_prefix" '{
prefix = ($3 == ">") ? active_prefix : indent
printf "%s%-*s\t%s\n", prefix, w1, $2, $1
}' | \
}' |
fuzzel --dmenu --prompt="$prompt" --no-icons --lines="$count" \
--with-nth=1 --accept-nth=2 \
--mesg="$header" --mesg-mode=expand \
@ -130,14 +130,25 @@ brightness)
case "$2" in
up) brightnessctl set "$BRIGHT_STEP"%+ ;;
down) brightnessctl set "$BRIGHT_STEP"%- ;;
*) echo "Usage: ctl brightness {up|down}" >&2; exit 1 ;;
*)
echo "Usage: ctl brightness {up|down}" >&2
exit 1
;;
esac
pct=$(awk -v cur="$(brightnessctl get)" -v max="$(brightnessctl max)" 'BEGIN { printf "%d", cur * 100 / max }')
filled=$((pct / 5))
empty=$((20 - filled))
bar=""
i=0; while [ "$i" -lt "$filled" ]; do bar="${bar}━"; i=$((i + 1)); done
i=0; while [ "$i" -lt "$empty" ]; do bar="${bar}─"; i=$((i + 1)); done
i=0
while [ "$i" -lt "$filled" ]; do
bar="${bar}━"
i=$((i + 1))
done
i=0
while [ "$i" -lt "$empty" ]; do
bar="${bar}─"
i=$((i + 1))
done
notify-send -a ctl -t 2500 -r 5555 "󰃠 $bar"
;;
volume)
@ -149,14 +160,25 @@ volume)
up) wpctl set-volume "$SINK" "${VOL_STEP}%+" --limit 1.0 ;;
down) wpctl set-volume "$SINK" "${VOL_STEP}%-" ;;
toggle) wpctl set-mute "$SINK" toggle ;;
*) echo "Usage: ctl volume {up|down|toggle}" >&2; exit 1 ;;
*)
echo "Usage: ctl volume {up|down|toggle}" >&2
exit 1
;;
esac
vol=$(get_vol)
filled=$((vol / 5))
empty=$((20 - filled))
bar=""
i=0; while [ "$i" -lt "$filled" ]; do bar="${bar}━"; i=$((i + 1)); done
i=0; while [ "$i" -lt "$empty" ]; do bar="${bar}─"; i=$((i + 1)); done
i=0
while [ "$i" -lt "$filled" ]; do
bar="${bar}━"
i=$((i + 1))
done
i=0
while [ "$i" -lt "$empty" ]; do
bar="${bar}─"
i=$((i + 1))
done
if wpctl get-volume "$SINK" | grep -q MUTED; then
icon="󰖁"
elif [ "$vol" -le 33 ]; then
@ -173,11 +195,14 @@ wifi)
pick)
require fuzzel
station=$(iwctl device list 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | awk '/station/{print $1}')
[ -z "$station" ] && { echo "ctl: no wifi device found" >&2; exit 1; }
[ -z "$station" ] && {
echo "ctl: no wifi device found" >&2
exit 1
}
while :; do
networks=$(iwctl station "$station" get-networks 2>/dev/null | \
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | \
awk 'NR>4 && /\S/ && !/^[[:space:]]*-/' | \
networks=$(iwctl station "$station" get-networks 2>/dev/null |
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' |
awk 'NR>4 && /\S/ && !/^[[:space:]]*-/' |
awk '{
active = ($0 ~ /^[[:space:]]*>/) ? ">" : ""
sub(/^[[:space:]>]*/, "")
@ -210,11 +235,11 @@ wifi)
sep=$(awk -v n="$((w1 + w2 + w3 + 8))" 'BEGIN{for(i=0;i<n;i++)printf "─";print ""}')
header=$(printf " %-*s %-*s %s\n %s" "$w1" "Network name" "$w2" "Security" "Signal" "$sep")
count=$(printf '%s\n' "$networks" | wc -l)
ssid=$(printf '%s\n' "$networks" | \
ssid=$(printf '%s\n' "$networks" |
awk -F'\t' -v w1="$w1" -v w2="$w2" '{
prefix = ($4 == ">") ? " > " : " "
printf "%s%-*s %-*s %s\t%s\n", prefix, w1, $1, w2, $2, $3, $1
}' | \
}' |
fuzzel --dmenu --prompt="wifi: " --no-icons --lines="$count" \
--with-nth=1 --accept-nth=2 \
--mesg="$header" --mesg-mode=expand \

View file

@ -24,7 +24,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
VERSION=1.3.0
M=32768 # Bash RANDOM maximum + 1
@ -77,7 +76,6 @@ BOLD=1
NOCOLOR=0
KEEPCT=0 # keep pipe color and type
# print help message in 72-char width
print_help() {
local cgap
@ -106,22 +104,19 @@ Note: -t and -c can be used more than once.
HELP
}
# parse command-line options
# It depends on a valid COLORS which is set by _CP_init_termcap_vars
parse() {
# test if $1 is a natural number in decimal, an integer >= 0
is_N() {
[[ -n $1 && -z ${1//[0-9]} ]]
[[ -n $1 && -z ${1//[0-9]/} ]]
}
# test if $1 is a hexadecimal string
is_hex() {
[[ -n $1 && -z ${1//[0-9A-Fa-f]} ]]
[[ -n $1 && -z ${1//[0-9A-Fa-f]/} ]]
}
# print error message for invalid argument to standard error, this
# - mimics getopts error message
# - use all positional parameters as error message
@ -131,7 +126,6 @@ parse() {
printf "%s: -$arg invalid argument -- $OPTARG; %s\n" "$0" "$*" >&2
}
OPTIND=1
while getopts "p:t:c:f:s:r:RBCKhv" arg; do
case $arg in
@ -207,11 +201,13 @@ parse() {
print_help
exit 0
;;
v) echo "$(basename -- "$0") $VERSION"
v)
echo "$(basename -- "$0") $VERSION"
exit 0
;;
*)
return 1
;;
esac
done
@ -222,7 +218,6 @@ parse() {
fi
}
cleanup() {
# clear out standard input
read -t 0.001 && cat </dev/stdin >/dev/null
@ -235,12 +230,10 @@ cleanup() {
exit 0
}
resize() {
w=$(tput cols) h=$(tput lines)
}
init_pipes() {
# +_CP_init_pipes
local i
@ -248,20 +241,19 @@ init_pipes() {
ci=$((KEEPCT ? 0 : CN * RANDOM / M))
vi=$((KEEPCT ? 0 : VN * RANDOM / M))
for ((i = 0; i < p; i++)); do
((
n[i] = 0,
l[i] = RNDSTART ? RANDOM % 4 : 0,
x[i] = RNDSTART ? w * RANDOM / M : w / 2,
y[i] = RNDSTART ? h * RANDOM / M : h / 2,
v[i] = V[vi]
))
((\
n[i] = 0, \
l[i] = RNDSTART ? RANDOM % 4 : 0, \
x[i] = RNDSTART ? w * RANDOM / M : w / 2, \
y[i] = RNDSTART ? h * RANDOM / M : h / 2, \
v[i] = V[vi]))
c[i]=${E[ci]}
((ci = (ci + 1) % CN, vi = (vi + 1) % VN))
done
# -_CP_init_pipes
}
init_screen() {
stty -echo
tput smcup
@ -273,7 +265,6 @@ init_screen() {
trap resize SIGWINCH
}
main() {
# simple pre-check of TERM, tput's error message should be enough
tput -T "$TERM" sgr0 >/dev/null || return $?
@ -301,20 +292,20 @@ main() {
# + SGR_BOLD, if BOLD
# + tput setaf C, if !NOCOLOR
local i
for ((i = 0; i < CN; i++)) {
for ((i = 0; i < CN; i++)); do
E[i]=$SGR0
((BOLD)) && E[i]+=$SGR_BOLD
((NOCOLOR)) || E[i]+=$(tput setaf ${C[i]})
}
done
# -_CP_init_E
# +_CP_init_SETS
local i j
for ((i = 0; i < ${#sets[@]}; i++)) {
for ((j = 0; j < 16; j++)) {
for ((i = 0; i < ${#sets[@]}; i++)); do
for ((j = 0; j < 16; j++)); do
SETS+=("${sets[i]:j:1}")
}
}
done
done
unset i j
# -_CP_init_SETS
@ -346,9 +337,12 @@ main() {
# Loop on edges (change color on loop):
# +_CP_warp
((!KEEPCT && (x[i] >= w || x[i] < 0 || y[i] >= h || y[i] < 0))) \
&& { c[i]=${E[CN * RANDOM / M]}; ((v[i] = V[VN * RANDOM / M])); }
((x[i] = (x[i] + w) % w,
((!KEEPCT && (x[i] >= w || x[i] < 0 || y[i] >= h || y[i] < 0))) &&
{
c[i]=${E[CN * RANDOM / M]}
((v[i] = V[VN * RANDOM / M]))
}
((x[i] = (x[i] + w) % w, \
y[i] = (y[i] + h) % h))
# -_CP_warp
@ -360,11 +354,11 @@ main() {
# n[i] == -1
# => n[i] == l[i] + 1 or l[i] - 1
# +_CP_newdir
((
n[i] = s * RANDOM / M - 1,
n[i] = n[i] >= 0 ? l[i] : l[i] + (2 * (RANDOM % 2) - 1),
n[i] = (n[i] + 4) % 4
))
((\
n[i] = s * RANDOM / M - 1, \
n[i] = n[i] >= 0 ? l[i] : l[i] + (2 * (RANDOM % 2) - 1), \
n[i] = (n[i] + 4) % 4))
# -_CP_newdir
# Print:
@ -381,6 +375,5 @@ main() {
cleanup
}
# when being sourced, $0 == bash, only invoke main when they are the same
[[ "$0" != "$BASH_SOURCE" ]] || main "$@"

View file

@ -81,7 +81,6 @@ Linux)
pkill -USR2 waybar
}
hypr_themes="$cfg/hypr/themes"
[ -f "$hypr_themes/$theme.conf" ] && {
ln -sf "$hypr_themes/$theme.conf" "$hypr_themes/theme.conf"

View file

@ -15,7 +15,8 @@ require() {
done
}
cmd="$1"; shift
cmd="$1"
shift
case "$cmd" in
setup)