From 695ef2e50f05357b7137b25de5a187c2df0c3b51 Mon Sep 17 00:00:00 2001 From: Sweenu Date: Sat, 7 Apr 2018 11:02:59 +0200 Subject: [PATCH] Add option to display running command in title --- README.md | 2 ++ fish_title.fish | 27 +++++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d1aa885..bb80d4e 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ set -g theme_display_vi no set -g theme_display_date no set -g theme_display_cmd_duration yes set -g theme_title_display_process yes +set -g theme_title_display_command no set -g theme_title_display_path no set -g theme_title_display_user yes set -g theme_title_use_abbreviated_path no @@ -104,6 +105,7 @@ set -g theme_newline_cursor yes **Title options** - `theme_title_display_process`. By default theme doesn't show current process name in terminal title. If you want to show it, just set to `yes`. +- `theme_title_display_command`. Use `yes` to show current running command in title (this overrides whatever value `theme_title_display_process` has). - `theme_title_display_path`. Use `no` to hide current working directory from title. - `theme_title_display_user`. Set to `yes` to show the current user in the tab title (unless you're the default user). - `theme_title_use_abbreviated_path`. Default is `yes`. This means your home directory will be displayed as `~` and `/usr/local` as `/u/local`. Set it to `no` if you prefer full paths in title. diff --git a/fish_title.fish b/fish_title.fish index 2914000..1bd794d 100644 --- a/fish_title.fish +++ b/fish_title.fish @@ -1,5 +1,6 @@ # You can override some default title options in your config.fish: # set -g theme_title_display_process no +# set -g theme_title_display_command no # set -g theme_title_display_path no # set -g theme_title_display_user yes # set -g theme_title_use_abbreviated_path no @@ -14,21 +15,31 @@ function __bobthefish_title_user -S -d 'Display actual user if different from $d end end +function __display_path -d 'Display the full or abbreviated path' + if [ "$theme_title_use_abbreviated_path" = 'no' ] + echo $PWD + else + prompt_pwd + end +end + function fish_title __bobthefish_title_user - if [ "$theme_title_display_process" = 'yes' ] + if [ "$theme_title_display_process" = 'yes' -a "$theme_title_display_command" != 'yes' ] echo $_ [ "$theme_title_display_path" != 'no' ] and echo ' ' - end + and __display_path + else + if [ "$theme_title_display_path" != 'no' ] + __display_path + echo ' ' + end - if [ "$theme_title_display_path" != 'no' ] - if [ "$theme_title_use_abbreviated_path" = 'no' ] - echo $PWD - else - prompt_pwd - end + if [ $_ != 'fish' ] + echo $argv[1] + end end end