Add a note preview to fzf

This commit is contained in:
Konstantin Nazarov 2024-11-17 04:08:06 +00:00
parent 87cfe2c622
commit 230a1b717a
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22
2 changed files with 10 additions and 1 deletions

View file

@ -32,7 +32,7 @@ Then add the following aliases to your `~/.bashrc`:
alias nn="notes.sh -n"
# Type "ne" to look up and edit an existing note
alias ne="notes.sh -l | fzf --tac --with-nth=\"2..-1\" | xargs -o notes.sh -e"
alias ne="notes.sh -l | fzf --tac --with-nth=\"2..-1\" --preview \"notes.sh -p {}\" | xargs -o notes.sh -e"
```
To add a new note:

View file

@ -195,6 +195,15 @@ while (( "$#" )); do
export_note "$2" "$3"
exit 0
;;
-p|--preview)
if [ -z "$2" ]; then
echo "Misssing arguments for $1"
exit 1
fi
NOTE_ID="$(echo $2 | cut -d " " -f 1)"
export_note "$NOTE_ID" ""
exit 0
;;
-g|--graph)
get_graph
exit 0