Skip to content

Instantly share code, notes, and snippets.

@Phate6660
Created May 11, 2020 19:13
Show Gist options
  • Save Phate6660/bbca71291f639369af6bf8ba56e1a9a6 to your computer and use it in GitHub Desktop.
Save Phate6660/bbca71291f639369af6bf8ba56e1a9a6 to your computer and use it in GitHub Desktop.
Choose a script to edit via rofi, and edit with $EDITOR.
#!/bin/bash
## The idea is to create a dmenu prompt with fancy names (i.e nameOfDirectory/nameOfScriptWithoutExtension) and open them in emacs.
## TODO: Open submenu if more than one of the same file is found.
script_dir="$HOME/scripts" # Set to whatever dir you store your scripts in. I personally prefer $HOME/scripts.
editor="$EDITOR" # Set to whatever editor you prefer, if you don't already have $EDITOR set.
# Print names of scripts without extensions into rofi's dmenu mode, and save the selection to the choice variable.
choice="$(ls -1 "$script_dir" | sed 's/\.[^.]*$//' | rofi -dmenu -p "Select script to edit")"
"$editor" "$script_dir"/"$choice"* # Edit the chosen script with $editor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment