fish: lash#cat9-like recording feature using script

This commit is contained in:
Phantop 2022-10-18 17:47:48 -04:00
parent 05f3d2f223
commit d46e8dcc37
4 changed files with 53 additions and 4 deletions

View File

@ -86,3 +86,51 @@ function alpine
proot -r alpine
end
funcsave alpine
function record
set recfile /tmp/fish_$fish_pid\_$(date +%s.%N)
set -g --append recfiles $recfile
set -g --append reclines "$argv"
set -g --append recfolds $PWD
if test (type -t $argv[1]) = file
script -efq $recfile -c "$argv"
else
script -efq $recfile -c "fish -c '$argv'"
end
zstdmt -c $recfile &| sponge $recfile
function rmrec_(basename $recfile) --on-event fish_exit -V recfile
rm $recfile
end
end
funcsave record
function listrecords
for i in (seq (count $recfiles))
echo $i: $recfiles[$i]
printf \t; date -d @(echo $recfiles[$i] | cut -d_ -f3)
echo \t$reclines[$i]
echo \t$recfolds[$i]
end
end
funcsave listrecords
function viewrecord
if test $argv
set num $argv
else
listrecords
echo Input the number of the desired recording:
set num (read)
end
if test $KITTY_PID
kitty @ launch --type=tab --hold zstdcat $recfiles[$num]
else
clear
zstdcat $recfiles[$num]
end
end
funcsave viewrecord

View File

@ -22,4 +22,4 @@ bind \ef 'fzf | clip'
bind \e\co 'open (_fzf_wrapper)'
source /usr/share/autojump/autojump.fish
tty -s && starship init fish --print-full-init | source
tty -s && starship init fish --print-full-init | source && echo -en "\e[5 q"

View File

@ -9,6 +9,7 @@ remember_window_size no
close_on_child_death yes
initial_window_width 80c
initial_window_height 24c
allow_remote_control yes
map shift+page_up scroll_page_up
map shift+page_down scroll_page_down

View File

@ -80,9 +80,9 @@ body>div#outer.wrapper {
}
dl.meta, li.blurb, li.comment {border-color: #555}
a:visited {color: #999}
a:visited, .work > li > div.header h4 a:visited {color: #999}
#admin-banner, #header > ul.primary {display:none}
h1.heading a, .splash .module h3, a:hover {color: MediumPurple}
h1.heading a, .splash .module h3, a:hover, li > div.header h4 a {color: MediumPurple}
.secondary {box-shadow:none;background: #000;}
#dashboard {border:none; .navigation.actions {border-top:none}}
.user.home h2 {border-bottom: none}
@ -91,7 +91,7 @@ body>div#outer.wrapper {
ul.work > li {
&.share {display: none}
a.collapsed {display: none}
ul {
ul.secondary {
border: none !important;
display: inline !important;
position: static;