From 4d254077ba3092e3564dbb4770128b6734709197 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sat, 16 Nov 2024 17:35:02 -0500 Subject: [PATCH 1/2] disabled sddm for now because hyprland is having issues with it also changed viconf to allow for no arguments, which opens a fzf window with every config file in it --- hosts/desktop/config.nix | 2 +- overlay/scripts/commands/viconf.nix | 10 +++++++--- overlay/scripts/nix/rebuild.nix | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hosts/desktop/config.nix b/hosts/desktop/config.nix index 47ae677..f5b6cbf 100755 --- a/hosts/desktop/config.nix +++ b/hosts/desktop/config.nix @@ -5,7 +5,7 @@ movOpts = { sysEnv = { issue.enable = true; - sddmConfig.enable = true; + sddmConfig.enable = false; stylixConfig.enable = true; nixSettings.enable = true; }; diff --git a/overlay/scripts/commands/viconf.nix b/overlay/scripts/commands/viconf.nix index c309e8e..d7a3dd5 100755 --- a/overlay/scripts/commands/viconf.nix +++ b/overlay/scripts/commands/viconf.nix @@ -5,10 +5,14 @@ pkgs.writeShellApplication { text = '' #!/usr/bin/env bash - [ ! $# -eq 1 ] && echo "Usage: viconf <*.nix>" && exit 1 + if [ ! $# -eq 1 ]; then + results=$(find "$FLAKEPATH" -exec find {} \; | sort | uniq | rg '\.nix$') + numresults=$(echo "$results" | wc -l) + else + results=$(find "$FLAKEPATH" -wholename "*$1*" -exec find {} \; | sort | uniq | rg '\.nix$') + numresults=$(echo "$results" | wc -l) + fi - results=$(find "$FLAKEPATH" -wholename "*$1*" -exec find {} \; | sort | uniq | rg '\.nix$') - numresults=$(echo "$results" | wc -l) [ "$numresults" -eq 0 ] && echo "$1 not found in \$FLAKEPATH" && exit 1 diff --git a/overlay/scripts/nix/rebuild.nix b/overlay/scripts/nix/rebuild.nix index dcf2104..5e77546 100755 --- a/overlay/scripts/nix/rebuild.nix +++ b/overlay/scripts/nix/rebuild.nix @@ -10,10 +10,10 @@ pkgs.writeShellApplication { str="''${str::-1}" if [ "$char" = "-" ]; then return 0; fi case "$char" in - "a") if checkbools; then echo "$usage" && exit 1; else all=true; fi ;; - "s") if checkbools; then system=true; else echo "$usage" && exit 1; fi ;; - "h") if checkbools; then home=true; else echo "$usage" && exit 1; fi ;; - "n") if [ "$dry" = false ]; then dry=true; else echo "$usage" && exit 1; fi ;; + "a") if checkbools; then all=true; else echo -e "$usage" && exit 1; fi ;; + "s") if checkbools; then system=true; else echo -e "$usage" && exit 1; fi ;; + "h") if checkbools; then home=true; else echo -e "$usage" && exit 1; fi ;; + "n") if [ "$dry" = false ]; then dry=true; else echo -e "$usage" && exit 1; fi ;; *) echo -e "$usage" && exit 1 ;; esac checkflags "$str" From 11824164b80e77ed9e85b6ce14454d563c8d2623 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sat, 16 Nov 2024 17:56:49 -0500 Subject: [PATCH 2/2] fixed unbound variable issue with viconf. TODO: make this script not awful --- modules/home/programs/nixvim/keymaps.nix | 5 +++++ overlay/scripts/commands/viconf.nix | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/home/programs/nixvim/keymaps.nix b/modules/home/programs/nixvim/keymaps.nix index d3be2e9..19ce534 100755 --- a/modules/home/programs/nixvim/keymaps.nix +++ b/modules/home/programs/nixvim/keymaps.nix @@ -1,6 +1,11 @@ { programs.nixvim = { keymaps = [ + { + action = "ggG"; # select entire document + key = ""; + mode = "n"; + } { action = "ChatGPTEditWithInstructions"; key = "!egpt"; diff --git a/overlay/scripts/commands/viconf.nix b/overlay/scripts/commands/viconf.nix index d7a3dd5..c944dcc 100755 --- a/overlay/scripts/commands/viconf.nix +++ b/overlay/scripts/commands/viconf.nix @@ -3,9 +3,8 @@ pkgs.writeShellApplication { name = "viconf"; runtimeInputs = with pkgs; [ coreutils fd ripgrep fzf ]; text = '' - #!/usr/bin/env bash - - if [ ! $# -eq 1 ]; then + set -- "''${1:-}" + if [ ! $# -lt 1 ]; then results=$(find "$FLAKEPATH" -exec find {} \; | sort | uniq | rg '\.nix$') numresults=$(echo "$results" | wc -l) else @@ -20,10 +19,16 @@ pkgs.writeShellApplication { # cut up the paths to give shorter path names to fuzzy finder results_prefix=$(echo "$results" | tail -n 1 | cut -d'/' -f-3) 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="$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 if grep --color='auto' -P -q "[^\x00-\x7F]" "$file"; then