I want to disable key-binding \C-o on ido-find-file. If I press it generates ^J and completion does not completed so I want to disable it.

I have tried following but it did not work.

(defun ido-common-completion-map ()
  "Add my keybindings for Ido."
  (define-key ido-common-completion-map (kbd "\C-o") 'nil))

(add-hook 'ido-setup-hook #'ido-common-completion-map)

I have followed for ido-wiki and https://emacs.stackexchange.com/a/3730/18414

(defun ido-disable-line-truncation ()
  (set (make-local-variable 'truncate-lines) nil))
(add-hook 'ido-minibuffer-setup-hook #'ido-disable-line-truncation)
(defun ido-define-keys () ;; C-n/p is more intuitive in vertical layout
  (define-key ido-completion-map (kbd "C-n") 'ido-next-match)
  (define-key ido-completion-map (kbd "C-p") 'ido-prev-match))
(add-hook 'ido-setup-hook 'ido-define-keys)

Please follow same approach which I mention in https://emacs.stackexchange.com/a/55607/8426

call helpful-function ido-find-file

It opens clickable bufferm In this buffer, you have to click C-o than you will learn which key-map that you are interacting.

Next screen after click will tell you which in which map that you have to change.

Big possible answer is for you(This keybinding somehow was not defined in my emacs I am not sure):

(define-key ido-buffer-completion-map (kbd "\C-o") nil)
(define-key ido-file-completion-map (kbd "\C-o") nil)

That key is defined on ido-file-completion-map.

  • You might want to expand a bit for the benefit of those readers for whom the implications of what you say aren't obvious. – Stefan Jul 24 '20 at 16:21
  • I have tired (defun ido-common-completion-map () "Add my keybindings for Ido." (define-key ido-file-completion-map (kbd "\C-o") 'nil)) which did not work as well @db48x – alper Jul 26 '20 at 23:35
  • Try to simplify your configuration by getting rid of the hook. Just put (define-key ido-file-completion-map (kbd "\C-o") 'nil)) alone into your init file. You can also debug this by putting (lookup-key ido-file-completion-map (kbd "\C-o")) into your *scratch* buffer, then typing C-x e to run it. By default it'll return ido-copy-current-word, but if you've successfully rebound the key, it'll return what you rebound it to. – db48x Jul 27 '20 at 1:23

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.