SHARE
TWEET

Untitled

a guest Aug 20th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # File: ~/.config/fish/functions/fish_title.fish
  2. # Strips directory names to single char to save space even more
  3. # Requires fish version 2.7.1-1113-ge598cb23 or greater due to `set -a` functionality
  4. function fish_title
  5.   set -l new_pwd
  6.   # replace home path with ~
  7.   set -l cwd (pwd | sed "s:^$HOME:~:")
  8.  
  9.   # loop through all folders on cwd, but the last one
  10.   for x in (echo $cwd | string split '/')[1..-2]
  11.       set -a new_pwd (string sub -s 1 -l1 $x)
  12.   end
  13.  
  14.   # add full name of the the last (current) directory
  15.   set -a new_pwd (echo $cwd | string split '/')[-1..-1]
  16.  
  17.   # include hostname
  18.   echo \[(hostname)\] (string join "/" $new_pwd)
  19.  
  20. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top