Browse Source

add vimv to installation process

bananicorn 2 years ago
parent
commit
78745d249a
2 changed files with 49 additions and 0 deletions
  1. 44 0
      devuan_setup/scripts/vimv
  2. 5 0
      devuan_setup/setup_system.sh

+ 44 - 0
devuan_setup/scripts/vimv

@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+set -eu
+
+# Lists the current directory's files in Vim, so you can edit it and save to rename them
+# USAGE: vimv [file1 file2]
+# https://github.com/thameera/vimv
+
+declare -r FILENAMES_FILE=$(mktemp "${TMPDIR:-/tmp}/vimv.XXX")
+
+trap '{ rm -f "${FILENAMES_FILE}" ; }' EXIT
+
+if [ $# -ne 0 ]; then
+    src=( "$@" )
+else
+    IFS=$'\r\n' GLOBIGNORE='*' command eval 'src=($(ls))'
+fi
+
+for ((i=0;i<${#src[@]};++i)); do
+    echo "${src[i]}" >> "${FILENAMES_FILE}"
+done
+
+${EDITOR:-vi} "${FILENAMES_FILE}"
+
+IFS=$'\r\n' GLOBIGNORE='*' command eval 'dest=($(cat "${FILENAMES_FILE}"))'
+
+if (( ${#src[@]} != ${#dest[@]} )); then
+    echo "WARN: Number of files changed. Did you delete a line by accident? Aborting.." >&2
+    exit 1
+fi
+
+declare -i count=0
+for ((i=0;i<${#src[@]};++i)); do
+    if [ "${src[i]}" != "${dest[i]}" ]; then
+        mkdir -p "$(dirname "${dest[i]}")"
+        if git ls-files --error-unmatch "${src[i]}" > /dev/null 2>&1; then
+            git mv "${src[i]}" "${dest[i]}"
+        else
+            mv "${src[i]}" "${dest[i]}"
+        fi
+        ((++count))
+    fi
+done
+
+echo "$count" files renamed.

+ 5 - 0
devuan_setup/setup_system.sh

@@ -4,6 +4,7 @@
 apt install -y vim
 ~/dotfiles/setup-vim.sh
 apt install -y git
+cp ./scripts/vimv /usr/bin
 
 #window manager
 apt install -y sway
@@ -21,6 +22,9 @@ ln -s ~/dotfiles/devuan_setup/config/foot ~/.config/foot
 #dialog boxes
 apt install -y zenity
 
+#gtk themes and whatnot
+ln -s ~/dotfiles/devuan_setup/themes/ ~/.themes
+
 #image viewer
 apt install -y imv
 
@@ -78,3 +82,4 @@ DOCKER_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compo
 DOCKER_COMPOSE_PATH=/usr/local/bin/docker-compose
 curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 -o $DOCKER_COMPOSE_PATH
 chmod 755 $DOCKER_COMPOSE_PATH
+#flatpak install flathub org.freedesktop.Platform/x86_64/19.08