Skip to content

Commit

Permalink
refactor fish_title.fish
Browse files Browse the repository at this point in the history
  • Loading branch information
edouard-lopez committed Jan 8, 2019
1 parent 1add34d commit 97c9c4d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions fish_title.fish
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Set title to current folder and shell name
function fish_title
function fish_title \
--description "Set title to current folder and shell name" \
--argument-names last_command

set --local basename (string replace -r '^.*/' '' -- $PWD)
set --local current_folder (_pure_parse_directory)
set --local command $argv[1]
set --local prompt "$basename: $command $pure_symbol_horizontal_bar $_"
set --local current_command (status current-command 2>/dev/null; or echo $_)

set --local prompt "$basename: $last_command $pure_symbol_horizontal_bar $current_command"

if test -z "$command"
set prompt "$current_folder $pure_symbol_horizontal_bar $_"
if test -z "$last_command"
set prompt "$current_folder $pure_symbol_horizontal_bar $current_command"
end

echo $prompt
Expand Down

0 comments on commit 97c9c4d

Please sign in to comment.