Skip to content

Commit 7af6cbd

Browse files
authored
feature: enhance calendar widget with time picker (#650)
* feat: implement time picker To make it more convenient to scheduled dates with particular times extends the existing date picker with a time picker. - t adds a time and jumps to the time picker - j and k decrease or increase the time, counts are supported - h and l determine if the time is shifted about an hour, 10 minutes or 5 minutes - T clears the time - Esc leaves the time picker first and pressed secondly the date picker * feat(date): add default to 'Enter date' When entering the date via direct input, provide the currently selected date as default value. * chore: fix warnings in calendar * fix: jump to descrete 10 or 5 minute steps When adjusting an odd minute value, we first want to jump to the next flat 10 or 5 minute value. * feat: make minute steps configurable Because it's a matter of preference, in which steps the user want's to jump through minutes, we make it configurable. * feat: highlight currently selected date * refactor: extract date highlighting into function * feat: update date selection regularly * feat: round minutes on adjusting hours * fix: show time picker also when changing date * fix: enable clear time keymap consistently To be able to clear times if no timestamp was set when the picker was loaded, we need to set the clear-time keymapping during rerendering of time. * refactor: integrate highlights into new function * fix: allow to switch back to day selection * feat: overhaul config options - wrap everything into calendar - cleanup names - use boolean "start_from_sunday" * doc: add some docs for the config options * doc: fix typo --------- Co-authored-by: Sebastian Flügge <[email protected]>
1 parent 46c839b commit 7af6cbd

File tree

4 files changed

+295
-24
lines changed

4 files changed

+295
-24
lines changed

DOCS.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
2. [Settings](#settings)
55
1. [Global settings](#global-settings)
66
2. [Agenda settings](#agenda-settings)
7-
3. [Tags settings](#tags-settings)
7+
3. [Calendar settings](#calendar-settings)
8+
4. [Tags settings](#tags-settings)
89
3. [Mappings](#mappings)
910
1. [Global mappings](#global-mappings)
1011
2. [Agenda mappings](#agenda-mappings)
@@ -677,6 +678,28 @@ Additional files to search from agenda search prompt.<br />
677678
Currently it accepts only a single value: `agenda-archives`.<br />
678679
Example value: `{'agenda-archives'}`
679680

681+
### Calendar settings
682+
683+
Adjust behavior of the calendar modal (ex: [changing the date under cursor](#org_change_date)).
684+
685+
#### **calendar.round_min_with_hours**
686+
687+
_type_: `boolean`<br />
688+
_default_: `true`<br />
689+
Should minutes be rounded, when the hour is changed. It behaves more fluently when changing the hours, especially when scheduling from the current time (which can be something odd). If set to false, the minutes are unchanged while changing the hours.
690+
691+
#### **calendar.min_big_step**
692+
693+
_type_: `number`<br />
694+
_default_: `15`<br />
695+
The step size for changing the minutes while the cursor is on the first digit.
696+
697+
#### **calendar.min_small_step**
698+
699+
_type_: `number`<br />
700+
_default_: same as [](#org_time_stamp_rounding_minutes)<br />
701+
The step size for changing the minutes while the cursor is on the second digit.
702+
680703
### Tags settings
681704

682705
#### **org_tags_column**
@@ -1712,7 +1735,7 @@ This option is most optimized because it doesn't load plugins and your init.vim
17121735
For **MacOS**, things should be very similar, but I wasn't able to test it. Any help on this is appreciated.
17131736

17141737
## Clocking
1715-
There is partial suport for [Clocking work time](https://orgmode.org/manual/Clocking-Work-Time.html).<br />
1738+
There is partial support for [Clocking work time](https://orgmode.org/manual/Clocking-Work-Time.html).<br />
17161739
Supported actions:
17171740
##### Clock in
17181741
Org file mapping: `<leader>oxi`<br />

lua/orgmode/config/defaults.lua

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---@class OrgDefaultConfig
22
---@field org_id_method 'uuid' | 'ts' | 'org'
33
---@field org_agenda_span 'day' | 'week' | 'month' | 'year' | number
4+
---@field calendar { round_min_with_hours: boolean, min_big_step: number, min_small_step: number? }
45
local DefaultConfig = {
56
org_agenda_files = '',
67
org_default_notes_file = '',
@@ -13,6 +14,10 @@ local DefaultConfig = {
1314
org_agenda_start_on_weekday = 1,
1415
org_agenda_start_day = nil, -- start from today + this modifier
1516
calendar_week_start_day = 1,
17+
calendar = {
18+
round_min_with_hours = true,
19+
min_big_step = 15,
20+
},
1621
org_capture_templates = {
1722
t = {
1823
description = 'Task',

0 commit comments

Comments
 (0)