Compare commits
7 Commits
c916f46c64
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f15d53c32 | |||
| ded6a686fd | |||
| 7545a4229c | |||
| 93cb0852ea | |||
| 75acdc87f3 | |||
| 56030912d7 | |||
| b2c8d94854 |
@@ -78,6 +78,9 @@ item_types = ["VJOURNAL", "VTODO"]
|
||||
|
||||
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
|
||||
-----
|
||||
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 |
@@ -47,7 +47,9 @@ EOF
|
||||
cat <<EOF | $FVJ --add-jour "Today's code" --collection 2
|
||||
# Source code of current program
|
||||
|
||||
\`\`\`sh
|
||||
$(cat "$0")
|
||||
\`\`\`
|
||||
EOF
|
||||
$FVJ --add-task "Look for typos in readme" --collection 2 <"README.md"
|
||||
## End of data
|
||||
|
||||
36
src/main.sh
36
src/main.sh
@@ -2,20 +2,30 @@
|
||||
|
||||
set -eu
|
||||
|
||||
# Always load functions
|
||||
# Helper functions
|
||||
. "sh/helper.sh"
|
||||
# iCalendar routines
|
||||
. "sh/icalendar.sh"
|
||||
# Attachment handling
|
||||
. "sh/attachment.sh"
|
||||
# Categories handling
|
||||
. "sh/categories.sh"
|
||||
|
||||
# Read theme
|
||||
. "sh/theme.sh"
|
||||
|
||||
# Load environment variables only when not yet loaded
|
||||
if [ ! "${SCRIPT_LOADED:-}" ]; then
|
||||
# Read configuration
|
||||
. "sh/config.sh"
|
||||
|
||||
# Read theme
|
||||
. "sh/theme.sh"
|
||||
# Load awk scripts
|
||||
. "sh/awkscripts.sh"
|
||||
# Mark as loaded
|
||||
export SCRIPT_LOADED=1
|
||||
fi
|
||||
|
||||
__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 \
|
||||
-v collection_labels="$COLLECTION_LABELS" \
|
||||
-v flag_open="$FLAG_OPEN" \
|
||||
@@ -90,9 +100,6 @@ Examples:
|
||||
exit
|
||||
fi
|
||||
|
||||
# iCalendar routines
|
||||
. "sh/icalendar.sh"
|
||||
|
||||
# Command line arguments: Interal use
|
||||
. "sh/cliinternal.sh"
|
||||
|
||||
@@ -102,12 +109,6 @@ fi
|
||||
# Parse command-line filter (if any)
|
||||
. "sh/filter.sh"
|
||||
|
||||
# Attachment handling
|
||||
. "sh/attachment.sh"
|
||||
|
||||
# Categories handling
|
||||
. "sh/categories.sh"
|
||||
|
||||
if [ -n "${list_option:-}" ]; then
|
||||
__lines |
|
||||
$FZF \
|
||||
@@ -118,6 +119,11 @@ if [ -n "${list_option:-}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set terminal title
|
||||
if [ "$SET_TERMINAL_TITLE" = "yes" ]; then
|
||||
printf '\033]0;%s\007' "$TERMINAL_TITLE"
|
||||
fi
|
||||
|
||||
while true; do
|
||||
query=$(stripws "$query")
|
||||
selection=$(
|
||||
@@ -161,7 +167,7 @@ while true; do
|
||||
# Line 3: relative file path
|
||||
lines=$(echo "$selection" | wc -l)
|
||||
if [ "$lines" -eq 1 ]; then
|
||||
return 0
|
||||
exit 0
|
||||
fi
|
||||
query=$(echo "$selection" | head -n 1)
|
||||
key=$(echo "$selection" | head -n 2 | tail -n 1)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
CONFIGFILE="${CONFIGFILE:-$HOME/.config/fzf-vjour/config}"
|
||||
export TERMINAL_TITLE="🗃️ fzf-vjour | Journal, notes, and tasks"
|
||||
if [ ! -f "$CONFIGFILE" ]; then
|
||||
err "Configuration '$CONFIGFILE' not found."
|
||||
exit 1
|
||||
@@ -14,9 +15,11 @@ if [ ! -d "$ROOT" ]; then
|
||||
exit 1
|
||||
fi
|
||||
SYNC_CMD="${SYNC_CMD:-}"
|
||||
SET_TERMINAL_TITLE="${SET_TERMINAL_TITLE:-yes}"
|
||||
export ROOT
|
||||
export SYNC_CMD
|
||||
export COLLECTION_LABELS
|
||||
export SET_TERMINAL_TITLE
|
||||
for i in $(seq 9); do
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user