Add title setting support.

Pulled from @chgu82837

39af8e2885/fish_prompt.fish (L82-L90)
This commit is contained in:
Nelson Chen 2015-10-12 21:41:30 -07:00
parent 119ef28152
commit 8f2cf90636
3 changed files with 15 additions and 2 deletions

View File

@ -24,7 +24,9 @@ $ omf u nelsonjchen
* re5et: 24 hour clock
* MM DD YY date format
* re5et: YY MM DD date format
* Title Setting to the `prompt_pwd` function in fish for screen, tmux, and non-terminal multiplexer.
* This is derived from [@chgu82837's theme](https://github.com/chgu82837/theme-PastFish/blob/39af8e2885e308501bb0afa9dedab193a8722cfe/fish_prompt.fish#L82-L90)
## Omissions from the re5et version
* Trimming down the working directory display only works on `~`. The original re5et prompt would also trim based on the current environment variables set. For example, if you had the environment variable `FOO` set to `/usr/local` and you did `cd /usr/local`, you would see `$FOO/` in the prompt as the current working directory. I'm not sure how I would get this working. `fish` does appear to have a condensation function but it goes beyond simple environment variable replacement and I can't figure out how to turn it off.

View File

@ -7,5 +7,13 @@ function fish_right_prompt -d "Write out the right prompt"
set_color normal
end
# tmux, screen title
switch $TERM;
case xterm'*' vte'*';
printf '\033]0;['(prompt_pwd)']\007';
case screen'*';
printf '\033k['(prompt_pwd)']\033\\';
end
echo -ns (date "+%D")" - "(date "+%l:%M %p")
end

View File

@ -1,3 +1,6 @@
function fish_title
# Customize the title bar of the terminal window.
# Customize the title bar of the terminal window.
# This does not affect tmux. Look at fish_right_prompt for what actually
# affects it.
echo '['(prompt_pwd)']'
end