Skip to content

Commit

Permalink
Merge pull request #26 from chisui/issue-25
Browse files Browse the repository at this point in the history
add autocomplete
  • Loading branch information
chisui authored Apr 30, 2021
2 parents b6ac21e + 6c9562e commit 0f8b8c0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nix-shell.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function nix-shell() {
command nix-shell "$@"
else
NIX_SHELL_PACKAGES="$NIX_SHELL_PACKAGES" \
NIX_BUILD_SHELL="$NIX_SHELL_PLUGIN_DIR/scripts/buildShellShim.zsh" \
NIX_BUILD_SHELL="$NIX_SHELL_PLUGIN_DIR/scripts/buildShellShim" \
NIX_EXECUTING_SHELL="$SHELL" \
command nix-shell "$@"
fi
Expand Down
24 changes: 24 additions & 0 deletions scripts/buildShellShim
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /usr/bin/env sh

if [ "$1" = "--rcfile" ]; then
# This means the shell should stay open after executing. So we remove the last line which contains 'exit'
shift
tmp="$(cat $1)"
echo ${tmp%exit} > $1
cat >> $1 <<EOF
FPATH=\$(echo 'echo \$FPATH' | ${NIX_EXECUTING_SHELL} --stdin)
for path in \${PATH//:/ }; do
if [[ \$path = /nix/store/* ]]; then
path=\${path/%bin/share\/zsh\/site-functions}
if [ -d "\$path" ]; then
FPATH="\$path:\$FPATH"
fi
fi
done
FPATH=\$FPATH ${NIX_EXECUTING_SHELL}
EOF
bash $1
else
bash "$@"
fi

13 changes: 0 additions & 13 deletions scripts/buildShellShim.zsh

This file was deleted.

0 comments on commit 0f8b8c0

Please sign in to comment.