File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ current_dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
4+ source $current_dir /utils.sh
5+
36# return current working directory of tmux pane
47getPaneDir () {
58 nextone=" false"
@@ -18,6 +21,20 @@ main() {
1821 # change '/home/user' to '~'
1922 cwd=" ${path/ " $HOME " / ' ~' } "
2023
24+ # check max number of subdirs to display. 0 means unlimited
25+ cwd_len=$( get_tmux_option " @dracula-cwd-length" " 0" )
26+
27+ if [[ " $cwd_len " -gt 0 ]]; then
28+ base_to_erase=$cwd
29+ for (( i = 0 ; i < cwd_len ; i++ )) ; do
30+ base_to_erase=" ${base_to_erase%/* } "
31+ done
32+ # / would have #base_to_erase of 0 and ~/ has #base_to_erase of 1. we want to exclude both cases
33+ if [[ ${# base_to_erase} -gt 1 ]]; then
34+ cwd=${cwd: ${# base_to_erase} +1}
35+ fi
36+ fi
37+
2138 echo " $cwd "
2239}
2340
You can’t perform that action at this time.
0 commit comments