nixos-config/scripts/helix-pager
2023-05-11 11:20:47 -03:00

29 lines
477 B
Fish

#!/usr/bin/env fish
if test (count $argv) -ne 0
for i in $argv
cat "$i"
end | eval (status filename)
exit 0
end
set term_line_count (tput lines)
while read line
set -a input_lines "$line"
set input_line_count (printf "%s\n" $input_lines | wc -l)
if test "$term_line_count" -lt "$input_line_count"
begin
printf "%s\n" $input_lines
cat
end | hx
exit 0
end
end
printf "%s\n" $input_lines