forked from emacs-evil/evil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evil-vars.el
1837 lines (1572 loc) · 58.7 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
;; Author: Vegard Øye <vegard_oye at hotmail.com>
;; Maintainer: Vegard Øye <vegard_oye at hotmail.com>
;; Version: 1.2.12
;;
;; 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.")
;;; 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
"Whether to auto-indent when entering Insert state."
:type 'boolean
:group 'evil)
(make-variable-buffer-local 'evil-auto-indent)
(defcustom evil-shift-width 4
"The offset used by \\<evil-normal-state-map>\\[evil-shift-right] \
and \\[evil-shift-left]."
:type 'integer
:group 'evil)
(make-variable-buffer-local 'evil-shift-width)
(defcustom evil-shift-round t
"Whether \\<evil-normal-state-map>\\[evil-shift-right] \
and \\[evil-shift-left] round 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
"If non-nil `evil-indent' 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
"Whether \"\\<evil-normal-state-map>\\[evil-repeat]\" \
moves the cursor."
:type 'boolean
:group 'evil)
(defcustom evil-cross-lines nil
"Whether motions may cross newlines."
: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."
:type 'boolean
:group 'evil)
(defcustom evil-move-beyond-eol nil
"Whether the cursor is allowed to move past the last character of \
a line."
: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
"Whether left/right motions signal errors during keyboard-macro definition.
If this variable is set to non-nil, then the function
`evil-forward-char' and `evil-backward-char' do not signal
`end-of-line' or `beginning-of-line' errors when a keyboard macro
is being defined and/or it is being executed. This may be desired
because such an error would cause the macro definition/execution
being terminated."
: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
"If non-nil line moves after a call to `evil-end-of-line' stay at eol.
This is analogous to `track-eol' but deals with the end-of-line
interpretation of evil."
:type 'boolean
:group 'evil)
(defcustom evil-mode-line-format 'before
"The position of the mode line tag.
Either a symbol or a cons-cell. If it is a symbol it should be
one of 'before, 'after or 'nil. 'before means the tag is
placed before the mode-list, 'after means it is placed after the
mode-list, and 'nil means no mode line tag. If it is a cons cell
it should have the form (WHERE . WHICH) where WHERE is either
'before or 'after and WHICH is a symbol in
`mode-line-format'. The tag is then placed right before or after
that symbol."
: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 characters to be considered as a big word.
This should be a regexp set without the enclosing []."
:type 'string
:group 'evil)
(make-variable-buffer-local 'evil-bigword)
(defcustom evil-want-fine-undo nil
"Whether actions like \"cw\" are undone in several steps.
There are three possible choices. \"No\" means all changes made
during insert state including a possible delete after a change
operation are collected in a single undo step. If \"Yes\" is
selected, undo steps are determined according to Emacs heuristics
and no attempt is made to further aggregate changes.
As of 1.2.13, the option \"fine\" is ignored and means the same
thing as \"No\". It used to be the case that fine would only try
to merge the first two changes in an insert operation. For
example, merging the delete and first insert operation after
\"cw\", but 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
"Whether to use regular expressions for searching."
:type 'boolean
:group 'evil)
(defcustom evil-search-wrap t
"Whether search wraps around."
:type 'boolean
:group 'evil)
(defcustom evil-flash-delay 2
"Time in seconds to flash search matches."
:type 'number
:group 'evil)
(defcustom evil-fold-level 0
"Default fold level."
:type 'integer
:group 'evil)
(defcustom evil-auto-balance-windows t
"If non-nil creating/deleting a window causes a rebalance."
: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 vsplit windows are created to the right."
:type 'boolean
:group 'evil)
(defcustom evil-esc-delay 0.01
"Time in seconds to wait for another key after 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 ESC key.
In terminal, a plain ESC key and a meta-key-sequence both
generate the same event. In order to distinguish both evil
modifies `input-decode-map'. This is necessary in terminal but
not in X mode. However, the terminal ESC is equivalent to C-[, so
if you want to use C-[ instead of ESC in X, then Evil must
intercept the ESC event in X, too. This variable determines when
Evil should intercept the event."
: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 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 `evil-visual-paste' adds the replaced text to the kill
ring, making it the default for the next paste. The default, t,
replicates the default vim behavior."
:type 'boolean
:group 'evil)
(defcustom evil-want-C-i-jump t
"Whether \"C-i\" jumps forward like in 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-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 like in 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-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 like in 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-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-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."
:group 'evil
:type 'boolean
:initialize #'evil-custom-initialize-pending-reset
:set #'(lambda (sym value)
(evil-add-command-properties
'evil-yank-line
:motion (if value 'evil-end-of-line 'evil-line))))
(defcustom evil-disable-insert-state-bindings nil
"Whether insert state bindings should be used. Excludes
bindings for escape, delete and `evil-toggle-key'."
:group 'evil
:type 'boolean
:initialize #'evil-custom-initialize-pending-reset
:set #'evil-update-insert-state-bindings)
(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
"Whether completion looks for matches in all buffers."
:type 'boolean
:group 'evil)
(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 state.
This is the state a mode comes up in when it is not listed
in `evil-emacs-state-modes', `evil-insert-state-modes' or
`evil-motion-state-modes'. 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 expression 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
'(archive-mode
bbdb-mode
biblio-selection-mode
bookmark-bmenu-mode
bookmark-edit-annotation-mode
browse-kill-ring-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
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-commit-mode
git-rebase-mode
gnus-article-mode
gnus-browse-mode
gnus-group-mode
gnus-server-mode
gnus-summary-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
;; Obsolete as of Magit v2.1.0
magit-mode
magit-branch-manager-mode
magit-commit-mode
magit-key-mode
magit-rebase-mode
magit-wazzup-mode
;; end obsolete
mh-folder-mode
monky-mode
mu4e-main-mode
mu4e-headers-mode
mu4e-view-mode
notmuch-hello-mode
notmuch-search-mode
notmuch-show-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
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
'((Buffer-menu-mode-map . nil)
(color-theme-mode-map . nil)
(comint-mode-map . nil)
(compilation-mode-map . nil)
(grep-mode-map . nil)
(dictionary-mode-map . nil)
(ert-results-mode-map . motion)
(Info-mode-map . motion)
(speedbar-key-map . nil)
(speedbar-file-key-map . nil)
(speedbar-buffers-key-map . nil))
"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)
(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)
(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
mouse-set-point
mouse-set-region
mwheel-scroll
move-beginning-of-line
move-end-of-line
next-error
next-line
paredit-backward
paredit-backward-down
paredit-backward-up
paredit-forward
paredit-forward-down
paredit-forward-up
pop-global-mark
pop-tag-mark
pop-to-mark-command
previous-error
previous-line
right-char
right-word
scroll-down
scroll-down-command
scroll-up
scroll-up-command
sgml-skip-tag-backward
sgml-skip-tag-forward
up-list)
"Non-Evil commands to initialize to motions."
:type '(repeat symbol)
:group 'evil
:set 'evil-set-custom-motions
:initialize 'evil-custom-initialize-pending-reset)
(defcustom evil-visual-newline-commands
'(LaTeX-section
TeX-font)
"Commands excluding the trailing newline of a Visual Line selection.
These commands work better without this newline."
:type '(repeat symbol)
:group 'evil
:set 'evil-set-visual-newline-commands
:initialize 'evil-custom-initialize-pending-reset)
(defcustom evil-want-visual-char-semi-exclusive nil
"Visual character selection to beginning/end of line is exclusive.
If non nil then an inclusive visual character selection which
ends at the beginning or end of a line is turned into an
exclusive selection. Thus if the selected (inclusive) range ends
at the beginning of a line it is changed to not include the first
character of that line, and if the selected range ends at the end
of a line it is changed to not include the newline character of
that line."
:type 'boolean
:group 'evil)
(defcustom evil-text-object-change-visual-type t
"Text objects change the current visual state type.
If non-nil then a text-object changes the type of the visual state to
its default selection type (e.g. a word object always changes to
charwise visual state). Otherwise the current visual state type is
preserved."
:type 'boolean
:group 'evil)
(defgroup evil-cjk nil
"CJK support"
:prefix "evil-cjk-"
:group 'evil)
(defcustom evil-cjk-emacs-word-boundary nil
"Determine word boundary exactly the same way as Emacs does."
:type 'boolean
:group 'evil-cjk)
(defcustom evil-cjk-word-separating-categories
'(;; Kanji
(?C . ?H) (?C . ?K) (?C . ?k) (?C . ?A) (?C . ?G)
;; Hiragana
(?H . ?C) (?H . ?K) (?H . ?k) (?H . ?A) (?H . ?G)
;; Katakana
(?K . ?C) (?K . ?H) (?K . ?k) (?K . ?A) (?K . ?G)
;; half-width Katakana
(?k . ?C) (?k . ?H) (?k . ?K) ; (?k . ?A) (?k . ?G)
;; full-width alphanumeric