about summary refs log tree commit diff
path: root/configs/shared/emacs/.emacs.d/elpa/evil-collection-20180913.209/evil-collection-indium.el
blob: 8393eb43aa1e78dc216da9e069364a0cceb2b494 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
;;; evil-collection-indium.el --- Bindings for `indium'. -*- lexical-binding: t -*-

;; Copyright (C) 2017 James Nguyen

;; Author: James Nguyen <james@jojojames.com>
;; Maintainer: James Nguyen <james@jojojames.com>
;; Pierre Neidhardt <mail@ambrevar.xyz>
;; URL: https://github.com/emacs-evil/evil-collection
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: emacs, indium, javascript, tools

;; 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 <http://www.gnu.org/licenses/>.

;;; Commentary:
;; Bindings for `indium'.

;;; Code:
(require 'evil-collection)
(require 'evil-collection-settings)
(require 'indium nil t)

(defconst evil-collection-indium-maps '(indium-debugger-mode-map
                                        indium-inspector-mode-map
                                        indium-debugger-locals-mode-map
                                        indium-debugger-frames-mode-map
                                        indium-interaction-mode-map
                                        indium-repl-mode-map))

(defun evil-collection-indium-setup ()
  "Set up `evil' bindings for `indium'."
  (when evil-collection-settings-setup-debugger-keys
    (evil-collection-define-key 'normal 'indium-debugger-mode-map
      "n" 'indium-debugger-step-over
      "i" 'indium-debugger-step-into
      "o" 'indium-debugger-step-out
      "c" 'indium-debugger-resume
      "L" 'indium-debugger-locals
      "s" 'indium-debugger-stack-frames
      "q" 'indium-debugger-resume
      "H" 'indium-debugger-here
      "e" 'indium-debugger-evaluate
      ">" 'indium-debugger-next-frame
      "<" 'indium-debugger-previous-frame)

    (add-hook 'indium-debugger-mode-hook #'evil-normalize-keymaps))

  (evil-collection-define-key 'normal 'indium-inspector-mode-map
    "q" 'quit-window
    (kbd "RET") 'indium-follow-link
    [mouse-1] 'indium-follow-link
    "L" 'indium-inspector-pop
    "gr" 'indium-inspector-refresh
    "gj" 'indium-inspector-next-reference
    "gk" 'indium-inspector-previous-reference
    (kbd "C-j") 'indium-inspector-next-reference
    (kbd "C-k") 'indium-inspector-previous-reference
    [tab] 'indium-inspector-next-reference
    [backtab] 'indium-inspector-previous-reference)

  (evil-collection-define-key 'normal 'indium-debugger-locals-mode-map
    "q" 'quit-window
    "L" nil
    "gr" nil)

  (evil-collection-define-key 'normal 'indium-debugger-frames-mode-map
    "q" 'quit-window
    [return] 'indium-follow-link
    (kbd "RET") 'indium-follow-link
    (kbd "gj") 'indium-debugger-frames-next-frame
    (kbd "gk") 'indium-debugger-frames-previous-frame
    (kbd "C-j") 'indium-debugger-frames-next-frame
    (kbd "C-k") 'indium-debugger-frames-previous-frame
    [tab] 'indium-debugger-frames-next-frame
    [backtab] 'indium-debugger-frames-previous-frame)

  (evil-collection-define-key 'normal 'indium-interaction-mode-map
    "gr" 'indium-update-script-source
    "gz" 'indium-switch-to-repl-buffer)

  (when evil-collection-settings-setup-debugger-keys
    (evil-collection-define-key 'normal 'indium-interaction-mode-map
      [left-fringe mouse-1] 'indium-mouse-toggle-breakpoint
      [left-margin mouse-1] 'indium-mouse-toggle-breakpoint
      [f5] 'indium-debugger-resume
      [S-f5] 'indium-debugger-resume
      [f9] 'indium-toggle-breakpoint
      [f10] 'indium-debugger-step-over
      [f11] 'indium-debugger-step-into
      [S-f11] 'indium-debugger-step-out))

  (evil-collection-define-key 'normal 'indium-repl-mode-map
    (kbd "gj") 'indium-repl-next-input
    (kbd "gk") 'indium-repl-previous-input
    (kbd "C-j") 'indium-repl-next-input
    (kbd "C-k") 'indium-repl-previous-input))

(provide 'evil-collection-indium)
;;; evil-collection-indium.el ends here