Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions fish/conf.d/10-core.fish
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ else
end
set -gx VISUAL "$EDITOR"

if test (uname) = Linux
for nix_profile_bin in /nix/var/nix/profiles/default/bin "$HOME/.nix-profile/bin"
if test -d "$nix_profile_bin"
fish_add_path --path --move "$nix_profile_bin"
end
end
end

alias g git
alias gs 'git status'
alias ga 'git add'
Expand Down
12 changes: 11 additions & 1 deletion fish/tests/w2-core.fish
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function run_fish
env -i HOME="$home" USER=test-user LOGNAME=test-user XDG_CONFIG_HOME="$xdg" PATH="$bin:/usr/bin:/bin" TERM=xterm-256color LANG=C "$fish_bin" $argv
end

function run_clean_fish
env -i HOME="$home" USER=test-user LOGNAME=test-user XDG_CONFIG_HOME="$xdg" PATH="$bin:/usr/bin:/bin" TERM=xterm-256color LANG=C "$fish_bin" --no-config $argv
end

function assert_navigation_error
set -l command "$argv[1]"
set -l expected "$argv[2]"
Expand Down Expand Up @@ -82,11 +86,17 @@ set -l aliases (run_fish -c 'functions gs; functions gpl' | string collect)
string match -q '*git status*' "$aliases"; or fail 'gs alias'
string match -q '*git pull*' "$aliases"; or fail 'gpl alias'

printf '#!/bin/sh\nprintf "%s\\n" Linux\n' >"$bin/uname"
printf '#!/bin/sh\necho Linux\n' >"$bin/uname"
chmod +x "$bin/uname"
set -l linux_open_alias (run_fish -c 'functions -q o; and echo defined; or echo absent')
assert_equal "$linux_open_alias" absent 'Linux Fish startup excludes the macOS open alias'

mkdir -p "$home/.nix-profile/bin"
printf '#!/bin/sh\n' >"$home/.nix-profile/bin/w2-profile-command"
chmod +x "$home/.nix-profile/bin/w2-profile-command"
set -l linux_profile_command (run_clean_fish -c "source '$xdg/fish/conf.d/10-core.fish'; command -s w2-profile-command")
assert_equal "$linux_profile_command" "$home/.nix-profile/bin/w2-profile-command" 'Linux Fish startup resolves commands from the user Nix profile'

printf '#!/bin/sh\n[ "$1" = init ] && printf "set -gx W2_STARSHIP_READY 1\\n"\n' >"$bin/starship"
chmod +x "$bin/starship"
set -l noninteractive (run_fish -c 'set -q W2_STARSHIP_READY; and echo ready; or echo skipped')
Expand Down
Loading