From 2dd809781527976307b47a598887062047e202c9 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Thu, 20 Apr 2017 19:37:10 -0600 Subject: Making tmux configuration much easier to manage --- segments/pwd.sh | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100755 segments/pwd.sh (limited to 'segments/pwd.sh') diff --git a/segments/pwd.sh b/segments/pwd.sh deleted file mode 100755 index 2499762..0000000 --- a/segments/pwd.sh +++ /dev/null @@ -1,39 +0,0 @@ -# Print the current working directory (trimmed to max length). -# NOTE The trimming code's stolen from the web. Courtesy to who ever wrote it. - -# Source lib to get the function get_tmux_pwd -source "${TMUX_POWERLINE_DIR_LIB}/tmux_adapter.sh" - -TMUX_POWERLINE_SEG_PWD_MAX_LEN_DEFAULT="40" - -generate_segmentrc() { - read -d '' rccontents << EORC -# Maximum length of output. -export TMUX_POWERLINE_SEG_PWD_MAX_LEN="${TMUX_POWERLINE_SEG_PWD_MAX_LEN_DEFAULT}" -EORC - echo "$rccontents" -} - -__process_settings() { - if [ -z "$TMUX_POWERLINE_SEG_PWD_MAX_LEN" ]; then - export TMUX_POWERLINE_SEG_PWD_MAX_LEN="${TMUX_POWERLINE_SEG_PWD_MAX_LEN_DEFAULT}" - fi -} - -run_segment() { - __process_settings - # Truncate from the left. - tcwd=$(get_tmux_cwd) - trunc_symbol="ยทยทยท" - dir=${tcwd##*/} - local max_len="$TMUX_POWERLINE_SEG_PWD_MAX_LEN" - max_len=$(( ( max_len < ${#dir} ) ? ${#dir} : max_len )) - ttcwd=${tcwd/#$HOME/\~} - pwdoffset=$(( ${#ttcwd} - max_len )) - if [ ${pwdoffset} -gt "0" ]; then - ttcwd=${ttcwd:$pwdoffset:$max_len} - ttcwd=${trunc_symbol}/${ttcwd#*/} - fi - echo "$ttcwd" - return 0 -} -- cgit v1.2.3