Skip to content

Commit caf0127

Browse files
author
John Oxley
committed
Added a flag usepager to disable use of the pager in the command
1 parent 2301452 commit caf0127

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

docs/options.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ default!
3333
3434
set -g @sidebar-tree-command 'tree -C'
3535

36+
> Can I disable the pager in the sidebar?
37+
38+
set -g @sidebar-tree-usepager off
39+
3640
### Notes
3741

3842
The command used to display the directory listing

scripts/tree_helpers.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ tree_pager() {
3333
get_tmux_option "$TREE_PAGER_OPTION" "$TREE_PAGER"
3434
}
3535

36+
tree_usepager() {
37+
get_tmux_option "$TREE_USEPAGER_OPTION" "$TREE_USEPAGER"
38+
}
39+
3640
tree_position() {
3741
get_tmux_option "$TREE_POSITION_OPTION" "$TREE_POSITION"
3842
}

scripts/variables.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ TREE_COMMAND_OPTION="@sidebar-tree-command"
1515
TREE_PAGER='sh -c "LESS= less --dumb --chop-long-lines --tilde --IGNORE-CASE --RAW-CONTROL-CHARS"'
1616
TREE_PAGER_OPTION="@sidebar-tree-pager"
1717

18+
TREE_USEPAGER="on"
19+
TREE_USEPAGER_OPTION='@sidebar-tree-usepager'
20+
1821
TREE_POSITION="left"
1922
TREE_POSITION_OPTION="@sidebar-tree-position"
2023

sidebar.tmux

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ set_default_key_binding_options() {
1414
local tree_pager="$(tree_pager)"
1515
local tree_position="$(tree_position)"
1616
local tree_width="$(tree_width)"
17+
local tree_usepager="$(tree_usepager)"
1718

18-
set_tmux_option "${VAR_KEY_PREFIX}-${tree_key}" "$tree_command | ${tree_pager},${tree_position},${tree_width}"
19-
set_tmux_option "${VAR_KEY_PREFIX}-${tree_focus_key}" "$tree_command | ${tree_pager},${tree_position},${tree_width},focus"
19+
local cmd="$tree_command"
20+
if [ "$tree_usepager" == "on" ] ; then
21+
cmd="$tree_command | $tree_pager"
22+
fi
23+
24+
set_tmux_option "${VAR_KEY_PREFIX}-${tree_key}" "$cmd,${tree_position},${tree_width}"
25+
set_tmux_option "${VAR_KEY_PREFIX}-${tree_focus_key}" "$cmd,${tree_position},${tree_width},focus"
2026
}
2127

2228
set_key_bindings() {

0 commit comments

Comments
 (0)