commit c75f2dcb8cfc5792c6073fea3a60430318a0653d
parent 20b77ce3f6ab8119cccc0e7c56455222a5018276
Author: mtmn <miro@haravara.org>
Date: Mon, 22 Jun 2026 17:08:58 +0200
void: csv output for zsh history
Diffstat:
3 files changed, 22 insertions(+), 43 deletions(-)
diff --git a/hosts/void/default.nix b/hosts/void/default.nix
@@ -43,6 +43,7 @@
fq
geesefs
ouch
+ xan
];
vcs = [
diff --git a/modules/mixins/dotfiles/config/shell/rc/aliased-short-names b/modules/mixins/dotfiles/config/shell/rc/aliased-short-names
@@ -78,9 +78,6 @@ alias bpp='backup -t git:pass -p'
alias bnp='backup -t git:nota -p'
alias brr='backup -t git:releases -p'
-alias h='histdb'
-alias hs='histdb-sync'
-
alias nr='newsraft'
alias nre='$EDITOR ~/src/sr.ht/nix/modules/mixins/dotfiles/config/newsraft/feeds'
@@ -144,4 +141,4 @@ alias bakm='backup -t mobius'
alias chav='cha --visual'
-alias pwc='pwd | wl-copy'
+alias pwc='pwd | wl-copy -n'
diff --git a/modules/mixins/dotfiles/config/zsh/rc/functions b/modules/mixins/dotfiles/config/zsh/rc/functions
@@ -1,7 +1,7 @@
#!/bin/zsh
fzf_copy_from_cliphist() {
- { cliphist list | fzf --no-sort | cliphist decode | wl-copy && zle reset-prompt || true } 2>/dev/null
+ { cliphist list | fzf --no-sort | cliphist decode | wl-copy && zle reset-prompt || true; } 2>/dev/null
}
erg() {
@@ -20,57 +20,38 @@ efd() {
# https://news.ycombinator.com/item?id=29155825
jog() {
- sqlite3 "$HOME/.histdb/zsh-history.db" "
- SELECT
- replace(commands.argv, '
-', '
-')
+ sqlite3 -csv -header "$HOME/.histdb/zsh-history.db" "
+ SELECT commands.argv AS command
FROM commands
JOIN history ON history.command_id = commands.id
JOIN places ON history.place_id = places.id
WHERE history.exit_status = 0
- AND dir = '${PWD}'
- AND places.host = '${HOST}'
- AND commands.argv != 'jog'
- AND commands.argv != 'jog_run'
- AND commands.argv != 'j'
- AND commands.argv != 'jr'
+ AND dir = '${PWD}'
+ AND places.host = '${HOST}'
AND commands.argv NOT LIKE 'z %'
AND commands.argv NOT LIKE 'cd %'
- AND commands.argv != '..'
- ORDER BY start_time DESC
- "
+ ORDER BY start_time ASC
+ " | xan view -A -t borderless -I -M --repeat-headers never --color always |
+ sed '/^\x1b\[2m/d; /^$/d'
}
-jog_run() {
- local cmd
- cmd=$(jog | uniq | fzf --no-sort)
- [[ -n "$cmd" ]] && print -z "$cmd"
-}
-
-histdb_run() {
- if [ $# -eq 0 ]; then
- local cmd
- cmd=$(histdb --status 0 --sep "," |
- cut -d"," -f4 |
- grep -v "^(showing\|histdb" |
- uniq |
- tac |
- fzf --no-sort)
- [[ -n "$cmd" ]] && print -z "$cmd"
- else
- histdb "$@"
- fi
+hs() {
+ sqlite3 -csv -header "$HOME/.histdb/zsh-history.db" "
+ SELECT command FROM (
+ SELECT commands.argv AS command, history.start_time AS st
+ FROM commands
+ JOIN history ON history.command_id = commands.id
+ ORDER BY history.start_time DESC
+ LIMIT 1000
+ ) ORDER BY st ASC
+ " | xan view -A -t borderless -I -M --repeat-headers never --color always |
+ sed '/^\x1b\[2m/d; /^$/d'
}
for b in $(seq 0 100); do
alias b"$b"="sudo brightnessctl set $b%"
-
done
+
for t in $(seq 0 100); do
alias s"$t"="seek $t"
-
-done
-for v in $(seq 0 100); do
- alias v"$v"="mpc volume $v"
done