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?

2
  • 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 1, 2021 at 5: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 1, 2021 at 5:50

2 Answers 2

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

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)

Not the answer you're looking for? Browse other questions tagged or ask your own question.