forked from emacs-evil/evil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evil-vars.el
2023 lines (1739 loc) · 66.3 KB
/
evil-vars.el
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; evil-vars.el --- Settings and variables -*- lexical-binding: t -*-
;; Author: Vegard Øye <vegard_oye at hotmail.com>
;; Maintainer: Vegard Øye <vegard_oye at hotmail.com>
;; Version: 1.14.0
;;
;; This file is NOT part of GNU Emacs.
;;; License:
;; This file is part of Evil.
;;
;; Evil 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.
;;
;; Evil 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 Evil. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(declare-function evil-add-command-properties "evil-common"
(command &rest properties))
(declare-function evil-update-insert-state-bindings "evil-maps"
(&optional _option-name remove force))
;;; Hooks
(defvar evil-after-load-hook nil
"Functions to be run when loading of Evil is finished.
This hook can be used the execute some initialization routines
when Evil is completely loaded.")
(defcustom evil-goto-definition-functions
'(evil-goto-definition-imenu
evil-goto-definition-semantic
evil-goto-definition-xref
evil-goto-definition-search)
"List of functions run until success by `evil-goto-definition'."
:type 'hook
:group 'evil)
;;; Initialization
(defvar evil-pending-custom-initialize nil
"A list of pending initializations for custom variables.
Each element is a triple (FUNC VAR VALUE). When Evil is
completely loaded then the functions (funcall FUNC VAR VALUE) is
called for each element. FUNC should be a function suitable for
the :initialize property of `defcustom'.")
(defun evil-custom-initialize-pending-reset (var value)
"Add a pending customization with `custom-initialize-reset'."
(push (list 'custom-initialize-reset var value)
evil-pending-custom-initialize))
(defun evil-run-pending-custom-initialize ()
"Executes the pending initializations.
See `evil-pending-custom-initialize'."
(dolist (init evil-pending-custom-initialize)
(apply (car init) (cdr init)))
(remove-hook 'evil-after-load-hook 'evil-run-pending-custom-initialize))
(add-hook 'evil-after-load-hook 'evil-run-pending-custom-initialize)
;;; Setters
(defun evil-set-toggle-key (key)
"Set `evil-toggle-key' to KEY.
KEY must be readable by `read-kbd-macro'."
(let ((old-key (read-kbd-macro
(if (boundp 'evil-toggle-key)
evil-toggle-key
"C-z")))
(key (read-kbd-macro key)))
(with-no-warnings
(dolist (pair '((evil-motion-state-map evil-emacs-state)
(evil-insert-state-map evil-emacs-state)
(evil-emacs-state-map evil-exit-emacs-state)))
(when (boundp (car pair))
(let ((map (symbol-value (car pair)))
(fun (cadr pair)))
(when (keymapp map)
(define-key map key fun)
(define-key map old-key nil))))))))
(defun evil-set-custom-state-maps (var pending-var key _make newlist)
"Changes the list of special keymaps.
VAR is the variable containing the list of keymaps.
PENDING-VAR is the variable containing the list of the currently pending
keymaps.
KEY the special symbol to be stored in the keymaps.
MAKE the creation function of the special keymaps.
NEWLIST the list of new special keymaps."
(set-default pending-var newlist)
(when (default-boundp var)
(dolist (map (default-value var))
(when (and (boundp (car map))
(keymapp (default-value (car map))))
(define-key (default-value (car map)) (vector key) nil))))
(set-default var newlist)
(evil-update-pending-maps))
(defun evil-update-pending-maps (&optional _file)
"Tries to set pending special keymaps.
This function should be called from an `after-load-functions'
hook."
(let ((maps '((evil-make-overriding-map . evil-pending-overriding-maps)
(evil-make-intercept-map . evil-pending-intercept-maps))))
(while maps
(let* ((map (pop maps))
(make (car map))
(pending-var (cdr map))
(pending (symbol-value pending-var))
newlist)
(while pending
(let* ((map (pop pending))
(kmap (and (boundp (car map))
(keymapp (symbol-value (car map)))
(symbol-value (car map))))
(state (cdr map)))
(if kmap
(funcall make kmap state)
(push map newlist))))
(set-default pending-var newlist)))))
(defun evil-set-visual-newline-commands (var value)
"Set the value of `evil-visual-newline-commands'.
Setting this variable changes the properties of the appropriate
commands."
(with-no-warnings
(when (default-boundp var)
(dolist (cmd (default-value var))
(evil-set-command-property cmd :exclude-newline nil)))
(set-default var value)
(dolist (cmd (default-value var))
(evil-set-command-property cmd :exclude-newline t))))
(defun evil-set-custom-motions (var values)
"Sets the list of motion commands."
(with-no-warnings
(when (default-boundp var)
(dolist (motion (default-value var))
(evil-add-command-properties motion :keep-visual nil :repeat nil)))
(set-default var values)
(mapc #'evil-declare-motion (default-value var))))
;;; Customization group
(defgroup evil nil
"Extensible vi layer."
:group 'emulations
:prefix 'evil-)
(defcustom evil-auto-indent t
"\\<evil-normal-state-map>
Whether to auto-indent when opening lines with \\[evil-open-below] \
and \\[evil-open-above]."
:type 'boolean
:group 'evil)
(make-variable-buffer-local 'evil-auto-indent)
(defcustom evil-shift-width 4
"\\<evil-normal-state-map>
The number of columns by which a line is shifted.
This applies to the shifting operators \\[evil-shift-right] and \
\\[evil-shift-left]."
:type 'integer
:group 'evil)
(make-variable-buffer-local 'evil-shift-width)
(defcustom evil-shift-round t
"\\<evil-normal-state-map>
Whether shifting rounds to the nearest multiple.
If non-nil, \\[evil-shift-right] and \\[evil-shift-left] adjust line
indentation to the nearest multiple of `evil-shift-width'."
:type 'boolean
:group 'evil)
(make-variable-buffer-local 'evil-shift-round)
(defcustom evil-indent-convert-tabs t
"\\<evil-normal-state-map>
If non-nil, the \\[evil-indent] operator converts between leading tabs and spaces.
Whether tabs are converted to spaces or vice versa depends on the
value of `indent-tabs-mode'."
:type 'boolean
:group 'evil)
(defcustom evil-default-cursor t
"The default cursor.
May be a cursor type as per `cursor-type', a color string as passed
to `set-cursor-color', a zero-argument function for changing the
cursor, or a list of the above."
:type '(set symbol (cons symbol symbol) string function)
:group 'evil)
(defvar evil-force-cursor nil
"Overwrite the current states default cursor.")
(defcustom evil-repeat-move-cursor t
"\\<evil-normal-state-map>
Whether repeating commands with \\[evil-repeat] may move the cursor.
If nil, the original cursor position is preserved, even if the command
normally would have moved the cursor."
:type 'boolean
:group 'evil)
(defcustom evil-cross-lines nil
"\\<evil-motion-state-map>
Whether horizontal motions may move to other lines. If non-nil,
certain motions that conventionally operate in a single line may move
the cursor to other lines. Otherwise, they are restricted to the
current line. This applies to \\[evil-backward-char], \
\\[evil-forward-char], \\[evil-find-char], \
\\[evil-find-char-backward], \\[evil-find-char-to], \
\\[evil-find-char-to-backward], \
\\<evil-normal-state-map>\\[evil-invert-char]."
:type 'boolean
:group 'evil)
(defcustom evil-backspace-join-lines t
"Whether backward delete in insert state may join lines."
:type 'boolean
:group 'evil)
(defcustom evil-move-cursor-back t
"Whether the cursor is moved backwards when exiting insert state.
If non-nil, the cursor moves \"backwards\" when exiting insert state,
so that it ends up on the character to the left. Otherwise it remains
in place, on the character to the right."
:type 'boolean
:group 'evil)
(defcustom evil-move-beyond-eol nil
"Whether the cursor can move past the end of the line.
If non-nil, the cursor is allowed to move one character past the
end of the line, as in Emacs."
:type 'boolean
:group 'evil)
(defcustom evil-respect-visual-line-mode nil
"\\<evil-motion-state-map>
Whether movement commands respect `visual-line-mode'.
If non-nil, `visual-line-mode' is generally respected when it is
on. In this case, motions such as \\[evil-next-line] and
\\[evil-previous-line] navigate by visual lines (on the screen) rather
than \"physical\" lines (defined by newline characters). If nil,
the setting of `visual-line-mode' is ignored.
This variable must be set before Evil is loaded."
:type 'boolean
:group 'evil)
(defcustom evil-repeat-find-to-skip-next t
"Whether a repeat of t or T should skip an adjacent character."
:type 'boolean
:group 'evil)
(defcustom evil-kbd-macro-suppress-motion-error nil
"\\<evil-motion-state-map>
Whether left/right motions signal errors in keyboard macros.
This variable only affects beginning-of-line or end-of-line errors
regarding the motions \\[evil-backward-char] and \\[evil-forward-char]
respectively. This may be desired since such errors cause macro
definition or execution to be terminated. There are four
possibilities:
- `record': errors are suppressed when recording macros, but not when
replaying them.
- `replay': errors are suppressed when replaying macros, but not when
recording them.
- `t': errors are suppressed in both cases.
- `nil': errors are never suppressed."
:type '(radio (const :tag "No" :value nil)
(const :tag "Record" :value record)
(const :tag "Replay" :value replay)
(const :tag "Both" :value t))
:group 'evil)
(defcustom evil-track-eol t
"\\<evil-motion-state-map>
Whether \\[evil-end-of-line] \"sticks\" the cursor to the end of the line.
If non-nil, vertical motions after \\[evil-end-of-line] maintain the cursor at the
end of the line, even if the target line is longer. This is analogous
to `track-eol', but respects Evil's interpretation of end-of-line."
:type 'boolean
:group 'evil)
(defcustom evil-mode-line-format 'before
"The position of the state tag in the mode line.
If set to `before' or `after', the tag is placed at the beginning
or the end of the mode-line, respectively. If nil, there is no
tag. Otherwise it should be a cons cell (WHERE . WHICH), where
WHERE is either `before' or `after', and WHICH is a symbol in
`mode-line-format'. The tag is then placed before or after that
symbol, respectively."
:type '(radio :value 'before
(const before)
(const after)
(cons :tag "Next to symbol"
(choice :value after
(const before)
(const after))
symbol))
:group 'evil)
(defcustom evil-mouse-word 'evil-word
"The thing-at-point symbol for double click selection.
The double-click starts visual state in a special word selection
mode. This symbol is used to determine the words to be
selected. Possible values are `evil-word' or `evil-WORD'."
:type 'symbol
:group 'evil)
(defcustom evil-bigword "^ \t\r\n"
"The set of characters to be interpreted as WORD boundaries.
This is enclosed with square brackets and used as a regular
expression. By default, whitespace characters are considered
WORD boundaries."
:type 'string
:group 'evil)
(make-variable-buffer-local 'evil-bigword)
(defcustom evil-want-fine-undo nil
"Whether actions are undone in several steps.
There are two possible choices: nil (\"no\") means that all
changes made during insert state, including a possible delete
after a change operation, are collected in a single undo step.
Non-nil (\"yes\") means that undo steps are determined according
to Emacs heuristics, and no attempt is made to aggregate changes.
For backward compatibility purposes, the value `fine' is
interpreted as `nil'. This option was removed because it did not
work consistently."
:type '(radio (const :tag "No" :value nil)
(const :tag "Fine (obsolete)" :value fine)
(const :tag "Yes" :value t))
:group 'evil)
(defcustom evil-regexp-search t
"\\<evil-motion-state-map>
Whether to use regular expressions for searching in \
\\[evil-search-forward] and \\[evil-search-backward]."
:type 'boolean
:group 'evil)
(defcustom evil-search-wrap t
"\\<evil-motion-state-map>
Whether search with \\[evil-search-forward] and \
\\[evil-search-backward] wraps around the buffer.
If this is non-nil, search stops at the buffer boundaries."
:type 'boolean
:group 'evil)
(defcustom evil-flash-delay 2
"\\<evil-motion-state-map>
Time in seconds to flash search matches after \\[evil-search-next] and \
\\[evil-search-previous]."
:type 'number
:group 'evil)
(defcustom evil-auto-balance-windows t
"If non-nil window creation and deletion trigger rebalancing."
:type 'boolean
:group 'evil)
(defcustom evil-split-window-below nil
"If non-nil split windows are created below."
:type 'boolean
:group 'evil)
(defcustom evil-vsplit-window-right nil
"If non-nil vertically split windows with are created to the right."
:type 'boolean
:group 'evil)
(defcustom evil-esc-delay 0.01
"The time, in seconds, to wait for another key after escape.
If no further event arrives during this time, the event is
translated to `ESC'. Otherwise, it is translated according to
`input-decode-map'. This does not apply in Emacs state, and may
also be inhibited by setting `evil-inhibit-esc'."
:type 'number
:group 'evil)
(defvar evil-esc-mode nil
"Non-nil if `evil-esc-mode' is enabled.")
(defvar evil-esc-map nil
"Original ESC prefix map in `input-decode-map'.
Used by `evil-esc-mode'.")
(defvar evil-inhibit-esc nil
"If non-nil, the \\e event will never be translated to 'escape.")
(defcustom evil-intercept-esc 'always
"Whether Evil should intercept the escape key.
In the terminal, escape and a meta key sequence both generate the
same event. In order to distingush these, Evil uses
`input-decode-map'. It is not necessary to do this in a graphical
Emacs session. However, if you prefer to use `C-[' as escape (which
is identical to the terminal escape key code), this interception must
also happen in graphical Emacs sessions. Set this variable to
`always', t (only in the terminal) or nil (never intercept)."
:type '(radio (const :tag "Never" :value nil)
(const :tag "In terminal only" :value t)
(const :tag "Always" :value always))
:group 'evil)
(defcustom evil-show-paren-range 0
"The minimal distance between point and a parenthesis
which causes the parenthesis to be highlighted."
:type 'integer
:group 'evil)
(defcustom evil-ex-hl-update-delay 0.02
"Time in seconds of idle before updating search highlighting.
Setting this to a period shorter than that of keyboard's repeat
rate allows highlights to update while scrolling."
:type 'number
:group 'evil)
(defcustom evil-highlight-closing-paren-at-point-states
'(not emacs insert replace)
"The states in which the closing parenthesis at point should be highlighted.
All states listed here highlight the closing parenthesis at
point (which is Vim's default behavior). All others highlight the
parenthesis before point (which is Emacs default behavior). If
this list contains the symbol `not' then its meaning is inverted,
i.e. all states listed here highlight the closing parenthesis
before point."
:type '(repeat symbol)
:group 'evil)
(defcustom evil-kill-on-visual-paste t
"Whether pasting in visual state adds the replaced text to the
kill ring, making it the default for the next paste. The default,
replicates the default Vim behavior."
:type 'boolean
:group 'evil)
(defcustom evil-want-C-i-jump t
"Whether `C-i' jumps forward in the jump list (like Vim).
Otherwise, `C-i' inserts a tab character."
:type 'boolean
:group 'evil
:set #'(lambda (sym value)
(set-default sym value)
(when (boundp 'evil-motion-state-map)
(cond
((and (not value)
(eq (lookup-key evil-motion-state-map (kbd "C-i"))
'evil-jump-forward))
(define-key evil-motion-state-map (kbd "C-i") nil))
((and value
(not (lookup-key evil-motion-state-map (kbd "C-i"))))
(define-key evil-motion-state-map (kbd "C-i") 'evil-jump-forward))))))
(defcustom evil-want-C-u-scroll nil
"Whether `C-u' scrolls up (like Vim).
Otherwise, `C-u' applies a prefix argument. The binding of
`C-u' mirrors Emacs behaviour by default due to the relative
ubiquity of prefix arguments."
:type 'boolean
:group 'evil
:set #'(lambda (sym value)
(set-default sym value)
(when (boundp 'evil-motion-state-map)
(cond
((and (not value)
(eq (lookup-key evil-motion-state-map (kbd "C-u"))
'evil-scroll-up))
(define-key evil-motion-state-map (kbd "C-u") nil))
((and value
(not (lookup-key evil-motion-state-map (kbd "C-u"))))
(define-key evil-motion-state-map (kbd "C-u") 'evil-scroll-up))))))
(defcustom evil-want-C-d-scroll t
"Whether `C-d' scrolls down (like Vim)."
:type 'boolean
:group 'evil
:set #'(lambda (sym value)
(set-default sym value)
(when (boundp 'evil-motion-state-map)
(cond
((and (not value)
(eq (lookup-key evil-motion-state-map (kbd "C-d"))
'evil-scroll-down))
(define-key evil-motion-state-map (kbd "C-d") nil))
((and value
(not (lookup-key evil-motion-state-map (kbd "C-d"))))
(define-key evil-motion-state-map (kbd "C-d") 'evil-scroll-down))))))
(defcustom evil-want-C-u-delete nil
"Whether `C-u' deletes back to indentation in insert state.
Otherwise, `C-u' applies a prefix argument. The binding of
`C-u' mirrors Emacs behaviour by default due to the relative
ubiquity of prefix arguments."
:type 'boolean
:group 'evil
:set #'(lambda (sym value)
(set-default sym value)
(when (boundp 'evil-insert-state-map)
(cond
((and (not value)
(eq (lookup-key evil-insert-state-map (kbd "C-u"))
'evil-delete-back-to-indentation))
(define-key evil-insert-state-map (kbd "C-u") nil))
((and value
(not (lookup-key evil-insert-state-map (kbd "C-u"))))
(define-key evil-insert-state-map (kbd "C-u") 'evil-delete-back-to-indentation))))))
(defcustom evil-want-C-w-delete t
"Whether `C-w' deletes a word in Insert state."
:type 'boolean
:group 'evil
:set #'(lambda (sym value)
(set-default sym value)
(when (boundp 'evil-insert-state-map)
(cond
((and (not value)
(eq (lookup-key evil-insert-state-map (kbd "C-w"))
'evil-delete-backward-word))
(define-key evil-insert-state-map (kbd "C-w") 'evil-window-map))
((and value
(eq (lookup-key evil-insert-state-map (kbd "C-w"))
'evil-window-map))
(define-key evil-insert-state-map (kbd "C-w") 'evil-delete-backward-word))))))
(defcustom evil-want-C-g-bindings nil
"Whether `C-g' postfix can be used in bindings."
:type 'boolean
:group 'evil)
(defcustom evil-want-C-w-in-emacs-state nil
"Whether `C-w' prefixes windows commands in Emacs state."
:type 'boolean
:group 'evil
:set #'(lambda (sym value)
(set-default sym value)
(when (boundp 'evil-emacs-state-map)
(cond
((and (not value)
(eq (lookup-key evil-emacs-state-map (kbd "C-w"))
'evil-window-map))
(define-key evil-emacs-state-map (kbd "C-w") nil))
((and value
(not (lookup-key evil-emacs-state-map (kbd "C-w"))))
(define-key evil-emacs-state-map (kbd "C-w") 'evil-window-map))))))
(defcustom evil-want-change-word-to-end t
"Whether `cw' behaves like `ce'."
:type 'boolean
:group 'evil)
(defcustom evil-want-Y-yank-to-eol nil
"Whether `Y' yanks to the end of the line.
The default behavior is to yank the whole line, like Vim."
:group 'evil
:type 'boolean
:initialize #'evil-custom-initialize-pending-reset
:set #'(lambda (sym value)
(set-default sym value)
(evil-add-command-properties
'evil-yank-line
:motion (if value
'evil-end-of-line-or-visual-line
'evil-line-or-visual-line))))
(defcustom evil-disable-insert-state-bindings nil
"Whether insert state bindings should be used.
Bindings for escape, delete and `evil-toggle-key' are always
available. If this is non-nil, default Emacs bindings are by and
large accessible in insert state."
:group 'evil
:type 'boolean
:initialize #'evil-custom-initialize-pending-reset
:set #'(lambda (sym value)
(set-default sym value)
(evil-update-insert-state-bindings sym value)))
(defcustom evil-echo-state t
"Whether to signal the current state in the echo area."
:type 'boolean
:group 'evil)
(defcustom evil-complete-all-buffers t
"\\<evil-insert-state-map>
Whether completion looks for matches in all buffers.
This applies to \\[evil-complete-next] and \\[evil-complete-previous] \
in insert state."
:type 'boolean
:group 'evil)
(defvar dabbrev-search-these-buffers-only)
(defvar dabbrev-case-distinction)
(defcustom evil-complete-next-func
#'(lambda (arg)
(require 'dabbrev)
(let ((dabbrev-search-these-buffers-only
(unless evil-complete-all-buffers
(list (current-buffer))))
dabbrev-case-distinction)
(condition-case nil
(if (eq last-command this-command)
(dabbrev-expand nil)
(dabbrev-expand (- (abs (or arg 1)))))
(error (dabbrev-expand nil)))))
"Completion function used by \
\\<evil-insert-state-map>\\[evil-complete-next]."
:type 'function
:group 'evil)
(defcustom evil-complete-previous-func
#'(lambda (arg)
(require 'dabbrev)
(let ((dabbrev-search-these-buffers-only
(unless evil-complete-all-buffers
(list (current-buffer))))
dabbrev-case-distinction)
(dabbrev-expand arg)))
"Completion function used by \
\\<evil-insert-state-map>\\[evil-complete-previous]."
:type 'function
:group 'evil)
(defcustom evil-complete-next-minibuffer-func 'minibuffer-complete
"Minibuffer completion function used by \
\\<evil-insert-state-map>\\[evil-complete-next]."
:type 'function
:group 'evil)
(defcustom evil-complete-previous-minibuffer-func 'minibuffer-complete
"Minibuffer completion function used by \
\\<evil-insert-state-map>\\[evil-complete-previous]."
:type 'function
:group 'evil)
(defcustom evil-complete-next-line-func
#'(lambda (arg)
(let ((hippie-expand-try-functions-list
'(try-expand-line
try-expand-line-all-buffers)))
(hippie-expand arg)))
"Minibuffer completion function used by \
\\<evil-insert-state-map>\\[evil-complete-next-line]."
:type 'function
:group 'evil)
(defcustom evil-complete-previous-line-func
evil-complete-next-line-func
"Minibuffer completion function used by \
\\<evil-insert-state-map>\\[evil-complete-previous-line]."
:type 'function
:group 'evil)
(defcustom evil-lookup-func #'woman
"Lookup function used by \
\"\\<evil-motion-state-map>\\[evil-lookup]\"."
:type 'function
:group 'evil)
(defcustom evil-toggle-key "C-z"
"The key used to change to and from Emacs state.
Must be readable by `read-kbd-macro'. For example: \"C-z\"."
:type 'string
:group 'evil
:set #'(lambda (sym value)
(evil-set-toggle-key value)
(set-default sym value)))
(defcustom evil-default-state 'normal
"The default Evil state.
This is the state a buffer starts in when it is not otherwise
configured (see `evil-set-initial-state' and
`evil-buffer-regexps'). The value may be one of `normal',
`insert', `visual', `replace', `operator', `motion' and `emacs'."
:type 'symbol
:group 'evil)
(defcustom evil-buffer-regexps
'(("^ \\*load\\*" . nil))
"Regular expressions determining the initial state for a buffer.
Entries have the form (REGEXP . STATE), where REGEXP is a regular
expression matching the buffer's name and STATE is one of `normal',
`insert', `visual', `replace', `operator', `motion', `emacs' and
`nil'. If STATE is `nil', Evil is disabled in the buffer."
:type '(alist :key-type string :value-type symbol)
:group 'evil)
(defcustom evil-emacs-state-modes
'(5x5-mode
archive-mode
bbdb-mode
biblio-selection-mode
blackbox-mode
bookmark-bmenu-mode
bookmark-edit-annotation-mode
browse-kill-ring-mode
bs-mode
bubbles-mode
bzr-annotate-mode
calc-mode
cfw:calendar-mode
completion-list-mode
Custom-mode
custom-theme-choose-mode
debugger-mode
delicious-search-mode
desktop-menu-blist-mode
desktop-menu-mode
doc-view-mode
dun-mode
dvc-bookmarks-mode
dvc-diff-mode
dvc-info-buffer-mode
dvc-log-buffer-mode
dvc-revlist-mode
dvc-revlog-mode
dvc-status-mode
dvc-tips-mode
ediff-mode
ediff-meta-mode
efs-mode
Electric-buffer-menu-mode
emms-browser-mode
emms-mark-mode
emms-metaplaylist-mode
emms-playlist-mode
ess-help-mode
etags-select-mode
fj-mode
gc-issues-mode
gdb-breakpoints-mode
gdb-disassembly-mode
gdb-frames-mode
gdb-locals-mode
gdb-memory-mode
gdb-registers-mode
gdb-threads-mode
gist-list-mode
git-rebase-mode
gnus-article-mode
gnus-browse-mode
gnus-group-mode
gnus-server-mode
gnus-summary-mode
gomoku-mode
google-maps-static-mode
ibuffer-mode
jde-javadoc-checker-report-mode
magit-cherry-mode
magit-diff-mode
magit-log-mode
magit-log-select-mode
magit-popup-mode
magit-popup-sequence-mode
magit-process-mode
magit-reflog-mode
magit-refs-mode
magit-revision-mode
magit-stash-mode
magit-stashes-mode
magit-status-mode
mh-folder-mode
monky-mode
mpuz-mode
mu4e-main-mode
mu4e-headers-mode
mu4e-view-mode
notmuch-hello-mode
notmuch-search-mode
notmuch-show-mode
notmuch-tree-mode
occur-mode
org-agenda-mode
package-menu-mode
pdf-outline-buffer-mode
pdf-view-mode
proced-mode
rcirc-mode
rebase-mode
recentf-dialog-mode
reftex-select-bib-mode
reftex-select-label-mode
reftex-toc-mode
sldb-mode
slime-inspector-mode
slime-thread-control-mode
slime-xref-mode
snake-mode
solitaire-mode
sr-buttons-mode
sr-mode
sr-tree-mode
sr-virtual-mode
tar-mode
tetris-mode
tla-annotate-mode
tla-archive-list-mode
tla-bconfig-mode
tla-bookmarks-mode
tla-branch-list-mode
tla-browse-mode
tla-category-list-mode
tla-changelog-mode
tla-follow-symlinks-mode
tla-inventory-file-mode
tla-inventory-mode
tla-lint-mode
tla-logs-mode
tla-revision-list-mode
tla-revlog-mode
tla-tree-lint-mode
tla-version-list-mode
twittering-mode
urlview-mode
vc-annotate-mode
vc-dir-mode
vc-git-log-view-mode
vc-hg-log-view-mode
vc-svn-log-view-mode
vm-mode
vm-summary-mode
w3m-mode
wab-compilation-mode
xgit-annotate-mode
xgit-changelog-mode
xgit-diff-mode
xgit-revlog-mode
xhg-annotate-mode
xhg-log-mode
xhg-mode
xhg-mq-mode
xhg-mq-sub-mode
xhg-status-extra-mode)
"Modes that should come up in Emacs state."
:type '(repeat symbol)
:group 'evil)
(defcustom evil-insert-state-modes
'(comint-mode
erc-mode
eshell-mode
geiser-repl-mode
gud-mode
inferior-apl-mode
inferior-caml-mode
inferior-emacs-lisp-mode
inferior-j-mode
inferior-python-mode
inferior-scheme-mode
inferior-sml-mode
internal-ange-ftp-mode
prolog-inferior-mode
reb-mode
shell-mode
slime-repl-mode
term-mode
wdired-mode)
"Modes that should come up in Insert state."
:type '(repeat symbol)
:group 'evil)
(defcustom evil-motion-state-modes
'(apropos-mode
Buffer-menu-mode
calendar-mode
color-theme-mode
command-history-mode
compilation-mode
dictionary-mode
ert-results-mode
help-mode
Info-mode
Man-mode
speedbar-mode
undo-tree-visualizer-mode
woman-mode)
"Modes that should come up in Motion state."
:type '(repeat symbol)
:group 'evil)
(defvar evil-pending-overriding-maps nil
"An alist of pending overriding maps.")
(defvar evil-pending-intercept-maps nil
"An alist of pending intercept maps.")
(defcustom evil-overriding-maps '()
"Keymaps that should override Evil maps.
Entries have the form (MAP-VAR . STATE), where MAP-VAR is
a keymap variable and STATE is the state whose bindings
should be overridden. If STATE is nil, all states are
overridden."
:type '(alist :key-type symbol :value-type symbol)
:group 'evil
:set #'(lambda (var values)
(set-default var values)
(evil-set-custom-state-maps 'evil-overriding-maps
'evil-pending-overriding-maps
'override-state
'evil-make-overriding-map
values))
:initialize 'evil-custom-initialize-pending-reset)
(add-hook 'after-load-functions #'evil-update-pending-maps)
(defcustom evil-intercept-maps
'((edebug-mode-map . nil))
"Keymaps that should intercept Evil maps.
Entries have the form (MAP-VAR . STATE), where MAP-VAR is
a keymap variable and STATE is the state whose bindings
should be intercepted. If STATE is nil, all states are
intercepted."
:type '(alist :key-type symbol :value-type symbol)
:group 'evil
:set #'(lambda (var values)
(set-default var values)
(evil-set-custom-state-maps 'evil-intercept-maps
'evil-pending-intercept-maps
'intercept-state
'evil-make-intercept-map
values))
:initialize 'evil-custom-initialize-pending-reset)
(defcustom evil-motions
'(back-to-indentation
backward-char
backward-list
backward-paragraph
backward-sentence
backward-sexp
backward-up-list
backward-word
beginning-of-buffer
beginning-of-defun
beginning-of-line
beginning-of-visual-line
c-beginning-of-defun
c-end-of-defun
diff-file-next
diff-file-prev
diff-hunk-next
diff-hunk-prev
down-list
end-of-buffer
end-of-defun
end-of-line
end-of-visual-line
exchange-point-and-mark
forward-char
forward-list
forward-paragraph
forward-sentence
forward-sexp
forward-word
goto-last-change
ibuffer-backward-line
ibuffer-forward-line
isearch-abort
isearch-cancel
isearch-complete
isearch-del-char
isearch-delete-char
isearch-edit-string
isearch-exit
isearch-highlight-regexp
isearch-occur
isearch-other-control-char
isearch-other-meta-char
isearch-printing-char
isearch-query-replace
isearch-query-replace-regexp
isearch-quote-char
isearch-repeat-backward
isearch-repeat-forward
isearch-ring-advance
isearch-ring-retreat
isearch-toggle-case-fold
isearch-toggle-input-method
isearch-toggle-regexp
isearch-toggle-specified-input-method
isearch-toggle-word
isearch-yank-char
isearch-yank-kill
isearch-yank-line
isearch-yank-word-or-char
keyboard-quit
left-char
left-word
mouse-drag-region
mouse-save-then-kill