File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33current_dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
4- source $current_dir /utils.sh
4+ source " $current_dir /utils.sh"
55
66# return current working directory of tmux pane
77getPaneDir () {
@@ -18,20 +18,25 @@ getPaneDir() {
1818main () {
1919 path=$( getPaneDir)
2020
21+ if [[ " $path " == " $HOME " ]]; then
22+ echo " ~"
23+ exit 0
24+ fi
25+
2126 # change '/home/user' to '~'
22- cwd=" ${path/ " $HOME " / ' ~' } "
27+ cwd=" ${path/ " ${ HOME} / " / ' ~/ ' } "
2328
2429 # check max number of subdirs to display. 0 means unlimited
25- cwd_len =$( get_tmux_option " @dracula-cwd-length " " 0" )
30+ cwd_max_dirs =$( get_tmux_option " @dracula-cwd-max-dirs " " 0" )
2631
27- if [[ " $cwd_len " -gt 0 ]]; then
32+ if [[ " $cwd_max_dirs " -gt 0 ]]; then
2833 base_to_erase=$cwd
29- for (( i = 0 ; i < cwd_len ; i++ )) ; do
34+ for (( i = 0 ; i < cwd_max_dirs ; i++ )) ; do
3035 base_to_erase=" ${base_to_erase%/* } "
3136 done
3237 # / would have #base_to_erase of 0 and ~/ has #base_to_erase of 1. we want to exclude both cases
3338 if [[ ${# base_to_erase} -gt 1 ]]; then
34- cwd=${cwd: ${# base_to_erase} +1}
39+ cwd=" …/ ${cwd: ${# base_to_erase} +1} "
3540 fi
3641 fi
3742
You can’t perform that action at this time.
0 commit comments