53 lines
1.5 KiB
Fish
53 lines
1.5 KiB
Fish
function __fish_setup_on_tty_login --description "Set up environment on tty login"
|
|
for extra_path in ~/.{local,nix-profile,cargo,cabal,ghcup}/bin
|
|
if test -d "$extra_path"
|
|
set -gxp PATH "$extra_path"
|
|
end
|
|
end
|
|
|
|
if type -qf nvim
|
|
set -gx EDITOR nvim
|
|
set -gx VISUAL nvim
|
|
set -gx MANPAGER 'nvim +Man!'
|
|
else
|
|
if type -qf vim
|
|
set -gx EDITOR vim
|
|
set -gx VISUAL vim
|
|
end
|
|
end
|
|
|
|
if test -d {$HOME}/.nix-defexpr/channels
|
|
set -gx NIX_PATH {$HOME}/.nix-defexpr/channels
|
|
set -gx NIX_SSL_CERT_FILE '/etc/ssl/certs/ca-certificates.crt'
|
|
end
|
|
|
|
if test -d /var/lib/flatpak
|
|
# https://github.com/fish-shell/fish-shell/issues/7485#issuecomment-728984689
|
|
# https://wiki.archlinux.org/title/Flatpak#Adding_Flatpak_.desktop_files_to_your_menu
|
|
set -l xdg_data_home $XDG_DATA_HOME ~/.local/share
|
|
set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
|
|
|
|
for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin
|
|
if test -d $flatpakdir
|
|
contains $flatpakdir $PATH; or set -a PATH $flatpakdir
|
|
end
|
|
end
|
|
end
|
|
|
|
if type -qf kitty
|
|
set -gx TERM xterm-kitty
|
|
end
|
|
|
|
if type -qf fnm
|
|
fnm env | source
|
|
end
|
|
|
|
set -gx CLICOLOR 1
|
|
set -gx LSCOLORS 'gxfxcxdxbxegedabaggxgx'
|
|
end
|
|
|
|
# Instead of tty check, we would have liked to do this using status is-login
|
|
# check but for some reason that does not work?
|
|
set --local TTY1 (tty)
|
|
[ "$TTY1" = "/dev/tty1" ] && __fish_setup_on_tty_login
|