I have the following setup for using comments:
(key-chord-define evil-normal-state-map "cc" 'comment-dwim-2)
This works fine. I can type cc to comment it out or comment out.
However, Web-mode works with an another function, because the comment syntax are differrent for languages like javascript or HTML. So I set up following keybinding for only web-mode in my setup:
(evil-define-key 'normal web-mode-map
(kbd "cc") 'web-mode-comment-or-uncomment
)
But with the setup above I cannot use other Evil keybindings like cw or ctf anymore, because the keybinding above disabled them. Any suggestion for a way to use keychord in the evil-define-key
, but for web-mode only? So that I can use another keys with operator c again, in web-mode only.
evil-define-key
is clobbering theevil-change
operator by binding thec
prefix (see analogous discussion in this thread). You probably want to do a mode-specific or buffer-localkey-chord-define
(perhaps in a mode hook).key-chord-define
doesn't have any notion ofnormal-state
andinsert-state
in Evil. This makes it not possible to typingcc
fast in insert state.evil
does, however, have local maps. Not sure if this will work, but try putting the following in yourweb-mode
mode hook:(key-chord-define evil-normal-state-local-map "cc" #'web-mode-comment-or-uncomment)
.evil-normal-state-local-map
is a free variable, that propbably doesn't exist. And I don't see how this could be solving my issue. It's that thecc
does disable thecw
orcì
.