Add `fish` config

bladee.bsky.social e1cc67d8

verified
Changed files
+78
dot_config
+1
.chezmoidata.toml
···
+
editor = "hx"
+51
dot_config/private_fish/config.fish.tmpl
···
+
{{ $brewPath := lookPath "brew" }}
+
{{ if $brewPath -}}
+
# Set up Homebrew.
+
set -x HOMEBREW_NO_INSTALL_CLEANUP 1
+
set -x HOMEBREW_NO_ANALYTICS 1
+
eval ({{ $brewPath | quote }} shellenv)
+
{{ end -}}
+
+
# Add directories to path.
+
fish_add_path --global {{ joinPath .chezmoi.homeDir ".cargo/bin" | quote }}
+
fish_add_path --global {{ joinPath .chezmoi.homeDir ".local/bin" | quote }}
+
+
# Set XDG data directories.
+
set -x XDG_CACHE_HOME {{ joinPath .chezmoi.homeDir ".cache" | quote }}
+
set -x XDG_CONFIG_HOME {{ joinPath .chezmoi.homeDir ".config" | quote }}
+
set -x XDG_DATA_HOME {{ joinPath .chezmoi.homeDir ".local/share" | quote }}
+
set -x XDG_STATE_HOME {{ joinPath .chezmoi.homeDir ".local/state" | quote }}
+
+
{{ $editorName := .editor | default "vi" -}}
+
{{ $editorPath := lookPath $editorName -}}
+
{{ if $editorPath -}}
+
set -x EDITOR {{ $editorPath | quote }}
+
{{ end -}}
+
+
{{ $batPath := lookPath "bat" }}
+
{{ if $batPath -}}
+
# Configure 'bat'.
+
alias cat bat
+
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
+
set -x MANROFFOPT "-c"
+
set -x BAT_PAGER "less -FIKMFRS"
+
{{ end -}}
+
+
# Set default less options.
+
set -x SYSTEMD_LESS FIKMRS
+
+
{{ $jjPath := lookPath "jj" }}
+
{{ if $jjPath -}}
+
# Enable JJ completions.
+
COMPLETE=fish {{ $jjPath | quote }} | source
+
{{ end -}}
+
+
{{ $gioPath := lookPath "gio" }}
+
{{ if $gioPath -}}
+
# Disable rm if the trash is enabled.
+
alias ts "{{ $gioPath }} trash"
+
function rm
+
echo "'rm' is disabled. use 'ts' to move items to trash, or 'command rm' to use rm."
+
return 1
+
end
+
{{ end -}}
+20
dot_config/private_fish/functions/clip.fish
···
+
function clip
+
if test $XDG_SESSION_TYPE = x11
+
if ! command --query xclip
+
echo -e "Error: `xclip` must be installed to copy on an X11 session"
+
return 1
+
end
+
+
command xclip -selection c
+
else if test $XDG_SESSION_TYPE = wayland
+
if ! command --query wl-copy
+
echo -e "Error: `wl-clipboard` must be installed to copy on a Wayland session"
+
return 1
+
end
+
+
command wl-copy
+
else
+
echo -e "Error: Unknown session type `$XDG_SESSION_TYPE`"
+
return 1
+
end
+
end
+3
dot_config/private_fish/functions/edit.fish
···
+
function edit
+
flatpak run --file-forwarding org.gnome.TextEditor @@ $argv @@
+
end
+3
dot_config/private_fish/functions/fish_greeting.fish
···
+
function fish_greeting
+
systemctl --user list-units --quiet --state=failed
+
end