This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/kak-pager

34 lines
634 B
Plaintext
Raw Normal View History

2022-02-09 00:41:09 +01:00
#!/usr/bin/env fish
2021-03-31 22:57:47 +02:00
2021-07-22 02:08:38 +02:00
if test (count $argv) -ne 0
for i in $argv
2021-06-23 08:00:51 +02:00
cat "$i"
2021-07-22 02:08:38 +02:00
end | eval (status filename)
2021-06-23 08:00:51 +02:00
exit 0
2021-07-22 02:08:38 +02:00
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 | kak -e '
exec <a-o>
map global normal q :q<ret>;
rmhl global/number-lines;
set global scrolloff 10,0;
'
exit 0
end
end
printf "%s\n" $input_lines