Compare commits
3 Commits
9e59e7a923
...
87a41be6de
Author | SHA1 | Date | |
---|---|---|---|
87a41be6de | |||
e91035c43a | |||
66ca05f744 |
46
src/main.sh
46
src/main.sh
@ -405,6 +405,9 @@ if [ "${1:-}" = "--day" ]; then
|
|||||||
--accept-nth='1,2,3,4' \
|
--accept-nth='1,2,3,4' \
|
||||||
--preview="$0 --preview {}" \
|
--preview="$0 --preview {}" \
|
||||||
--expect="ctrl-n,esc,backspace,q" \
|
--expect="ctrl-n,esc,backspace,q" \
|
||||||
|
--bind='start:hide-preview' \
|
||||||
|
--bind='ctrl-j:down+hide-preview+transform:echo {} | grep \|\| || echo show-preview' \
|
||||||
|
--bind='ctrl-k:up+hide-preview+transform:echo {} | grep \|\| || echo show-preview' \
|
||||||
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
|
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
|
||||||
--bind="ctrl-alt-d:become($0 --delete {})"
|
--bind="ctrl-alt-d:become($0 --delete {})"
|
||||||
)
|
)
|
||||||
@ -567,17 +570,34 @@ fi
|
|||||||
|
|
||||||
DISPLAY_DATE=${DISPLAY_DATE:-today}
|
DISPLAY_DATE=${DISPLAY_DATE:-today}
|
||||||
DISPLAY_DATE=$(date -d "$DISPLAY_DATE" +"%D")
|
DISPLAY_DATE=$(date -d "$DISPLAY_DATE" +"%D")
|
||||||
|
DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
|
||||||
|
|
||||||
if [ "${1:-}" = "--list" ]; then
|
if [ "${1:-}" = "--list" ]; then
|
||||||
|
if [ -n "$3" ]; then
|
||||||
|
DISPLAY_DATE="$2 $3"
|
||||||
|
else
|
||||||
|
DISPLAY_DATE="today"
|
||||||
|
fi
|
||||||
|
echo "$DISPLAY_DATE" >>/tmp/xyz
|
||||||
|
DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
|
||||||
|
__list
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${1:-}" = "--list-prev-day" ]; then
|
||||||
|
DISPLAY_DATE="$2 -1 days"
|
||||||
|
DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
|
||||||
|
__list
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${1:-}" = "--list-next-day" ]; then
|
||||||
|
DISPLAY_DATE="$2 +7 days"
|
||||||
|
DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
|
||||||
__list
|
__list
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DISPLAY_POS=$((8 - $(date -d "$DISPLAY_DATE" +"%u")))
|
|
||||||
DISPLAY_DATE_PREV=$(date -d "$DISPLAY_DATE -1 week" +"%D")
|
|
||||||
DISPLAY_DATE_NEXT=$(date -d "$DISPLAY_DATE +1 week" +"%D")
|
|
||||||
DISPLAY_DATE_PREV_MONTH=$(date -d "$DISPLAY_DATE -1 month" +"%D")
|
|
||||||
DISPLAY_DATE_NEXT_MONTH=$(date -d "$DISPLAY_DATE +1 month" +"%D")
|
|
||||||
selection=$(
|
selection=$(
|
||||||
__list |
|
__list |
|
||||||
$FZF \
|
$FZF \
|
||||||
@ -596,16 +616,22 @@ selection=$(
|
|||||||
--preview-window=up,7,border-bottom \
|
--preview-window=up,7,border-bottom \
|
||||||
--preview="$0 --preview-week {}" \
|
--preview="$0 --preview-week {}" \
|
||||||
--expect="ctrl-n" \
|
--expect="ctrl-n" \
|
||||||
|
--bind="ctrl-j:transform:[ \$FZF_POS -le 1 ] &&
|
||||||
|
echo unbind\(load\)+reload:$0 --list-next-day {2} ||
|
||||||
|
echo down" \
|
||||||
|
--bind="ctrl-k:transform:[ \$FZF_POS -ge 7 ] &&
|
||||||
|
echo unbind\(load\)+reload:$0 --list-prev-day {2} ||
|
||||||
|
echo up" \
|
||||||
--bind="change:reload($0 --all)+hide-preview" \
|
--bind="change:reload($0 --all)+hide-preview" \
|
||||||
--bind="backward-eof:reload($0 --list)+show-preview" \
|
--bind="backward-eof:reload($0 --list)+show-preview" \
|
||||||
--bind="load:pos($DISPLAY_POS)" \
|
--bind="load:pos($DISPLAY_POS)" \
|
||||||
--bind="ctrl-u:become($0 --date '$DISPLAY_DATE_PREV')" \
|
--bind="ctrl-u:reload:$0 --list {2} '-1 week'" \
|
||||||
--bind="ctrl-d:become($0 --date '$DISPLAY_DATE_NEXT')" \
|
--bind="ctrl-d:reload:$0 --list {2} '+1 week'" \
|
||||||
--bind="ctrl-alt-u:become($0 --date '$DISPLAY_DATE_PREV_MONTH')" \
|
--bind="ctrl-alt-u:reload:$0 --list {2} '-1 month'" \
|
||||||
--bind="ctrl-alt-d:become($0 --date '$DISPLAY_DATE_NEXT_MONTH')" \
|
--bind="ctrl-alt-d:reload:$0 --list {2} '+1 month'" \
|
||||||
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
|
--bind="ctrl-s:execute($SYNC_CMD ; printf 'Press <enter> to continue.'; read -r tmp)" \
|
||||||
--bind="ctrl-g:become($0 --goto)" \
|
--bind="ctrl-g:become($0 --goto)" \
|
||||||
--bind="ctrl-l:become($0)"
|
--bind="ctrl-l:rebind(load)+reload:$0 --list"
|
||||||
)
|
)
|
||||||
|
|
||||||
key=$(echo "$selection" | head -1)
|
key=$(echo "$selection" | head -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user