Create e command for easy file editing

This commit is contained in:
Talia 2023-02-01 09:21:51 +01:00
parent b0f52854e0
commit 387a25fdf0
2 changed files with 24 additions and 0 deletions

23
bin/find-edit Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
if [ -f "$1" ]
then
$EDITOR $1
else
if which fzf > /dev/null
then
file=$(fzf -q "$1")
found=$?
elif which dmenu > /dev/null
then
file=$(find . -type f -name '*'"$1"'*' | sed -e 's/^\.\///' | dmenu -l 20)
found=$?
else
echo "Found neither fzf nor dmenu"
fi
fi
if [ "$found" -eq 0 ]
then
echo "$file" | xargs -d '\n' $EDITOR
fi

View file

@ -1,3 +1,4 @@
alias e="find-edit"
alias ls="ls --color=auto" alias ls="ls --color=auto"
alias ll="ls -lAh" alias ll="ls -lAh"
alias hello='echo "Hello :)"' alias hello='echo "Hello :)"'