File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ # Source lib to get the function __get_vcs_root_path_and_vcs
2+ source " ${TMUX_POWERLINE_DIR_LIB} /vcs_helper.sh"
3+
4+ TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE=" ${TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE:- 1} "
5+
6+ generate_segmentrc () {
7+ read -d ' ' rccontents << EORC
8+ # Display mode for vcs_rootpath.
9+ # Example: (1: folder name only; 2: full path, w/o expansion; 3: full path, w/ tilde expansion)
10+ # export TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE="${TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE} "
11+ EORC
12+ echo " $rccontents "
13+ }
14+
15+
16+ run_segment () {
17+ __process_settings
18+ # get root_path
19+ { read ; read root_path; } < <( get_vcs_type_and_root_path)
20+
21+ if [ -n " $root_path " ]; then
22+ if [ " ${TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE} " -eq 1 ]; then
23+ root_path=" ${root_path/# $HOME / \~ } "
24+ root_path=" ${root_path/* \/ / } "
25+ elif [ " ${TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE} " -eq 2 ]; then
26+ root_path=" ${root_path/# $HOME / \~ } "
27+ elif [ " ${TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE} " -eq 3 ]; then
28+ root_path=" ${root_path} "
29+ fi
30+ echo -n " #[fg=${TMUX_POWERLINE_CUR_SEGMENT_FG} ]${root_path} "
31+ fi
32+
33+ return 0
34+ }
35+
36+ __process_settings () {
37+ if [ -z " $TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE " ]; then
38+ export TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE=" ${TMUX_POWERLINE_SEG_VCS_ROOTPATH_MODE} "
39+ fi
40+ }
You can’t perform that action at this time.
0 commit comments