3

I'd like to try a different method of specifying tags than the built-in single character codes. How can I tag headings using ido or ivy completion?

I think I would like at least two commands:

  1. Toggle a single tag on a heading
  2. Edit the list of tags for a heading

For what it's worth, I want to use flex matching for this (I don't think that's relevant, so I say that just to give as much intent as I can).

I'm not using org-capture

  • 1
    FWIW, counsel, which usually comes with ivy, provides the command counsel-org-tag, which you may like to try out. – Basil Jul 4 '17 at 6:32
  • @Basil Why not add that as an answer? However, I haven't yet found how to select multiple tags that way, without running counsel-org-tag multiple times – Croad Langshan Aug 19 '17 at 15:15
  • 1
    Actually now I look again I see I can use C-M-m (ivy-call) to select multiple tags - that appears to work for all selected tags EXCEPT for the last tag in the list you just selected. Frustrating! – Croad Langshan Aug 19 '17 at 15:21
  • I haven't run into any issues with ivy multiple selection; if you can reproduce the problem I suggest opening an issue on the project's GitHub page. – Basil Aug 19 '17 at 15:34
4

For those users of an ivy/counsel persuasion, the command counsel-org-tag (added in v0.6 AFAICT) enables ivy-backed completion (including multiple selection and deselection) of org-mode tags:

counsel-org-tag is an interactive autoloaded compiled Lisp function in counsel.el.

(counsel-org-tag)

Add or remove tags in org-mode.

In my configuration I like to remap the default keybindings of org-set-tags-command (C-c C-q) to counsel-org-tag like so:

(global-set-key [remap org-set-tags-command] #'counsel-org-tag)

or, equivalently without the remapping:

(with-eval-after-load 'org
  (define-key org-mode-map (kbd "C-c C-q") #'counsel-org-tag))

Irrespective of how counsel-org-tag is invoked, during completion you can type C-m (ivy-done) to exit with the currently selected candidate, or C-M-m (ivy-call) to select the current candidate and remain in the completion session. Typing C-M-m (ivy-call) over an already selected candidate removes it from the list of selected tags. At any point, you can exit completion with the current list of selected tags by typing C-M-j (ivy-immediate-done). See the ivy manual for more commands/tricks.

0

It isn't ido or ivy, but you can use helm for this via helm-org. If you use "free" selection (TAB) after org-set-tags (C-c C-q or C-c C-c), Helm will complete your tags with fuzzy matching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.