Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind C-z in evil mode to escape to shell

In Emacs evil mode, the key combo C-z is to toggle evil mode. I would like to rebind it to escape to shell instead. How would I do this ?

I have read about eshell, it seems to be great, but for now I would like to work with my zsh shell first.

Multi term seems to designed for this job, but I think escaping to shell is fine for me, since I'm used to this flow in Vim.

Thanks for reading.

like image 674
Dzung Nguyen Avatar asked Oct 31 '14 02:10

Dzung Nguyen


2 Answers

Perhaps what you need is C-x C-z.

like image 159
Yuxiang Yang Avatar answered Oct 22 '22 20:10

Yuxiang Yang


Just have the same requirement, and here's my configurations:

(add-to-list 'load-path "~/.emacs.d/evil")
(add-to-list 'load-path "~/.emacs.d/evil/lib")
(setq evil-toggle-key ""); remove default evil-toggle-key C-z, manually setup later
(require 'evil)
(evil-mode 1)

;; remove all keybindings from insert-state keymap, use emacs-state when editing
(setcdr evil-insert-state-map nil)

;; ESC to switch back normal-state
(define-key evil-insert-state-map [escape] 'evil-normal-state)

Ref: 1. https://gist.github.com/kidd/1828878
2. https://askubuntu.com/questions/99160/how-to-remap-emacs-evil-mode-toggle-key-from-ctrl-z

like image 43
Jason Chen Avatar answered Oct 22 '22 21:10

Jason Chen