From caf01278df0faabe945311bece519d09bb1ba9a5 Mon Sep 17 00:00:00 2001 From: John Oxley Date: Wed, 3 May 2017 07:53:35 -0700 Subject: [PATCH] Added a flag usepager to disable use of the pager in the command --- docs/options.md | 4 ++++ scripts/tree_helpers.sh | 4 ++++ scripts/variables.sh | 3 +++ sidebar.tmux | 10 ++++++++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/options.md b/docs/options.md index a05f57a..acc2822 100644 --- a/docs/options.md +++ b/docs/options.md @@ -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 diff --git a/scripts/tree_helpers.sh b/scripts/tree_helpers.sh index 41e39d3..7be8797 100644 --- a/scripts/tree_helpers.sh +++ b/scripts/tree_helpers.sh @@ -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" } diff --git a/scripts/variables.sh b/scripts/variables.sh index 9d7c3fc..bb2b473 100644 --- a/scripts/variables.sh +++ b/scripts/variables.sh @@ -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" diff --git a/sidebar.tmux b/sidebar.tmux index 61b973d..cbcb86a 100755 --- a/sidebar.tmux +++ b/sidebar.tmux @@ -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() {