Skip to content

Commit 3694d3a

Browse files
author
Bruno Sutic
committed
Add an option for specifying custom command
1 parent 275ed5f commit 3694d3a

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- bugfix: invalid params for 'save_sidebar_width' script
55
- remove tilde characters from less
66
- improve less and tree commands
7+
- add option for specifying custom command
78

89
### v0.6.0, Sep 05, 2014
910
- more options for customizing tree sidebar

scripts/tree_helpers.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ command_exists() {
77
}
88

99
tree_command() {
10-
if command_exists "tree"; then
11-
echo "tree -C"
10+
local user_command="$(tree_user_command)"
11+
if [ -n "$user_command" ]; then
12+
echo "$user_command"
13+
elif command_exists "tree"; then
14+
echo "$TREE_COMMAND"
1215
else
1316
echo "$custom_tree_command"
1417
fi
1518
}
1619

20+
tree_user_command() {
21+
get_tmux_option "$TREE_COMMAND_OPTION" ""
22+
}
23+
1724
tree_key() {
1825
get_tmux_option "$TREE_OPTION" "$TREE_KEY"
1926
}

scripts/variables.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ TREE_OPTION="@sidebar-tree"
99
TREE_FOCUS_KEY="Bspace"
1010
TREE_FOCUS_OPTION="@sidebar-tree-focus"
1111

12-
TREE_PAGER="LESS='' less --dumb --chop-long-lines --tilde --IGNORE-CASE --RAW-CONTROL-CHARS"
12+
TREE_COMMAND="tree -C"
13+
TREE_COMMAND_OPTION="@sidebar-tree-command"
14+
15+
TREE_PAGER="LESS=\"\" less --dumb --chop-long-lines --tilde --IGNORE-CASE --RAW-CONTROL-CHARS"
1316
TREE_PAGER_OPTION="@sidebar-tree-pager"
1417

1518
TREE_POSITION="left"

0 commit comments

Comments
 (0)