Skip to content

Commit c669b6f

Browse files
committed
feature: support org_toggle_timestamp_type
Allows to make active timestamp inactive and vice versa with one keybinding.
1 parent 803e30d commit c669b6f

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
@@ -144,6 +144,7 @@ local DefaultConfig = {
144144
org_schedule = '<prefix>is',
145145
org_time_stamp = '<prefix>i.',
146146
org_time_stamp_inactive = '<prefix>i!',
147+
org_toggle_timestamp_type = '<prefix>!',
147148
org_insert_link = '<prefix>il',
148149
org_clock_in = '<prefix>xi',
149150
org_clock_out = '<prefix>xo',

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_clock_in = m.action('clock.org_clock_in', { opts = { desc = 'org clock in' } }),
136140
org_clock_out = m.action('clock.org_clock_out', { opts = { desc = 'org clock out' } }),

lua/orgmode/org/mappings.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,16 @@ function OrgMappings:org_time_stamp(inactive)
972972
end)
973973
end
974974

975+
function OrgMappings:org_toggle_timestamp_type()
976+
local date = self:_get_date_under_cursor()
977+
if not date then
978+
return
979+
end
980+
981+
date.active = not date.active
982+
self:_replace_date(date)
983+
end
984+
975985
---@param direction string
976986
---@param use_fast_access? boolean
977987
---@return string

0 commit comments

Comments
 (0)