diff --git a/DOCS.md b/DOCS.md index ac3540cc6..8dacfa31a 100644 --- a/DOCS.md +++ b/DOCS.md @@ -1023,6 +1023,9 @@ Decrease date under cursor by 1 or "count" day(s) (Example count: `5`). #### **org_change_date** *mapped to*: `cid`
Change date under cursor. Opens calendar to select new date +#### **org_toggle_timestamp_type** +*mapped to*: `od!`
+Switches the timestamp under the cursor between inactive and active. #### **org_priority** *mapped to*: `o,`
Choose the priority of a headline item. diff --git a/lua/orgmode/config/defaults.lua b/lua/orgmode/config/defaults.lua index c7bcaa6b3..6577a86ba 100644 --- a/lua/orgmode/config/defaults.lua +++ b/lua/orgmode/config/defaults.lua @@ -161,6 +161,7 @@ local DefaultConfig = { org_schedule = 'is', org_time_stamp = 'i.', org_time_stamp_inactive = 'i!', + org_toggle_timestamp_type = 'd!', org_insert_link = 'li', org_store_link = 'ls', org_clock_in = 'xi', diff --git a/lua/orgmode/config/mappings/init.lua b/lua/orgmode/config/mappings/init.lua index 675971065..0c10a3840 100644 --- a/lua/orgmode/config/mappings/init.lua +++ b/lua/orgmode/config/mappings/init.lua @@ -351,6 +351,10 @@ return { 'org_mappings.org_babel_tangle', { opts = { desc = 'org tangle', help_desc = 'Tangle current file' } } ), + org_toggle_timestamp_type = m.action( + 'org_mappings.org_toggle_timestamp_type', + { opts = { desc = 'org toggle timestamp type', help_desc = 'Toggle timestamp active/inactive type' } } + ), }, edit_src = { org_edit_src_abort = m.custom( diff --git a/lua/orgmode/org/mappings.lua b/lua/orgmode/org/mappings.lua index a180f7803..52b0dc7cc 100644 --- a/lua/orgmode/org/mappings.lua +++ b/lua/orgmode/org/mappings.lua @@ -1009,6 +1009,16 @@ function OrgMappings:org_time_stamp(inactive) end) end +function OrgMappings:org_toggle_timestamp_type() + local date = self:_get_date_under_cursor() + if not date then + return + end + + date.active = not date.active + self:_replace_date(date) +end + ---@param direction string ---@param use_fast_access? boolean ---@return boolean