Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # File: ~/.config/fish/functions/fish_title.fish
- # Strips directory names to single char to save space even more
- # Requires fish version 2.7.1-1113-ge598cb23 or greater due to `set -a` functionality
- function fish_title
- set -l new_pwd
- # replace home path with ~
- set -l cwd (pwd | sed "s:^$HOME:~:")
- # loop through all folders on cwd, but the last one
- for x in (echo $cwd | string split '/')[1..-2]
- set -a new_pwd (string sub -s 1 -l1 $x)
- end
- # add full name of the the last (current) directory
- set -a new_pwd (echo $cwd | string split '/')[-1..-1]
- # include hostname
- echo \[(hostname)\] (string join "/" $new_pwd)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement