fixed unbound variable issue with viconf. TODO: make this script not awful
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
{
|
{
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
keymaps = [
|
keymaps = [
|
||||||
|
{
|
||||||
|
action = "gg<S-V>G"; # select entire document
|
||||||
|
key = "<C-a>";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
action = "<cmd>ChatGPTEditWithInstructions<CR>";
|
action = "<cmd>ChatGPTEditWithInstructions<CR>";
|
||||||
key = "!egpt";
|
key = "!egpt";
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ pkgs.writeShellApplication {
|
|||||||
name = "viconf";
|
name = "viconf";
|
||||||
runtimeInputs = with pkgs; [ coreutils fd ripgrep fzf ];
|
runtimeInputs = with pkgs; [ coreutils fd ripgrep fzf ];
|
||||||
text = ''
|
text = ''
|
||||||
#!/usr/bin/env bash
|
set -- "''${1:-}"
|
||||||
|
if [ ! $# -lt 1 ]; then
|
||||||
if [ ! $# -eq 1 ]; then
|
|
||||||
results=$(find "$FLAKEPATH" -exec find {} \; | sort | uniq | rg '\.nix$')
|
results=$(find "$FLAKEPATH" -exec find {} \; | sort | uniq | rg '\.nix$')
|
||||||
numresults=$(echo "$results" | wc -l)
|
numresults=$(echo "$results" | wc -l)
|
||||||
else
|
else
|
||||||
@@ -20,10 +19,16 @@ pkgs.writeShellApplication {
|
|||||||
# cut up the paths to give shorter path names to fuzzy finder
|
# cut up the paths to give shorter path names to fuzzy finder
|
||||||
results_prefix=$(echo "$results" | tail -n 1 | cut -d'/' -f-3)
|
results_prefix=$(echo "$results" | tail -n 1 | cut -d'/' -f-3)
|
||||||
results=$(echo "$results" | cut -d'/' -f4-)
|
results=$(echo "$results" | cut -d'/' -f4-)
|
||||||
results=$(echo "$results" | grep "$1")
|
if [ -n "$1" ]; then
|
||||||
|
results=$(echo "$results" | grep "$1")
|
||||||
|
fi
|
||||||
|
|
||||||
file=$(echo "$results" | tr ' ' '\n' | fzf)
|
file=$(echo "$results" | tr ' ' '\n' | fzf)
|
||||||
file="$results_prefix/$file"
|
if [ -n "$file" ]; then
|
||||||
|
file="$results_prefix/$file"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if the file contains any non-UTF-8 characters
|
# Check if the file contains any non-UTF-8 characters
|
||||||
if grep --color='auto' -P -q "[^\x00-\x7F]" "$file"; then
|
if grep --color='auto' -P -q "[^\x00-\x7F]" "$file"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user