.config/fish/config.fish 3.7 KiB raw
1
#
2
# config.fish
3
#
4
set -gx PATH \
5
  "$HOME/bin" \
6
  "$HOME/.local/bin" \
7
  "$HOME/.bun/bin" \
8
  "$HOME/.radicle/bin" \
9
  "$HOME/.cargo/bin" \
10
  "$HOME/.npm/bin" \
11
  "$HOME/.local/share/gem/ruby/3.4.0/bin" \
12
  "$HOME/.proto/shims" \
13
  "$HOME/.proto/bin" \
14
  "$HOME/.local/share/pnpm/bin" \
15
  $PATH
16
set -gx EDITOR nvim
17
set -gx VISUAL nvim
18
set -gx RIPGREP_CONFIG_PATH "$HOME/.rgrc"
19
set -gx CARGO_BUILD_JOBS 12
20
set -gx PNPM_HOME "$HOME/.local/share/pnpm"
21
22
if status is-interactive
23
  fish_vi_key_bindings
24
25
  set -g fish_greeting
26
  set -g fish_autosuggestion_enabled 0
27
28
  set fish_cursor_default block
29
  set fish_cursor_insert underscore
30
  set fish_cursor_replace_one underscore
31
  set fish_cursor_visual block
32
33
  set -l ssh_keys
34
  while read -l ssh_key
35
    set -a ssh_keys ~/.ssh/$ssh_key
36
  end <~/.ssh/keychain.keys
37
  set -l keychain_env ~/.keychain/(uname -n)-fish
38
39
  if set -q SSH_AUTH_SOCK
40
    if not test -S "$SSH_AUTH_SOCK"
41
      set -e SSH_AUTH_SOCK
42
      set -e SSH_AGENT_PID
43
    end
44
  end
45
46
  if status is-login; and type -q ssh-add; and set -q SSH_AUTH_SOCK
47
    if test -S "$SSH_AUTH_SOCK"
48
      ssh-add -l >/dev/null 2>&1
49
      if test $status -eq 2
50
        set -e SSH_AUTH_SOCK
51
        set -e SSH_AGENT_PID
52
      else if test $status -eq 1
53
        set -e SSH_AUTH_SOCK
54
        set -e SSH_AGENT_PID
55
      end
56
    end
57
  end
58
59
  if status is-login; and type -q keychain
60
    keychain --eval --quiet --noinherit $ssh_keys | source
61
  else if not set -q SSH_AUTH_SOCK
62
    if test -r "$keychain_env"
63
      source "$keychain_env"
64
    end
65
  end
66
67
  function fish_mode_prompt
68
  end
69
70
  bind -M insert \cr history-pager
71
  bind \cz 'fg 2>/dev/null; commandline -f repaint'
72
  bind -M insert \cz 'fg 2>/dev/null; commandline -f repaint'
73
74
  if test -n "$SSH_CLIENT"; or test -n "$SSH_TTY"
75
    set -gx TERM xterm
76
  end
77
78
  set -gx GPG_TTY (tty)
79
  set -gx NNN_USE_EDITOR 1
80
  set -gx GOPATH ~
81
  set -gx PAGER "less -s -M +Gg"
82
  set -gx EZA_COLORS "reset:fi=37:di=36:ln=36:or=31:ex=32:sp=31:pi=33:so=33:bd=33:cd=33:xx=90:da=90:uu=37:gu=37:ur=90:uw=90:ux=32:gr=90:gw=90:gx=32:tr=90:tw=90:tx=32:sn=37:sb=90:lc=90"
83
84
  alias l "eza --width=50 --color=auto --icons --group-directories-first"
85
  alias ll "eza -lag --color=auto --icons --group-directories-first"
86
  alias g git
87
  alias n "sudo netctl"
88
  alias m "make -j8"
89
  alias b yazi
90
  alias f fd
91
  alias mv "/bin/mv -i"
92
  alias img swayimg
93
  alias df "df -h"
94
  alias sys systemctl
95
  alias s systemctl
96
  alias pdf zathura
97
  alias webserver "python -m http.server"
98
  alias pacman "sudo pacman --color=auto"
99
  alias vim nvim
100
  alias clip wl-copy
101
  alias irc weechat
102
  alias cloc tokei
103
  alias shred "shred -uvz"
104
  alias diskusage ncdu
105
  alias calc kalk
106
  alias t tree-git-ignore
107
  alias sql3 "sqlite3 -box"
108
  alias mysql mariadb
109
110
  function awsx
111
    set -l profile (aws configure list-profiles | fzf --prompt "AWS profile: ")
112
    test -n "$profile"; or return 1
113
    set -gx AWS_PROFILE "$profile"
114
    echo "AWS_PROFILE=$AWS_PROFILE"
115
  end
116
117
  function e
118
    $EDITOR $argv
119
  end
120
121
  function weather
122
    curl "https://v2.wttr.in/$argv[1]"
123
  end
124
125
  function tree-git-ignore
126
    set -l ignored (git ls-files -ci --others --directory --exclude-standard 2>/dev/null \
127
      | string match -rv '^#.*$|^[[:space:]]*$' \
128
      | string replace -r '^/' '' \
129
      | string replace -r '/$' '')
130
131
    set -l ignored_filter ".git"
132
    if test (count $ignored) -gt 0
133
      set ignored_filter ".git|"(string join "|" $ignored)
134
    end
135
136
    /usr/bin/tree --prune -I "$ignored_filter" $argv
137
  end
138
139
  function find-and-replace
140
    rg "$argv[1]" --files-with-matches | xargs sed -i "s@$argv[1]@$argv[2]@g"
141
  end
142
143
  function pdf-slice
144
    qpdf $argv[1] --pages . $argv[2] -- $argv[3]
145
  end
146
147
  function col
148
    awk "{ print \$$argv[1] }"
149
  end
150
151
  source ~/.config/fish/pureish.fish
152
153
  if type -q fzf
154
    fzf --fish | source
155
  end
156
end