From dfaa09d657b6c8798c2389160b979153acee91ea Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 28 Nov 2017 22:08:56 +0100 Subject: Add org-agenda key bindings * org-agenda: Init * org-agenda: Require evil and org * org-agenda: Bind org-agenda-redo-all to "gR" to match org-agenda-redo * org-agenda: Document setup and include table of bindings * Use "s" for filtering and "~" to toggle marks * org-agenda: Make HJKL and M- consistent with defaults Former bindings were leftovers of a previous experimentation. * org-agenda: Bind "*" to mark all * README: Add Emacs default bindings to the org-agenda table * org-agenda: Bind "pe", "pt" to org-agenda-set-* and "o" to org-timer-set-timer "z" conflicts with the dispatcher. * org-agenda: Disable the todo-*set functions * org-agenda: Move the "set" functions to the "c" prefix (for "[c]hange") * org-agenda: Bind org-agenda-date-prompt and org-agenda-show-the-flagging-note * org-agenda: Follow evil-collection rationale - Use "gj" and "gk". - Use S-RET to "open in other window" and "M-RET" to "display in other window". - Leave "o" free as it is often recommended for sorting. * org-agenda: Bind C-S-h/C-S-l to org-agenda-todo-*set * README.org: Update org-agenda table --- README.org | 62 +++++++++++++++++++ doc/example_config.el | 2 + evil-org-agenda.el | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 231 insertions(+) create mode 100644 evil-org-agenda.el diff --git a/README.org b/README.org index 05f3707..bb64b5f 100644 --- a/README.org +++ b/README.org @@ -16,6 +16,7 @@ See [[file:doc/changelog.org][changelog]] for a history of changes. - text objects - table support - calendar (date selection) support + - agenda support ** Keybindings @@ -62,6 +63,65 @@ See [[file:doc/changelog.org][changelog]] for a history of changes. | var | select whole table | |-----------+--------------------------------| +**** Agenda + + |-------------------------+-------------------------+-----------------------------------------------------------------------------------| + | Evil key | Emacs key | explanation | + |-------------------------+-------------------------+-----------------------------------------------------------------------------------| + | , S- | | go to the corresponding entry at point | + | | | go to the Org mode file which contains the item at point | + | M- | L | Display Org file and center around the item | + | | | scroll up | + | or | or | scroll down | + | j, k | n, p | next, previous line | + | gj, gk, C-j, C-k | N, P | next, previous item | + | [, ] | b, f | previous, next week | + | J, K | -, +, S-down, S-up | down, up priority | + | H, L | S-left, S-right | modify date to earlier, later | + | t | t | cycle TODO keywords | + | M-j, M-k | M-down, M-up | drag line forward, backward | + | C-S-h, C-S-l | C-S-left, C-S-right | previous, next keyword | + | u | C-_, C-/ | undo | + | dd | C-k | delete item | + | da | a | ask and archive item | + | dA | $ | archive item | + | ct | : | set tags | + | ce | e | set effort | + | cT | ; | set timer | + | i | i | insert entry in diary | + | a | z | add note | + | A | A | append to agenda | + | C | k | capture | + | m | m | mark | + | * | * | toggle all marks | + | % | % | mark regexp | + | M | U | remove all marks | + | x | B | execute action on marks | + | gr | r | refresh agenda | + | gR | g | refresh all agendas | + | ZQ | x | exit agenda | + | ZZ | Q | quit agenda | + | z | v | tweak display (deadlines, diary, follow/log-mode, entry text, grid, day/week/year | + | ZD | # | dim blocked tasks | + | sc, sr, se, st, s^ | <, =, _, /, ^ | filter by category, regexp, effort, tag, top headline | + | su | \vert | remove all filters | + | ss | ~ | filter/limit interactively | + | I | I | clock in | + | O | O | clock out | + | cg | J | jump to the currently clocked in task within the agenda | + | cc | X | cancel the current running clock | + | cr | R | toggle clocktable mode in an agenda buffer | + | . | . | go to today's date | + | gc | c | pop up calendar | + | gC | C | pop up date converter | + | p | > | pop up date selector | + | gh | H | pop up holiday calendar | + | gm | M | pop up phases of the moon | + | gs | S | pop up sunrise/sunset times | + | gt | T | pop up tag list | + | +, - | [, ] | manipulate the query by adding a search term with positive or negative selection | + |-------------------------+-------------------------+-----------------------------------------------------------------------------------| + ** Requirements - org-mode, git://orgmode.org/org-mode.git @@ -82,6 +142,8 @@ See [[file:doc/changelog.org][changelog]] for a history of changes. (require 'evil-org) (add-hook 'org-mode-hook 'evil-org-mode) (evil-org-set-key-theme '(navigation insert textobjects additional calendar)) + (require 'evil-org-agenda) + (evil-org-agenda-set-keys) #+END_SRC Or you can customize =evil-org-key-theme= and replace the last line by: diff --git a/doc/example_config.el b/doc/example_config.el index 5569710..dd1e667 100644 --- a/doc/example_config.el +++ b/doc/example_config.el @@ -1,10 +1,12 @@ (add-to-list 'load-path "~/.emacs.d/plugins/evil-org") (require 'evil-org) +(require 'evil-org-agenda) (require 'leader) (require 'hydra) (setf evil-org-key-theme '(navigation insert textobjects additional)) (setf org-special-ctrl-a/e t) +(evil-org-agenda-set-keys) (add-hook 'org-mode-hook (lambda () diff --git a/evil-org-agenda.el b/evil-org-agenda.el new file mode 100644 index 0000000..c0bd4ca --- /dev/null +++ b/evil-org-agenda.el @@ -0,0 +1,167 @@ +;;; evil-org-agenda.el --- evil keybindings for org-agenda-mode + +;; Copyright (C) 2012-2017 by Somelauw +;; Maintainer: Somelauw +;; Original-author: Edward Tjörnhammar +;; URL: https://github.com/Somelauw/evil-org-mode.git +;; Git-Repository: git://github.com/Somelauw/evil-org-mode.git +;; Created: 2012-06-14 +;; Forked-since: 2017-02-12 +;; Version: 0.9.6 +;; Package-Requires: ((emacs "24.4") (evil "1.0") (org "8.0.0")) +;; Keywords: evil vim-emulation org-mode key-bindings presets + +;; This file is not part of GNU Emacs + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;; Minimal config +;; (evil-org-agenda-set-keys) + +;;; Commentary: +;; +;; Known Bugs: +;; See, https://github.com/Somelauw/evil-org-mode/issues +;; +;;; Code: + +(require 'evil) +(require 'org) + +(defun evil-org-agenda-set-keys () + "Set motion state keys for `org-agenda'." + (evil-set-initial-state 'org-agenda-mode 'motion) + + ;; Horizontal movements have little use, thus we can override "f" and "t". + ;; "w", "b", "e", "ge" and their upcase counterparts are preserved. + (evil-define-key 'motion org-agenda-mode-map + ;; Unused keys: D, X + + ;; open + (kbd "") 'org-agenda-goto + (kbd "") 'org-agenda-switch-to + (kbd "S-") 'org-agenda-goto + (kbd "M-") 'org-agenda-recenter + + (kbd "SPC") 'org-agenda-show-and-scroll-up + (kbd "") 'org-agenda-show-scroll-down + (kbd "") 'org-agenda-show-scroll-down + + ;; motion + "j" 'org-agenda-next-line + "k" 'org-agenda-previous-line + "gj" 'org-agenda-next-item + "gk" 'org-agenda-previous-item + (kbd "C-j") 'org-agenda-next-item + (kbd "C-k") 'org-agenda-previous-item + (kbd "[") 'org-agenda-earlier + (kbd "]") 'org-agenda-later + + ;; manipulation + ;; We follow standard org-mode bindings (not org-agenda bindings): + ;; change todo items and priorities. + ;; M- drag lines. + ;; M- cannot demote/promote, we use it for "do-date". + "J" 'org-agenda-priority-down + "K" 'org-agenda-priority-up + "H" 'org-agenda-do-date-earlier + "L" 'org-agenda-do-date-later + "t" 'org-agenda-todo + (kbd "M-j") 'org-agenda-drag-line-forward + (kbd "M-k") 'org-agenda-drag-line-backward + (kbd "C-H") 'org-agenda-todo-previousset ; Original binding "C-S-" + (kbd "C-L") 'org-agenda-todo-nextset ; Original binding "C-S-" + + ;; undo + "u" 'org-agenda-undo + + ;; actions + "dd" 'org-agenda-kill + "dA" 'org-agenda-archive + "da" 'org-agenda-archive-default-with-confirmation + "ct" 'org-agenda-set-tags + "ce" 'org-agenda-set-effort + "cT" 'org-timer-set-timer + "i" 'org-agenda-diary-entry + "a" 'org-agenda-add-note + "A" 'org-agenda-append-agenda + "C" 'org-agenda-capture + + ;; mark + "m" 'org-agenda-bulk-toggle + "~" 'org-agenda-bulk-toggle-all + "*" 'org-agenda-bulk-mark-all + "%" 'org-agenda-bulk-mark-regexp + "M" 'org-agenda-bulk-remove-all-marks + "x" 'org-agenda-bulk-action + + ;; update + (kbd "gr") 'org-agenda-redo + (kbd "gR") 'org-agenda-redo-all + + ;; quit + "ZQ" 'org-agenda-exit + "ZZ" 'org-agenda-quit + + ;; display + ;; "Dispatch" can prefix the following: + ;; 'org-agenda-toggle-deadlines + ;; 'org-agenda-toggle-diary + ;; 'org-agenda-follow-mode + ;; 'org-agenda-log-mode + ;; 'org-agenda-entry-text-mode + ;; 'org-agenda-toggle-time-grid + ;; 'org-agenda-day-view + ;; 'org-agenda-week-view + ;; 'org-agenda-year-view + "z" 'org-agenda-view-mode-dispatch + "ZD" 'org-agenda-dim-blocked-tasks + + ;; filter + "sc" 'org-agenda-filter-by-category + "sr" 'org-agenda-filter-by-regexp + "se" 'org-agenda-filter-by-effort + "st" 'org-agenda-filter-by-tag + "s^" 'org-agenda-filter-by-top-headline + "ss" 'org-agenda-limit-interactively + "S" 'org-agenda-filter-remove-all + + ;; clock + "I" 'org-agenda-clock-in ; Original binding + "O" 'org-agenda-clock-out ; Original binding + "cg" 'org-agenda-clock-goto + "cc" 'org-agenda-clock-cancel + "cr" 'org-agenda-clockreport-mode + + ;; go and show + "." 'org-agenda-goto-today ; TODO: What about evil-repeat? + "gc" 'org-agenda-goto-calendar + "gC" 'org-agenda-convert-date + "gd" 'org-agenda-goto-date + "gh" 'org-agenda-holidays + "gm" 'org-agenda-phases-of-moon + "gs" 'org-agenda-sunrise-sunset + "gt" 'org-agenda-show-tags + + "p" 'org-agenda-date-prompt + "P" 'org-agenda-show-the-flagging-note + + ;; 'org-save-all-org-buffers ; Original binding "C-x C-s" + + ;; Others + "+" 'org-agenda-manipulate-query-add + "-" 'org-agenda-manipulate-query-subtract)) + +(provide 'evil-org-agenda) +;;; evil-org-agenda.el ends here -- cgit v1.0