helix: add helix pager
This commit is contained in:
parent
ba4d00d1df
commit
d32bd28650
4 changed files with 52 additions and 7 deletions
28
scripts/helix-pager
Normal file
28
scripts/helix-pager
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/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
|
Loading…
Add table
Add a link
Reference in a new issue