mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 11:21:15 -03:00
Add __fish_anypager helper
This makes it easier to get *any pager* in the number of places we do. Unfortunately: 1. It can't just execute the pager because that might block 2. We can't really set the necessary options for less here so they still need to be set outside. This Fixes #10074 by falling back to `cat` in that case. We could also decide to abort instead of using a non-pager, but for history that's probably fine.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
function __fish_preview_current_file --description "Open the file at the cursor in a pager"
|
||||
set -l pager less --
|
||||
set -q PAGER && echo $PAGER | read -at pager
|
||||
set -l pager (__fish_anypager)
|
||||
or set pager cat
|
||||
|
||||
# commandline -t will never return an empty list. However, the token
|
||||
# could comprise multiple lines, so join them into a single string.
|
||||
|
||||
Reference in New Issue
Block a user