]> code.delx.au - gnu-emacs-elpa/blob - hydra-examples.el
Split away the examples
[gnu-emacs-elpa] / hydra-examples.el
1 ;;; hydra-examples.el --- some applications for hydra
2
3 ;; Copyright (C) 2015 Oleh Krehel
4
5 ;; This file is not part of GNU Emacs
6
7 ;; This file is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
10 ;; any later version.
11
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
16
17 ;; For a full copy of the GNU General Public License
18 ;; see <http://www.gnu.org/licenses/>.
19
20
21 ;;; Commentary:
22 ;;
23 ;; These are the sample Hydras that you can use.
24
25 ;;; Code:
26
27 (require 'hydra)
28
29 (defvar hydra-example-text-scale
30 '(("g" . text-scale-increase)
31 ("l" . text-scale-decrease))
32 "A two-headed hydra for text scale manipulation.")
33
34 (require 'windmove)
35
36 (defun hydra-move-splitter-left ()
37 "Move window splitter left."
38 (interactive)
39 (if (windmove-find-other-window 'right)
40 (shrink-window-horizontally 1)
41 (enlarge-window-horizontally 1)))
42
43 (defun hydra-move-splitter-right ()
44 "Move window splitter right."
45 (interactive)
46 (if (windmove-find-other-window 'right)
47 (enlarge-window-horizontally 1)
48 (shrink-window-horizontally 1)))
49
50 (defun hydra-move-splitter-up ()
51 "Move window splitter up."
52 (interactive)
53 (if (windmove-find-other-window 'up)
54 (enlarge-window 1)
55 (shrink-window 1)))
56
57 (defun hydra-move-splitter-down ()
58 "Move window splitter down."
59 (interactive)
60 (if (windmove-find-other-window 'up)
61 (shrink-window 1)
62 (enlarge-window 1)))
63
64 (defvar hydra-example-move-window-splitter
65 '(("h" . hydra-move-splitter-left)
66 ("j" . hydra-move-splitter-down)
67 ("k" . hydra-move-splitter-up)
68 ("l" . hydra-move-splitter-right)))
69
70 (provide 'hydra-examples)
71
72 ;;; hydra-examples.el ends here