evil-collection/evil-collection-calendar.el

105 lines
3.4 KiB
EmacsLisp
Raw Normal View History

2017-12-07 02:41:09 +01:00
;;; evil-collection-calendar.el --- Evil bindings for calendar -*- lexical-binding: t -*-
2017-11-06 11:49:20 +01:00
;; Copyright (C) 2017 Pierre Neidhardt
2018-08-27 10:41:51 +02:00
;; Author: Pierre Neidhardt <mail@ambrevar.xyz>
;; Maintainer: James Nguyen <james@jojojames.com>
2018-08-27 10:41:51 +02:00
;; Pierre Neidhardt <mail@ambrevar.xyz>
2018-03-02 02:22:38 +01:00
;; URL: https://github.com/emacs-evil/evil-collection
;; Version: 0.0.1
2017-11-16 09:48:00 +01:00
;; Package-Requires: ((emacs "25.1"))
;; Keywords: evil, calendar, tools
2017-11-06 11:49:20 +01:00
;; This file 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, or (at your
;; option) any later version.
;;
;; This file 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.
;;
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Evil bindings for the calendar.
2017-11-06 11:49:20 +01:00
;;; Code:
(require 'calendar)
(require 'evil-collection)
2017-11-06 11:49:20 +01:00
(defconst evil-collection-calendar-maps '(calendar-mode-map))
2017-12-07 02:41:09 +01:00
(defun evil-collection-calendar-setup ()
"Set up `evil' bindings for `calendar'."
2018-01-10 04:26:16 +01:00
(evil-set-initial-state 'calendar-mode 'normal)
(evil-collection-define-key 'normal 'calendar-mode-map
2017-11-06 11:49:20 +01:00
;; motion
"h" 'calendar-backward-day
"j" 'calendar-forward-week
"k" 'calendar-backward-week
"l" 'calendar-forward-day
"0" 'calendar-beginning-of-week
"^" 'calendar-beginning-of-week
"$" 'calendar-end-of-week
"[" 'calendar-backward-year
"]" 'calendar-forward-year
(kbd "M-<") 'calendar-beginning-of-year
(kbd "M->") 'calendar-end-of-year
"(" 'calendar-beginning-of-month
")" 'calendar-end-of-month
(kbd "SPC") 'scroll-other-window
(kbd "S-SPC") 'scroll-other-window-down
(kbd "<delete>") 'scroll-other-window-down
"<" 'calendar-scroll-right
">" 'calendar-scroll-left
(kbd "C-b") 'calendar-scroll-right-three-months
(kbd "C-f") 'calendar-scroll-left-three-months
"{" 'calendar-backward-month
"}" 'calendar-forward-month
(kbd "C-k") 'calendar-backward-month
(kbd "C-j") 'calendar-forward-month
2017-11-23 16:28:46 +01:00
"gk" 'calendar-backward-month
"gj" 'calendar-forward-month
2017-11-06 11:49:20 +01:00
;; visual
"v" 'calendar-set-mark
;; goto
2017-11-13 12:56:27 +01:00
"." 'calendar-goto-today
2017-11-06 11:49:20 +01:00
"gd" 'calendar-goto-date ; "gd" in evil-org-agenda, "gd" in Emacs.
;; "gD" 'calendar-other-month ; Not very useful if we have `calendar-goto-date'.
2017-11-06 11:49:20 +01:00
;; diary
"D" 'diary-view-other-diary-entries
"d" 'diary-view-entries
"m" 'diary-mark-entries
"s" 'diary-show-all-entries
"u" 'calendar-unmark
"x" 'calendar-mark-holidays
;; show
"gm" 'calendar-lunar-phases ; "gm" in evil-org-agenda. TODO: Shadows calendar-mayan.
"gs" 'calendar-sunrise-sunset ; "gs" in evil-org-agenda
"gh" 'calendar-list-holidays ; "gh" in evil-org-agenda. TODO: Shadows calendar-hebrew.
"gc" 'org-calendar-goto-agenda ; "gc" in evil-org-agenda. TODO: Shadows calendar-iso.
2017-11-23 14:26:24 +01:00
"r" 'calendar-cursor-holidays
2017-11-06 11:49:20 +01:00
;; refresh
2017-11-06 11:49:20 +01:00
"gr" 'calendar-redraw
2017-11-27 08:20:32 +01:00
"g?" 'calendar-goto-info-node
2017-11-27 18:03:46 +01:00
"?" 'calendar-goto-info-node ; Search is not very useful.
2017-11-06 11:49:20 +01:00
(kbd "M-=") 'calendar-count-days-region
;; quit
"q" 'calendar-exit
"ZQ" 'evil-quit
"ZZ" 'calendar-exit))
2017-12-07 02:41:09 +01:00
(provide 'evil-collection-calendar)
;;; evil-collection-calendar.el ends here