emacs-evil / evil-collection

A set of keybindings for evil-mode
GNU General Public License v3.0
1.2k stars 275 forks source link

How to use org calendar? #816

Open julian-hoch opened 3 months ago

julian-hoch commented 3 months ago

I have trouble figuring out how to use the org calendar. If I use hjkl in the minibuffer, it does not move the date, instead it enters those characters verbatim. This is my config:

(use-package evil-collection
    :after evil
    :custom
    (evil-collection-calendar-want-org-bindings t)
    :config
    (setq evil-collection-mode-list (delq 'vundo evil-collection-mode-list))
    (evil-collection-init))

Am I doing it wrong? I would have expected that h/l moves by day, j/k by week and perhaps some other keys to change the month.

condy0919 commented 3 months ago

The option evil-collection-calendar-want-org-bindings is to enable

<normal-state> c        org-calendar-goto-agenda
<normal-state> i        org-agenda-diary-entry

M-x calendar then type c or i. Make sure org-agenda-diary-file is not 'diary-file.

julian-hoch commented 3 months ago

Hmm c does move to agenda, but i still is bound to insert mode. But in any case my use case is different - when I enter a date, e.g. using C-c . (org-time-stamp) I get presented with a calendar I can use to input a date. This was what I was referring to - currently I do not see a way to select a date from the calendar except the default shift+cursor. Jun05::200640 Here is where I would have expected evil bindings to move the date around.

condy0919 commented 3 months ago

The binding are defined in org-read-date-minibuffer-local-map keymap.

(define-key org-read-date-minibuffer-local-map (kbd "j") (kbd "S-<down>"))

to get evil-style motion.

IMO, it's an org integration. Currently the org integration of evil-collection is simple,

(defun evil-collection-org-setup ()
  "Set up `evil' bindings for `org'."
  (evil-collection-define-key 'normal 'org-mode-map
    [tab] 'org-cycle
    [S-tab] 'org-shifttab)

  (evil-collection-define-key 'motion 'org-mode-map
    "{" 'org-backward-paragraph
    "}" 'org-forward-paragraph
    "(" 'org-backward-sentence
    ")" 'org-forward-sentence))

That's all.