viconf now disables semantic tokens for nixd if the file contains non-ascii characters, temporary workaround until the feature is fixed

This commit is contained in:
pagedmov
2024-11-07 02:03:15 -05:00
parent 50decf03c9
commit 319ca70254
4 changed files with 17 additions and 3 deletions

View File

@@ -23,9 +23,23 @@ pkgs.writeShellApplication {
results=$(echo "$results" | cut -d'/' -f4-)
results=$(echo "$results" | grep "$1")
echo "$results" | tr ' ' '\n' | fzf | xargs -I {} nvim "$results_prefix"/{}
file=$(echo "$results" | tr ' ' '\n' | fzf)
file="$results_prefix/$file"
# Check if the file contains any non-UTF-8 characters
if grep --color='auto' -P -q "[^\x00-\x7F]" "$file"; then
NIXD_FLAGS="--semantic-tokens=false" nvim "$results_prefix"/"$file"
else
nvim "$file"
fi
else
nvim "$results"
# Check if the file contains any non-UTF-8 characters
if grep --color='auto' -P -q "[^\x00-\x7F]" "$results"; then
NIXD_FLAGS="--semantic-tokens=false" nvim "$results"
else
nvim "$results"
fi
fi
'';
}