org.nvim

Completion

Completes (like Emacs org-pcomplete):

  • TODO keywords after stars
  • tags after : on a headline (not the ones already set) or in #+FILETAGS
  • #+ keywords, #+STARTUP and #+OPTIONS values, #+begin_src languages, then header arguments and switches (also on #+HEADER:)
  • #+BEGIN: clocktable parameters
  • entities after \ (\alpha)
  • in a property drawer, property names the entry doesn't have yet; elsewhere drawer names used in the buffer, after : at line start
  • link types, stored links, headlines ([[*) and custom IDs ([[#)
omnifunc:    <C-x><C-o> (set automatically)
blink.cmp:
sources = {
  per_filetype = { org = { inherit_defaults = true, "org" } },
  providers = { org = { name = "Org", module = "org.completion.blink" } },
}
    require("cmp").register_source("org", require("org.completion.cmp").new())
<

Pickers

The pick_* actions open a fuzzy picker: headlines show their outline path, TODO keyword, priority and tags with the Org highlights, and the preview shows the entry in its file (in its buffer, unsaved changes and all, when the file is loaded). Confirming jumps there (and opens the folds around it). The picker option chooses the picker:

  "auto"       LazyVim's picker when it is installed (vim.g.lazyvim_picker,
               or with its "auto" the picker extra enabled in
               :LazyExtras), else the first installed of the ones below,
               else "select" (default)
  "snacks"     snacks.nvim (Snacks.picker)
  "fzf-lua"    fzf-lua (fzf_exec, the builtin previewer)
  "telescope"  telescope.nvim
  "mini"       mini.pick, once require("mini.pick").setup() has run
  "select"     vim.ui.select(): one item, no preview

None of these plugins is required: a picker is looked for (with require) when an action runs, never at startup, and one that isn't installed falls back to "select" with a warning.

  pick_headline          a headline of this file
  pick_headline_all      a headline of the agenda files (and this file)
  pick_tag               a tag of the agenda files (with how many headlines
                         carry it), then a headline with it, its own or
                         inherited
  pick_set_tags          the tags of the headline at the cursor: the tags
                         chosen (several with multi-select) are toggled, ✓
                         marks the ones it has; text that matches no tag
                         is added as new tags (a:b adds two). mini.pick
                         lists "+ New tags: <text>" below the matches;
                         with "select", "+ New tags…" asks for the text.
  pick_agenda            an entry of today's agenda
  pick_agenda_week       an entry of the agenda of the next 7 days
  pick_todo              an open TODO entry (the global TODO list, in
                         the order of its view: agenda.sorting)
  pick_agenda_file       an agenda file
  pick_capture_template  a capture template, then capture with it (from
                         the agenda, at the date at the cursor with
                         capture.use_agenda_date, as the capture menu)

Multi-select: <Tab> in snacks.nvim, fzf-lua and telescope, <C-x> then <M-CR> in mini.pick. The actions have no default keys; bind them in any action section (org-keymaps), e.g.

mappings = {
  global = { pick_headline_all = "<leader>fo", pick_todo = "<leader>ft" },
}
    require("telescope").load_extension("org")
<then :Telescope org headlines (also headlines_all, tags, set_tags,
agenda, agenda_week, todo, agenda_files, capture_templates;
:Telescope org alone is headlines_all). These use telescope whatever
picker says. The roam extension's node finder uses the same pickers
(org-extensions-roam).

Resuming (Snacks.picker.resume(), :FzfLua resume, :Telescope resume, :Pick resume) reopens the last picker as it was left, and choosing there acts again: jumps, toggles the tags, captures. A resumed roam node finder closes without effect.

From Lua, require("org.pickers").pick(spec) shows any list: spec.items are { display = { { text, hl_group }, ... }, filename?, bufnr?, lnum?, value? } and spec.on_choice(items, query) gets the chosen ones; see lua/org/pickers/init.lua.