minor fix
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 3b1d5ba270298d0329926c20719c38b5141f7c76..d46028dfddb744c985d3b90658ea963047787180 100644 (file)
--- a/brc2
+++ b/brc2
@@ -2882,8 +2882,8 @@ EOF
   tmpf=$(mktemp)
   {
     printf "%s" "Host * "
-    sed -n '/^Host /h;/^IdentityFile .*\/home/{g;s/^Host//;s/ / !/gp}' /p/c/subdir_files/.ssh/config-static | tr '\n' ' '
-    echo
+    sed -n '/^Host /h;/^IdentityFile .*\/home/{g;s/^Host//;s/ / !/gp}' /p/c/subdir_files/.ssh/config-static | tr '\n' ' ' \
+      | sed -r 's/ *$/\n/'
     echo "IdentityFile ~/.ssh/work"
   } >$tmpf
   cedit -e work-identity /p/c/subdir_files/.ssh/config-static <$tmpf
@@ -4871,6 +4871,37 @@ i3gen() {
 }
 
 
+# insensitive find plus edit
+ife() {
+  local tmps found_count i char file
+  local -a found_files
+  local -A button_file
+  tmps=$(ifn "$@")
+  mapfile -t found_files <<<"$tmps"
+  found_count=${#found_files[@]}
+  if (( ${#found_files[@]} == 1 )); then
+    m g ${found_files[0]}
+  else
+    i=0
+    for button in {a..z}; do
+      button_file[$button]="${found_files[$i]}"
+      echo $button: ${found_files[$i]}
+      i=$(( i + 1 ))
+      if (( i >= found_count )); then
+        break
+      fi
+    done
+    read -rsN1 -t 5 char ||:
+    file="${button_file[$char]}"
+
+    if [[ $file ]]; then
+      g "$file"
+    else
+      echo "no selection"
+    fi
+  fi
+}
+
 
 export BASEFILE_DIR=/a/bin/fai-basefiles