bling / fzf.el

A front-end for fzf
GNU General Public License v3.0
364 stars 49 forks source link

Map ESC for FZF window? #45

Closed Chandlercjy closed 5 years ago

Chandlercjy commented 5 years ago

Hi,

Though the question has been asked: https://github.com/bling/fzf.el/issues/10

I still don't know how to map?

Besides, I use evil-mode, I found that if I press ESC in FZF window, it will turn to evil-normal-mode.

Could you give me more detail? Thank you!

tttuuu888 commented 5 years ago

Below code is working for me. I hope this would be helpful.

  (require 'term)
  (defun term-send-esc ()
    "Send ESC in term mode."
    (interactive)
    (term-send-raw-string "\e"))
  ;; to quit fzf with ESC key
  (define-key term-raw-map (kbd "<escape>") 'term-send-esc)
Chandlercjy commented 5 years ago

Thank you! But it doesn't work for me. Maybe it's because I use evil-mode.

Do you use evil-mode too?

tttuuu888 commented 5 years ago

I use evil-mode too. I didnt mention it, but it only woks on GUI emacs. Please check this link when it comes to the terminal, if you use emacs on terminal.

Chandlercjy commented 5 years ago

Thank you! Though it doesn't work, I may try to get used to C-g :<

tttuuu888 commented 5 years ago

I think I also had to mention this. Your case maybe has to do with evil-state. I also had to set initial state of term mode to emacs-state so that I can cancel fzf with ESC key. Please try to add below code as well. (evil-set-initial-state 'term-mode 'emacs)

Chandlercjy commented 5 years ago

Finally, it works!!! Thank you sooooooo much!

tttuuu888 commented 5 years ago

Good to hear that! I'm glad it's been helpful.