Skip to content

Commit d87e792

Browse files
committed
only removes empty lines at the end of pager.
1 parent 0d44ba0 commit d87e792

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bin/pager.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ else
1111
fi
1212

1313
# 63<&0 :: sends stdin 0 to stdin 63
14-
# sed </dev/fd/63 -e "s/'$'\x1b'']8;;file:[^\]*[\]//g" -e "/^ *\$/d" :: reads stdin 63, remove graphics and remove any empty lines at end of file
14+
# sed </dev/fd/63 :: reads stdin 63
15+
# -e "s/'$'\x1b'']8;;file:[^\]*[\]//g" :: removes graphics
16+
# -e :a -e "/^\n*\$/{\$d;N;ba" -e "}" :: removes empty lines, source: https://unix.stackexchange.com/questions/552188/how-to-remove-empty-lines-from-beginning-and-end-of-file
1517
# sleep 0.01 :: waits for the command to complete
1618
# printf "'$'\x1b'']2;" :: removes [Process exited 0] from display
1719
exec nvim 63<&0 0</dev/null \
@@ -23,4 +25,5 @@ exec nvim 63<&0 0</dev/null \
2325
-c "set scrollback=100000 laststatus=0" \
2426
-c "autocmd TermEnter * stopinsert" \
2527
-c "autocmd TermClose * ${AUTOCMD_TERMCLOSE_CMD}" \
26-
-c 'terminal sed </dev/fd/63 -e "s/'$'\x1b'']8;;file:[^\]*[\]//g" -e "/^ *\$/d" && sleep 0.01 && printf "'$'\x1b'']2;"'
28+
-c 'terminal sed </dev/fd/63 -e "s/'$'\x1b'']8;;file:[^\]*[\]//g" -e :a -e "/^\n*\$/{\$d;N;ba" -e "}" && sleep 0.01 && printf "'$'\x1b'']2;"'
29+

0 commit comments

Comments
 (0)