Add option to display running command in title

This commit is contained in:
Sweenu 2018-04-07 11:02:59 +02:00
parent f66bee227a
commit 695ef2e50f
2 changed files with 21 additions and 8 deletions

View File

@ -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.

View File

@ -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 fish_title
__bobthefish_title_user
if [ "$theme_title_display_process" = 'yes' ]
echo $_
[ "$theme_title_display_path" != 'no' ]
and echo ' '
end
if [ "$theme_title_display_path" != 'no' ]
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' -a "$theme_title_display_command" != 'yes' ]
echo $_
[ "$theme_title_display_path" != 'no' ]
and echo ' '
and __display_path
else
if [ "$theme_title_display_path" != 'no' ]
__display_path
echo ' '
end
if [ $_ != 'fish' ]
echo $argv[1]
end
end
end