0

I've configured Doom emacs to run an interactive evil-ex command in visual mode, the reaconfiguration is as below:

(defun evil-insert-into-lines ()
  (interactive)
  (evil-ex "'<,'>norm I"))

(defun evil-append-to-lines ()
  (interactive)
  (evil-ex "'<,'>norm A"))

(define-key evil-visual-state-map (kbd "C-i") 'evil-insert-into-lines)
(define-key evil-visual-state-map (kbd "C-a") 'evil-append-to-lines)

The second function is invoked both by pressing C-a and C-shift-a (C-A) but the first function only works when I press (C-shift-i). Anyone has any idea what could be the reason?

phils
  • 48,657
  • 3
  • 76
  • 115
Kamyab
  • 41
  • 5
  • 1
    `C-i` is the `TAB` character, so there is probably some kind of conflict happening on that basis. What do `C-h k C-i` and `C-h k C-S-i` report? – phils Jun 01 '21 at 05:45
  • @phils `C-h k C-i` says it's bound to `better jump forward` but `C-S-i` is bound to my function. – Kamyab Jun 01 '21 at 05:50

2 Answers2

0

Spacemacs has a variable to turn on/off translation of C-i under GUI emacs. Perhaps you could try these lines or look for if doom emacs has similar feature provided.

Relevant Code

TerryTsao
  • 1,176
  • 4
  • 18
0

Now I get the idea, C-i is the same thing as TAB character so binding it to a function is a little tricky. this anwer worked for me. Here's the new config:

(define-key input-decode-map (kbd "C-i") (kbd "H-i"))
(define-key evil-visual-state-map (kbd "H-i") 'evil-insert-into-lines)
Kamyab
  • 41
  • 5