File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
current_dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
4
- source $current_dir /utils.sh
4
+ source " $current_dir /utils.sh"
5
5
6
6
# return current working directory of tmux pane
7
7
getPaneDir () {
@@ -18,20 +18,25 @@ getPaneDir() {
18
18
main () {
19
19
path=$( getPaneDir)
20
20
21
+ if [[ " $path " == " $HOME " ]]; then
22
+ echo " ~"
23
+ exit 0
24
+ fi
25
+
21
26
# change '/home/user' to '~'
22
- cwd=" ${path/ " $HOME " / ' ~' } "
27
+ cwd=" ${path/ " ${ HOME} / " / ' ~/ ' } "
23
28
24
29
# 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" )
26
31
27
- if [[ " $cwd_len " -gt 0 ]]; then
32
+ if [[ " $cwd_max_dirs " -gt 0 ]]; then
28
33
base_to_erase=$cwd
29
- for (( i = 0 ; i < cwd_len ; i++ )) ; do
34
+ for (( i = 0 ; i < cwd_max_dirs ; i++ )) ; do
30
35
base_to_erase=" ${base_to_erase%/* } "
31
36
done
32
37
# / would have #base_to_erase of 0 and ~/ has #base_to_erase of 1. we want to exclude both cases
33
38
if [[ ${# base_to_erase} -gt 1 ]]; then
34
- cwd=${cwd: ${# base_to_erase} +1}
39
+ cwd=" …/ ${cwd: ${# base_to_erase} +1} "
35
40
fi
36
41
fi
37
42
You can’t perform that action at this time.
0 commit comments