+fuzbat.sh
This commit is contained in:
parent
2cceae456e
commit
9a757b3610
1 changed files with 33 additions and 0 deletions
33
bashrc.d/fuzbat.sh
Normal file
33
bashrc.d/fuzbat.sh
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
fuzbat() {
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# fuzbat
|
||||||
|
# Note-taking app alternative
|
||||||
|
# Originally written by Casey Brant <https://caseybrant.com/>
|
||||||
|
# Adapted by Armand Philippot <https://wp.armandphilippot.com>
|
||||||
|
# Adapted again by T0MuX to keep it simply working as a bash function
|
||||||
|
# - added FZPATH to chose the notes' path
|
||||||
|
|
||||||
|
FZPATH=$HOME/Sync/Notes
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
main() {
|
||||||
|
previous_file="$1"
|
||||||
|
file_to_edit=`select_file $previous_file`
|
||||||
|
|
||||||
|
if [ -n "$file_to_edit" ] ; then
|
||||||
|
"$EDITOR" "$file_to_edit"
|
||||||
|
main "$file_to_edit"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
select_file() {
|
||||||
|
given_file="$1"
|
||||||
|
fzf --tac --preview="bat --style=numbers --color=always {}" --preview-window=right:70%:wrap --query="$given_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
OLDPWD=$PWD
|
||||||
|
cd $FZPATH
|
||||||
|
main ""
|
||||||
|
cd $OLDPWD
|
||||||
|
}
|
Loading…
Reference in a new issue