Compare commits

...

7 Commits

5 changed files with 33 additions and 19 deletions

View File

@@ -78,6 +78,9 @@ item_types = ["VJOURNAL", "VTODO"]
You may also specify the location of the configuration file with the environment `CONFIGFILE`. You may also specify the location of the configuration file with the environment `CONFIGFILE`.
By default, `fzf-vjour` sets a descriptive terminal title.
This can be bypassed by specyfing `SET_TERMINAL_TITLE="no"` in the configuration file.
Usage Usage
----- -----
Use the default `fzf` keys to navigate your notes, e.g., `ctrl-j` and `ctrl-k` for going down/up in the list. Use the default `fzf` keys to navigate your notes, e.g., `ctrl-j` and `ctrl-k` for going down/up in the list.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -47,7 +47,9 @@ EOF
cat <<EOF | $FVJ --add-jour "Today's code" --collection 2 cat <<EOF | $FVJ --add-jour "Today's code" --collection 2
# Source code of current program # Source code of current program
\`\`\`sh
$(cat "$0") $(cat "$0")
\`\`\`
EOF EOF
$FVJ --add-task "Look for typos in readme" --collection 2 <"README.md" $FVJ --add-task "Look for typos in readme" --collection 2 <"README.md"
## End of data ## End of data

View File

@@ -2,20 +2,30 @@
set -eu set -eu
# Always load functions
# Helper functions # Helper functions
. "sh/helper.sh" . "sh/helper.sh"
# iCalendar routines
. "sh/icalendar.sh"
# Attachment handling
. "sh/attachment.sh"
# Categories handling
. "sh/categories.sh"
# Read theme # Load environment variables only when not yet loaded
. "sh/theme.sh" if [ ! "${SCRIPT_LOADED:-}" ]; then
# Read configuration
# Read configuration . "sh/config.sh"
. "sh/config.sh" # Read theme
. "sh/theme.sh"
# Load awk scripts # Load awk scripts
. "sh/awkscripts.sh" . "sh/awkscripts.sh"
# Mark as loaded
export SCRIPT_LOADED=1
fi
__lines() { __lines() {
find "$ROOT" -type f -name '*.ics' -print0 | xargs -0 -P 0 \ find "$ROOT" -mindepth 2 -maxdepth 2 -type f -name '*.ics' -print0 | xargs -0 -P 0 \
awk \ awk \
-v collection_labels="$COLLECTION_LABELS" \ -v collection_labels="$COLLECTION_LABELS" \
-v flag_open="$FLAG_OPEN" \ -v flag_open="$FLAG_OPEN" \
@@ -90,9 +100,6 @@ Examples:
exit exit
fi fi
# iCalendar routines
. "sh/icalendar.sh"
# Command line arguments: Interal use # Command line arguments: Interal use
. "sh/cliinternal.sh" . "sh/cliinternal.sh"
@@ -102,12 +109,6 @@ fi
# Parse command-line filter (if any) # Parse command-line filter (if any)
. "sh/filter.sh" . "sh/filter.sh"
# Attachment handling
. "sh/attachment.sh"
# Categories handling
. "sh/categories.sh"
if [ -n "${list_option:-}" ]; then if [ -n "${list_option:-}" ]; then
__lines | __lines |
$FZF \ $FZF \
@@ -118,6 +119,11 @@ if [ -n "${list_option:-}" ]; then
exit 0 exit 0
fi fi
# Set terminal title
if [ "$SET_TERMINAL_TITLE" = "yes" ]; then
printf '\033]0;%s\007' "$TERMINAL_TITLE"
fi
while true; do while true; do
query=$(stripws "$query") query=$(stripws "$query")
selection=$( selection=$(
@@ -161,7 +167,7 @@ while true; do
# Line 3: relative file path # Line 3: relative file path
lines=$(echo "$selection" | wc -l) lines=$(echo "$selection" | wc -l)
if [ "$lines" -eq 1 ]; then if [ "$lines" -eq 1 ]; then
return 0 exit 0
fi fi
query=$(echo "$selection" | head -n 1) query=$(echo "$selection" | head -n 1)
key=$(echo "$selection" | head -n 2 | tail -n 1) key=$(echo "$selection" | head -n 2 | tail -n 1)

View File

@@ -1,4 +1,5 @@
CONFIGFILE="${CONFIGFILE:-$HOME/.config/fzf-vjour/config}" CONFIGFILE="${CONFIGFILE:-$HOME/.config/fzf-vjour/config}"
export TERMINAL_TITLE="🗃️ fzf-vjour | Journal, notes, and tasks"
if [ ! -f "$CONFIGFILE" ]; then if [ ! -f "$CONFIGFILE" ]; then
err "Configuration '$CONFIGFILE' not found." err "Configuration '$CONFIGFILE' not found."
exit 1 exit 1
@@ -14,9 +15,11 @@ if [ ! -d "$ROOT" ]; then
exit 1 exit 1
fi fi
SYNC_CMD="${SYNC_CMD:-}" SYNC_CMD="${SYNC_CMD:-}"
SET_TERMINAL_TITLE="${SET_TERMINAL_TITLE:-yes}"
export ROOT export ROOT
export SYNC_CMD export SYNC_CMD
export COLLECTION_LABELS export COLLECTION_LABELS
export SET_TERMINAL_TITLE
for i in $(seq 9); do for i in $(seq 9); do
collection=$(printf "%s" "$COLLECTION_LABELS" | cut -d ';' -f "$i" | cut -d '=' -f 1) collection=$(printf "%s" "$COLLECTION_LABELS" | cut -d ';' -f "$i" | cut -d '=' -f 1)
label=$(printf "%s" "$COLLECTION_LABELS" | cut -d ';' -f "$i" | cut -d '=' -f 2) label=$(printf "%s" "$COLLECTION_LABELS" | cut -d ';' -f "$i" | cut -d '=' -f 2)