···11+{{ $brewPath := lookPath "brew" }}
22+{{ if $brewPath -}}
33+# Set up Homebrew.
44+set -x HOMEBREW_NO_INSTALL_CLEANUP 1
55+set -x HOMEBREW_NO_ANALYTICS 1
66+eval ({{ $brewPath | quote }} shellenv)
77+{{ end -}}
88+99+# Add directories to path.
1010+fish_add_path --global {{ joinPath .chezmoi.homeDir ".cargo/bin" | quote }}
1111+fish_add_path --global {{ joinPath .chezmoi.homeDir ".local/bin" | quote }}
1212+1313+# Set XDG data directories.
1414+set -x XDG_CACHE_HOME {{ joinPath .chezmoi.homeDir ".cache" | quote }}
1515+set -x XDG_CONFIG_HOME {{ joinPath .chezmoi.homeDir ".config" | quote }}
1616+set -x XDG_DATA_HOME {{ joinPath .chezmoi.homeDir ".local/share" | quote }}
1717+set -x XDG_STATE_HOME {{ joinPath .chezmoi.homeDir ".local/state" | quote }}
1818+1919+{{ $editorName := .editor | default "vi" -}}
2020+{{ $editorPath := lookPath $editorName -}}
2121+{{ if $editorPath -}}
2222+set -x EDITOR {{ $editorPath | quote }}
2323+{{ end -}}
2424+2525+{{ $batPath := lookPath "bat" }}
2626+{{ if $batPath -}}
2727+# Configure 'bat'.
2828+alias cat bat
2929+set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
3030+set -x MANROFFOPT "-c"
3131+set -x BAT_PAGER "less -FIKMFRS"
3232+{{ end -}}
3333+3434+# Set default less options.
3535+set -x SYSTEMD_LESS FIKMRS
3636+3737+{{ $jjPath := lookPath "jj" }}
3838+{{ if $jjPath -}}
3939+# Enable JJ completions.
4040+COMPLETE=fish {{ $jjPath | quote }} | source
4141+{{ end -}}
4242+4343+{{ $gioPath := lookPath "gio" }}
4444+{{ if $gioPath -}}
4545+# Disable rm if the trash is enabled.
4646+alias ts "{{ $gioPath }} trash"
4747+function rm
4848+ echo "'rm' is disabled. use 'ts' to move items to trash, or 'command rm' to use rm."
4949+ return 1
5050+end
5151+{{ end -}}
+20
dot_config/private_fish/functions/clip.fish
···11+function clip
22+ if test $XDG_SESSION_TYPE = x11
33+ if ! command --query xclip
44+ echo -e "Error: `xclip` must be installed to copy on an X11 session"
55+ return 1
66+ end
77+88+ command xclip -selection c
99+ else if test $XDG_SESSION_TYPE = wayland
1010+ if ! command --query wl-copy
1111+ echo -e "Error: `wl-clipboard` must be installed to copy on a Wayland session"
1212+ return 1
1313+ end
1414+1515+ command wl-copy
1616+ else
1717+ echo -e "Error: Unknown session type `$XDG_SESSION_TYPE`"
1818+ return 1
1919+ end
2020+end