Is there a way to remap the "zc" or "zf" key combo for code folding from evil-mode normal-state to folding-toggle-show-hide?

I tried (define-key evil-normal-state-map "zc" 'folding-toggle-show-hide) without success.

F1 k zc returns:

z c runs the command evil-close-fold, which is an interactive compiled
Lisp function in 'evil-commands.el'.

It is bound to z c.


Close fold at point.
See also 'evil-open-fold'.
  • 1
    "without success" is pretty generic. What happens when you press zc? Do you get an error? Do you get nothing? What does F1 k zc display? – wasamasa Nov 13 '15 at 17:49
  • I edited the question. The issue is that zc is mapped to 'evil-code-fold and I would like to remap it. The above definition did not do any (re)mapping. I also tried to map a not mapped key combination ff to `'folding-toggle-show-hide' but it does not work. – cataclysmic Nov 16 '15 at 8:53
  • Where and at which point in time do you do the remapping? Does it happen in your init file? Does the remapping work if done after init? You should be able to verify the latter by using M-: and the same expression as above. – wasamasa Nov 16 '15 at 9:52
  • The above mentioned define-key argument is the last line of the init file. – cataclysmic Nov 16 '15 at 10:59
  • I managed to assign another key that was not occupied using (define-key evil-normal-state-map "zt" 'folding-toggle-show-hide) – cataclysmic Nov 16 '15 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.