Sample Header Ad - 728x90

how to alias the `history` function in fish shell

3 votes
2 answers
372 views
I'm trying to set the fish history pager to be bat -l fish for syntax highlighting. (i.e. set the PAGER environment variable bat -l fish just for the history command). I tried:
# 1:
alias history "PAGER='bat -l fish' history" 
# results in "The function “history” calls itself immediately, which would result in an infinite loop"

# 2:
alias history "PAGER='bat -l fish' \history"
# results in the same.

# 3:
alias _old_history history
alias history "PAGER='bat -l fish' _old_history"
# results in (line 1): The call stack limit has been exceeded
I'm aware that abbr works in this case, but this changes my history command, and this is not what I want.
Asked by matan h (149 rep)
Jun 13, 2024, 12:17 PM
Last activity: Jun 14, 2024, 12:38 PM