This is a collection of dotfiles and scripts for my bspwm setup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
651 B

#!/bin/sh
# Script that searches config files and scripts
# Define editor to open file in
EDITOR="$EDITOR"
# List of locations to search
LOCATIONS="$HOME/.config $HOME/.scripts"
# Find the files
FILES="$(find -L $LOCATIONS -maxdepth 3 -type f | sort)"
HOME="$(find -L $HOME -maxdepth 1 -type f | sort)"
# If no name provided
if [ -z "$1" ]; then
SELECTED="$(printf "%s\n%s" "$FILES" "$HOME" \
| uniq | rofi -dmenu -p "Select file to edit")"
# Else try to search for that file
else
SELECTED="$(printf "%s\n%s" "$FILES" "$HOME" | grep "$1" | head -n 1)"
fi
# Start editor with selected file (if any)
[ -n "$SELECTED" ] && $EDITOR "$SELECTED"