0

I've installed helm and projectile modes and I wanted to restore the previous behaviour of the C-backspace binding to kill whole last word.

In these modes, when looking for a file (after pressing C-x-f), this binding is changed to turn on/off auto expansion (it seems to run the helm-ff-run-toggle-auto-update function).

I've put this in my init.el:

(define-key helm-find-files-map (kbd "<C-backspace>") 'backward-kill-word)
(define-key helm-projectile-find-file-map (kbd "<C-backspace>") 'backward-kill-word)

And when I run describe-variable for helm-find-files-map and helm-projectile-find-file-map they indeed contain the (C-backspace . backward-kill-word) entry.

Unfortunately, pressing C-backspace in helm-find-file still toggles auto expansion instead of deleting the last path entry. How to achieve this?


This is the minimal example of init.el contents that should reproduce this behaviour:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)

(require 'helm)
(require 'helm-config)

(projectile-global-mode)
(setq projectile-completion-system 'helm)
(helm-projectile-on)

(helm-mode 1)

(define-key helm-find-files-map (kbd "<C-backspace>") 'backward-kill-word)
(define-key helm-projectile-find-file-map (kbd "<C-backspace>") 'backward-kill-word)
2

With helm-mode enabled, the ordinary find-file command will use helm-read-file-map, so you should use:

(define-key helm-read-file-map (kbd "<C-backspace>") #'backward-kill-word)

But if you are using helm, helm-find-files provides more features than find-file so you are suggested to use the former.

| improve this answer | |

Your Answer

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

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