In buffer list/menu, the key "f" is supposed to open the buffer the cursor is on in the same window as the buffer list. That's what help on the mode says, anyway. In evil mode, this doesn't work, presumably because "f" has a special meaning in vi, so using it for opening a buffer is overridden.
I believe the function that opens a buffer in the current window is buffer-menu-this-window
(as opposed to buffer-menu-other-window
, which is bound to "o"). I don't care what key buffer-menu-this-window
will be bound to, but I want to bind it to some key combination. I tried putting each of these (separately), and a few other variations in .emacs:
(evil-define-key 'normal 'global "c" 'buffer-menu-this-window)
(evil-define-key 'normal buffer-menu-mode-map "c" (lambda () (interactive (buffer-menu-this-window))))
However, when I am in a buffer list and I type "c", I get the message "c is undefined".
How can I create a binding that will open a buffer in the same window as the buffer list. (I can do this currently using the Buffer Menu, but it's something that I will do a lot, so I'd rather give it a key binding.)
Additional information in response to @Ian's question:
I'm not loading any evil-mode based packages, but I load agda mode (for the programming language Agda), and therefore whatever it loads. Is that a likely source of the problem? I'm not loading anything else as far as I know. Here are excepts from my .emacs that seem relevant:
(require 'evil)
(evil-mode 1)
; ...
(load-file (let ((coding-system-for-read 'utf-8))
(shell-command-to-string "agda-mode locate")))
That last line generates a path to a file agda2.el, whose contents are:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Agda mode code which should run before the first Agda file is
;; loaded
;; SPDX-License-Identifier: MIT License
(defvar agda2-directory (file-name-directory load-file-name)
"Path to the directory that contains agda2.el(c).")
(add-to-list 'load-path (or agda2-directory (car load-path)))
(autoload 'agda2-mode "agda2-mode"
"Major mode for editing Agda files (version ≥ 2)." t)
(add-to-list 'auto-mode-alist '("\\.l?agda\\'" . agda2-mode))
(modify-coding-system-alist 'file "\\.l?agda\\'" 'utf-8)
(provide 'agda2)
I don't yet understand what files are being loaded by the code in agda2.el.
evil
did you installed up to now?