Skip to content

Commit 993f564

Browse files
committed
📟 paging
1 parent 7ef9a19 commit 993f564

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

shell/.shell_functions

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,26 @@ log_event() {
315315
;;
316316
esac
317317
}
318+
319+
#############################################
320+
# bat
321+
#############################################
322+
pager() {
323+
local FIRST_ARG=${1:-""}
324+
local EXTRA_ARGS=("${@:2}")
325+
BAT_ARGS=(
326+
"bat"
327+
"--force-colorization"
328+
"--pager"
329+
"less"
330+
)
331+
if [ -t 0 ]; then
332+
BAT_ARGS+=("${FIRST_ARG}")
333+
else
334+
if [ -n "${FIRST_ARG}" ]; then
335+
BAT_ARGS+=("--language=${FIRST_ARG}")
336+
fi
337+
fi
338+
BAT_ARGS+=("${EXTRA_ARGS[@]}")
339+
"${BAT_ARGS[@]}"
340+
}

shell/.shell_vars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export EDITOR="nano"
66
export AWS_PAGER=""
77
export SHOW_AWS_PROMPT="false"
88
export PROMPT_EOL_MARK=""
9+
export LESS="-R --use-color --mouse --wheel-lines=3"

shell/.zshrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ plugins=(
2525
)
2626

2727
if ! command -v omz &> /dev/null; then
28+
export DISABLE_AUTO_UPDATE="1"
2829
source "${ZSH}/oh-my-zsh.sh"
2930
fi
3031

0 commit comments

Comments
 (0)