From 07fc2644a237187dd4c5680e88f4adadbf533603 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Wed, 12 Aug 2015 12:06:23 -0600 Subject: Initial commit of the working files --- lib/tmux_adapter.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/tmux_adapter.sh (limited to 'lib/tmux_adapter.sh') diff --git a/lib/tmux_adapter.sh b/lib/tmux_adapter.sh new file mode 100644 index 0000000..17674e4 --- /dev/null +++ b/lib/tmux_adapter.sh @@ -0,0 +1,12 @@ +# Get the current path in the segment. +get_tmux_cwd() { + local env_name=$(tmux display -p "TMUXPWD_#D" | tr -d %) + local env_val=$(tmux show-environment | grep --color=never "$env_name") + # The version below is still quite new for tmux. Uncomment this in the future :-) + #local env_val=$(tmux show-environment "$env_name" 2>&1) + + if [[ ! $env_val =~ "unknown variable" ]]; then + local tmux_pwd=$(echo "$env_val" | sed 's/^.*=//') + echo "$tmux_pwd" + fi +} -- cgit v1.2.3