Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
seflue committed Jun 30, 2024
1 parent de3b7a8 commit dab4457
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/orgmode/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ local DefaultConfig = {
org_note_show_help = 'g?',
},
org = {
org_agenda_file_to_front = '<prefix>[',
org_remove_file = '<prefix>]',
org_refile = '<prefix>r',
org_timestamp_up_day = '<S-UP>',
org_timestamp_down_day = '<S-DOWN>',
Expand Down
8 changes: 8 additions & 0 deletions lua/orgmode/config/mappings/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ return {
}),
},
org = {
org_agenda_file_to_front = m.action(
'org_mappings.add_to_agenda_files',
{ opts = { desc = 'org load file' }, help_desc = 'Add current file to agenda files' }
),
org_remove_file = m.action(
'org_mappings.remove_from_agenda_files',
{ opts = { desc = 'org unload file' }, help_desc = 'Add current file to agenda files' }
),
org_refile = m.action(
'capture.refile_headline_to_destination',
{ opts = { desc = 'org refile', help_desc = 'Refile headline to specific destination' } }
Expand Down
18 changes: 18 additions & 0 deletions lua/orgmode/org/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local Table = require('orgmode.files.elements.table')
local EventManager = require('orgmode.events')
local events = EventManager.event
local Babel = require('orgmode.babel')
local OrgApi = require('orgmode.api')

---@class OrgMappings
---@field capture OrgCapture
Expand All @@ -33,6 +34,23 @@ function OrgMappings:new(data)
return opts
end

function OrgMappings:add_to_agenda_files()
if vim.bo.filetype ~= 'org' then
error('Not an org buffer.')
end
local name = vim.api.nvim_buf_get_name(0)
self.files:load_file(name)
end

function OrgMappings:remove_from_agenda_files()
--if vim.bo.filetype ~= 'org' then
-- error('Not an org buffer.')
--end
--local name = vim.api.nvim_buf_get_name(0)
-- TODO implement
error('org-remove-file is not implemented yet')
end

-- TODO:
-- Support archiving to headline
function OrgMappings:archive()
Expand Down

0 comments on commit dab4457

Please sign in to comment.