Some cleaning up

This commit is contained in:
Nox Sluijtman 2023-10-20 14:51:17 +02:00
parent 3f3cd0c357
commit 3fba3e9f3e
2 changed files with 12 additions and 10 deletions

View file

@ -1,11 +1,12 @@
#! /bin/sh
usage(){ printf "Opens a script in vim either as an argument or from the ~/.local/bin directory using skim\n"; }
if [ $# -eq 1 ] ; then
case $1 in
--help) echo "Opens a script in vim either as an argument or from the ~/.local/bin directory using skim";;
-h) echo "Opens a script in vim either as an argument or from the ~/.local/bin directory using skim";;
--help) usage ;;
-h) usage ;;
*) $EDITOR $(which $1);;
esac
else
script=$(find ~/.local/bin -type f | sk --preview 'cat {}')
[ "$script" != "" ] && nvim $script || exit 0
[ ! -z "$script" ] && $EDITOR $script || exit 0
fi