Skip to content

Commit ea1838e

Browse files
committed
feature: support org_toggle_timestamp_type
Allows to make active timestamp inactive and vice versa with one keybinding.
1 parent 5a238a2 commit ea1838e

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

lua/orgmode/config/defaults.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ local DefaultConfig = {
155155
org_schedule = '<prefix>is',
156156
org_time_stamp = '<prefix>i.',
157157
org_time_stamp_inactive = '<prefix>i!',
158+
org_toggle_timestamp_type = '<prefix>d!',
158159
org_insert_link = '<prefix>li',
159160
org_store_link = '<prefix>ls',
160161
org_clock_in = '<prefix>xi',

lua/orgmode/config/mappings/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ return {
131131
'org_mappings.org_time_stamp',
132132
{ args = { true }, opts = { desc = 'org timestamp (inactive)' } }
133133
),
134+
org_toggle_timestamp_type = m.action(
135+
'org_mappings.org_toggle_timestamp_type',
136+
{ opts = { desc = 'org toggle timestamp type' } }
137+
),
134138
org_insert_link = m.action('org_mappings.insert_link', { opts = { desc = 'org insert link' } }),
135139
org_store_link = m.action('org_mappings.store_link', { opts = { desc = 'org store link' } }),
136140
org_clock_in = m.action('clock.org_clock_in', { opts = { desc = 'org clock in' } }),

lua/orgmode/org/mappings.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,16 @@ function OrgMappings:org_time_stamp(inactive)
10561056
end)
10571057
end
10581058

1059+
function OrgMappings:org_toggle_timestamp_type()
1060+
local date = self:_get_date_under_cursor()
1061+
if not date then
1062+
return
1063+
end
1064+
1065+
date.active = not date.active
1066+
self:_replace_date(date)
1067+
end
1068+
10591069
---@param direction string
10601070
---@param use_fast_access? boolean
10611071
---@return boolean

0 commit comments

Comments
 (0)