about summary refs log tree commit diff
path: root/nix/profiles/home-manager/fish.nix
blob: 2ea90d98dbd180ec35e6acadcdec16b271da3f17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ ... }: {
  programs.fish = {
    enable = true;
    interactiveShellInit = ''
      set fish_greeting ""
    '';
    shellInit = ''
      # Fish git prompt
      set __fish_git_prompt_showuntrackedfiles 'yes'
      set __fish_git_prompt_showdirtystate 'yes'
      set __fish_git_prompt_showstashstate \'\'
      set __fish_git_prompt_showupstream 'none'
      set -g fish_prompt_pwd_dir_length 3

      # colored man output
      # from http://linuxtidbits.wordpress.com/2009/03/23/less-colors-for-man-pages/
      setenv LESS_TERMCAP_mb \e'[01;31m'       # begin blinking
      setenv LESS_TERMCAP_md \e'[01;38;5;74m'  # begin bold
      setenv LESS_TERMCAP_me \e'[0m'           # end mode
      setenv LESS_TERMCAP_se \e'[0m'           # end standout-mode
      setenv LESS_TERMCAP_so \e'[38;5;246m'    # begin standout-mode - info box
      setenv LESS_TERMCAP_ue \e'[0m'           # end underline
      setenv LESS_TERMCAP_us \e'[04;38;5;146m' # begin underline

      function fish_prompt
        set_color brblack
        echo -n "["(date "+%H:%M")"] "
        set_color blue
        echo -n (hostname -s)
        if [ $PWD != $HOME ]
          set_color brblack
          echo -n ':'
          set_color yellow
          echo -n (basename $PWD)
        end
        set_color green
        printf '%s ' (__fish_git_prompt)
        set_color red
        echo -n '| '
        set_color normal
      end
    '';
  };
}