Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a flag usepager to disable use of the pager in the command #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ default!

set -g @sidebar-tree-command 'tree -C'

> Can I disable the pager in the sidebar?

set -g @sidebar-tree-usepager off

### Notes

The command used to display the directory listing
Expand Down
4 changes: 4 additions & 0 deletions scripts/tree_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ tree_pager() {
get_tmux_option "$TREE_PAGER_OPTION" "$TREE_PAGER"
}

tree_usepager() {
get_tmux_option "$TREE_USEPAGER_OPTION" "$TREE_USEPAGER"
}

tree_position() {
get_tmux_option "$TREE_POSITION_OPTION" "$TREE_POSITION"
}
Expand Down
3 changes: 3 additions & 0 deletions scripts/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ TREE_COMMAND_OPTION="@sidebar-tree-command"
TREE_PAGER='sh -c "LESS= less --dumb --chop-long-lines --tilde --IGNORE-CASE --RAW-CONTROL-CHARS"'
TREE_PAGER_OPTION="@sidebar-tree-pager"

TREE_USEPAGER="on"
TREE_USEPAGER_OPTION='@sidebar-tree-usepager'

TREE_POSITION="left"
TREE_POSITION_OPTION="@sidebar-tree-position"

Expand Down
10 changes: 8 additions & 2 deletions sidebar.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ set_default_key_binding_options() {
local tree_pager="$(tree_pager)"
local tree_position="$(tree_position)"
local tree_width="$(tree_width)"
local tree_usepager="$(tree_usepager)"

set_tmux_option "${VAR_KEY_PREFIX}-${tree_key}" "$tree_command | ${tree_pager},${tree_position},${tree_width}"
set_tmux_option "${VAR_KEY_PREFIX}-${tree_focus_key}" "$tree_command | ${tree_pager},${tree_position},${tree_width},focus"
local cmd="$tree_command"
if [ "$tree_usepager" == "on" ] ; then
cmd="$tree_command | $tree_pager"
fi

set_tmux_option "${VAR_KEY_PREFIX}-${tree_key}" "$cmd,${tree_position},${tree_width}"
set_tmux_option "${VAR_KEY_PREFIX}-${tree_focus_key}" "$cmd,${tree_position},${tree_width},focus"
}

set_key_bindings() {
Expand Down