Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support org_toggle_timestamp_type #651

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@ Decrease date under cursor by 1 or "count" day(s) (Example count: `5<S-UP>`).
#### **org_change_date**
*mapped to*: `cid`<br />
Change date under cursor. Opens calendar to select new date
#### **org_toggle_timestamp_type**
*mapped to*: `<Leader>od!`<br />
Switches the timestamp under the cursor between inactive and active.
#### **org_priority**
*mapped to*: `<Leader>o,`<br />
Choose the priority of a headline item.
Expand Down
1 change: 1 addition & 0 deletions lua/orgmode/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ local DefaultConfig = {
org_schedule = '<prefix>is',
org_time_stamp = '<prefix>i.',
org_time_stamp_inactive = '<prefix>i!',
org_toggle_timestamp_type = '<prefix>d!',
org_insert_link = '<prefix>li',
org_store_link = '<prefix>ls',
org_clock_in = '<prefix>xi',
Expand Down
4 changes: 4 additions & 0 deletions lua/orgmode/config/mappings/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions lua/orgmode/org/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading