diff --git a/dots/.config/zsh/config/completions/completions/_dotnet b/dots/.config/zsh/config/completions/completions/_dotnet deleted file mode 100644 index fad435fb..00000000 --- a/dots/.config/zsh/config/completions/completions/_dotnet +++ /dev/null @@ -1,8 +0,0 @@ -#compdef dotnet -_dotnet_zsh_complete() -{ - local completions=("$(dotnet complete "$words")") - - reply=( "${(ps:\n:)completions}" ) -} -compctl -K _dotnet_zsh_complete dotnet diff --git a/dots/.config/zsh/config/completions/completions/_dotnet_suggest b/dots/.config/zsh/config/completions/completions/_dotnet_suggest new file mode 100644 index 00000000..c86e3018 --- /dev/null +++ b/dots/.config/zsh/config/completions/completions/_dotnet_suggest @@ -0,0 +1,38 @@ +#compdef dotnet +_dotnet_zsh_complete() +{ + # debug lines, uncomment to get state variables passed to this function + # echo "\n\n\nstate:\t'$state'" + # echo "line:\t'$line'" + # echo "words:\t$words" + + # Get full path to script because dotnet-suggest needs it + # NOTE: this requires a command registered with dotnet-suggest be + # on the PATH + full_path=`which ${words[1]}` # zsh arrays are 1-indexed + # Get the full line + # $words array when quoted like this gets expanded out into the full line + full_line="$words" + + # Get the completion results, will be newline-delimited + completions=$(dotnet suggest get --executable "$full_path" -- "$full_line") + # explode the completions by linefeed instead of by spaces into the descriptions for the + # _values helper function. + + exploded=(${(f)completions}) + # for later - once we have descriptions from dotnet suggest, we can stitch them + # together like so: + # described=() + # for i in {1..$#exploded}; do + # argument="${exploded[$i]}" + # description="hello description $i" + # entry=($argument"["$description"]") + # described+=("$entry") + # done + _values 'suggestions' $exploded +} + +# apply this function to each command the dotnet-suggest knows about +compdef _dotnet_zsh_complete $(dotnet-suggest list) + +export DOTNET_SUGGEST_SCRIPT_VERSION="1.0.0" diff --git a/dots/.config/zsh/config/profile/profile/env.zsh b/dots/.config/zsh/config/profile/profile/env.zsh index c2b378e6..88f40361 100644 --- a/dots/.config/zsh/config/profile/profile/env.zsh +++ b/dots/.config/zsh/config/profile/profile/env.zsh @@ -83,6 +83,8 @@ export PATH="${PATH}:${CARGO_HOME}/bin" ## Dotnet ### export PATH="${PATH}:${XDG_DATA_HOME}/dotnet" +export DOTNET_ROOT="${XDG_DATA_HOME}/dotnet" +export PATH="${PATH}:${HOME}/.dotnet/tools" ### Go ### export GOPATH="${HOME}/.local/share/go"