dotfiles/fish/.config/fish/conf.d/setup.fish
Sanchayan Maity 95a247891e fish: conf/setup: Pass the shell syntax to use for fnm
From the twitter discussion with fnm author, shell inference seems to be
slow. Passing the shell to use manually seems to speed this up.

fnm env --log-level=quiet | source

Executed in  534.50 millis    fish           external
   usr time    0.62 millis  620.00 micros    0.00 millis
   sys time    4.76 millis    0.00 micros    4.76 millis

fnm env --shell=fish --log-level=quiet | source

Executed in    1.51 millis    fish           external
   usr time    1.06 millis    0.00 micros    1.06 millis
   sys time    0.58 millis  579.00 micros    0.00 millis

Also, see the github issue
https://github.com/Schniz/fnm/issues/621
2022-01-03 20:26:47 +05:30

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 --shell=fish --log-level=quiet | 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