dotfiles

My dotfiles for Arch Linux
git clone git@git.janispagel.de:dotfiles.git
Log | Files | Refs | README

commit 1364c47cd59e59ae89115a8bdb033186fdaa6eae
parent 4587c6473046a4c62c2f6ac9fbbdbf5a2b1d8425
Author: Janis Pagel <janis.pagel@ims.uni-stuttgart.de>
Date:   Sat, 12 Sep 2020 13:09:12 +0200

Add scripts

Diffstat:
Ascripts/.local/scripts/cursor_pos.sh | 7+++++++
Ascripts/.local/scripts/lowercase.sh | 17+++++++++++++++++
Ascripts/.local/scripts/tmux_display_pane_pwd.sh | 7+++++++
3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/scripts/.local/scripts/cursor_pos.sh b/scripts/.local/scripts/cursor_pos.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo -ne "\033[6n" # ask the terminal for the position +read -s -d\[ garbage # discard the first part of the response +read -s -d R pos # store the position in bash variable 'pos' +echo "Cursor position: $pos" # print the position +unset pos # free variable 'pos' diff --git a/scripts/.local/scripts/lowercase.sh b/scripts/.local/scripts/lowercase.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +find . -depth -mindepth 1 -exec bash -c ' + for file do + # adapt the awk command if you wish to rename to something other than lowercase + newname=$(dirname "$file")/$(basename "$file" | awk "{print tolower(\$0)}") + if [ "$file" != "$newname" ] ; then + # the extra step with the temp filename is for case-insensitive filesystems + if [ ! -e "$newname" ] && [ ! -e "$newname.lcrnm.tmp" ] ; then + mv -T "$file" "$newname.lcrnm.tmp" && mv -T "$newname.lcrnm.tmp" "$newname" + else + echo "ERROR: Name already exists: $newname" + fi + fi + done +' sh {} + diff --git a/scripts/.local/scripts/tmux_display_pane_pwd.sh b/scripts/.local/scripts/tmux_display_pane_pwd.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# script for showing current directory in tmux + +#tmux showenv -g TMUX_PWD_$(tmux display -p "#D" | tr -d %) | sed 's/^.*=//' +# pretty shitty to get the last element of the sed output by double reversing, but it works +tmux showenv -g TMUX_PWD_$(tmux display -p "#D" | tr -d %) | sed 's/^.*=//' | rev | cut -d'/' -f 1 | rev | awk '{print $1"/"}'