Click here for the GitHub page.
Plugin to interact with khalorg
: an interface between the org mode and the
khal
cli calendar. If you never heard of khalorg
, take a look at the
GitHub page
The demo below demonstrates the following features using this neovim plugin:
khalorg new
: convert an org agenda item into akhal
agenda item.khalorg list
: convert akhal
agenda item into an org agenda item.khalorg edit
: edit an existingkhal
agenda item with org mode.khalorg delete
: delete an existingkhal
item.
The nvim-khalorg
plugin sends folds in an org document to khalorg through
stdin. The functions are exposed through nvim-orgmode
its custom export option.
Install using your favorite plugin manager. For example packer:
use {'nvim-treesitter/nvim-treesitter'}
use {'nvim-orgmode/orgmode'}
use {'BartSte/nvim-khalorg'}
where nvim-treesitter
and nvim-orgmode
are required. Also, make sure you
installed khalorg
, which can be found here: https://github.com/BartSte/khalorg
The following configuration options are available through the require("khalorg").setup
function:
- calendar: The name of the calendar to use (default: 'default').
Configuring nvim-khalorg
can be done by placing the following in your
init.lua
:
require("khalorg").setup({
calendar = 'my_calendar'
})
where you need to replace 'my_calendar'
with the khal
calendar you want to
use. You can add the export functions of nvim-khalorg
to nvim-orgmode
by
adding the following to your init.lua
:
local khalorg = require('khalorg')
orgmode.setup_ts_grammar()
orgmode.setup({
org_custom_exports = {
n = { label = 'Add a new khal item', action = khalorg.new },
d = { label = 'Delete a khal item', action = khalorg.delete },
e = { label = 'Edit properties of a khal item', action = khalorg.edit },
E = { label = 'Edit properties & dates of a khal item', action = khalorg.edit_all }
}
})
After configuring nvim-khalorg
as is described above, you can access them
through orgmode-org_export
(default mapping: <leader>oe
). More information
can be found by running :help orgmode-org_export
.
The following functions are provided that send a fold in an org file to a khalorg command through stdin:
require("khalorg").new()
: add a new item to khal.require("khalorg").delete()
: delete a khal item.require("khalorg").edit_props()
: edit properties of a khal item, the dates are not updated.require("khalorg").edit_all()
: edit properties of a khal item together with the dates.
The following function is used to create the functions above and can be used to make your own khalorg export functions.
require("khalorg").make_exporter(<khalorg_command>)
:
Returns a function that, when called, does the following:- Get the current fold.
- Get the start and end line of the fold.
- Get the text of the fold.
- Send the text of the fold to
<khalorg_command>
through stdin.
The example below shows how to use khalorg.make_exporter
function to create
the khalorg.new
function:
new = khalorg.make_exporter('khalorg new my_calendar')
If you encounter any issues, please report them on the issue tracker at: nvim-khalorg issues
If you think the issue arises from khalorg instead of nvim-khalorg, please report them here: khalorg issues
Contributions are welcome! Please see CONTRIBUTING for more information.
Distributed under the MIT License.