Add cwd.sh to display the tmux pane's current working directory, updated README to reflect change
This commit is contained in:
parent
b346d10306
commit
09c5750656
3 changed files with 37 additions and 0 deletions
|
@ -31,6 +31,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
|
||||||
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
|
- If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature
|
||||||
- Spotify playback (needs the tool spotify-tui installed)
|
- Spotify playback (needs the tool spotify-tui installed)
|
||||||
- Current kubernetes context
|
- Current kubernetes context
|
||||||
|
- Current working directory of tmux pane
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
|
|
30
scripts/cwd.sh
Executable file
30
scripts/cwd.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# return current working directory of tmux pane
|
||||||
|
getPaneDir()
|
||||||
|
{
|
||||||
|
nextone="false"
|
||||||
|
for i in $(tmux list-panes -F "#{pane_active} #{pane_current_path}");
|
||||||
|
do
|
||||||
|
if [ "$nextone" == "true" ]; then
|
||||||
|
echo $i
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ "$i" == "1" ]; then
|
||||||
|
nextone="true"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
path=$(getPaneDir)
|
||||||
|
|
||||||
|
# change '/home/user' to '~'
|
||||||
|
cwd=$(echo $path | sed "s;$HOME;~;g")
|
||||||
|
|
||||||
|
echo $cwd
|
||||||
|
}
|
||||||
|
|
||||||
|
#run main driver program
|
||||||
|
main
|
|
@ -128,6 +128,12 @@ main()
|
||||||
|
|
||||||
for plugin in "${plugins[@]}"; do
|
for plugin in "${plugins[@]}"; do
|
||||||
|
|
||||||
|
if [ $plugin = "cwd" ]; then
|
||||||
|
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white")
|
||||||
|
tmux set-option -g status-right-length 250
|
||||||
|
script="#($current_dir/cwd.sh)"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $plugin = "git" ]; then
|
if [ $plugin = "git" ]; then
|
||||||
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-git-colors" "green dark_gray")
|
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-git-colors" "green dark_gray")
|
||||||
tmux set-option -g status-right-length 250
|
tmux set-option -g status-right-length 250
|
||||||
|
|
Loading…
Reference in a new issue