bbatsov/prelude

VTerm compatability

russell opened this issue · 5 comments

Is your feature request related to a problem? Please describe.

prelude-mode overrides the behavior of C-a among other bindings which makes vterm not work. The terminal never receives the key press,

This is because the prelude-mode bindings are implemented in a global minor mode that takes precedence over the vterm major-mode bindings.

Describe the solution you'd like

The real solution i want is to be able to use vterm without losing the C-c p binding.

By far the least impacting to prelude-mode is to do something like the option 3 below, then i can make a minor mode only used in vterm that has the global keys i want from the prelude map, like projectile-command-map.

Describe alternatives you've considered

  1. Remove the offending crux keybindings from the prelude-mode global map

  2. Clone the keymap, make it buffer local and remove any offending keys. https://stackoverflow.com/questions/13102494/buffer-locally-overriding-minor-mode-key-bindings-in-emacs

  3. Add logic so we can make it possible to disable the prelude-mode in some buffers, global-smart-tab-mode does it this way using define-globalized-minor-mode https://github.com/genehack/smart-tab/blob/master/smart-tab.el#L207-L230

  4. Disable prelude mode, make my own custom keymap for the same thing.

OK, i have hacked around this issue by creating my own modes for the time being

;; define minor mode
(define-minor-mode rs-edit-mode
  "Minor mode to consolidate Emacs Rs-Edit extensions.

\\{rs-edit-mode-map}"
  :lighter " RS-ED"
  :keymap rs-edit-mode-map)

(defcustom rs-mode-disabled-major-modes '(vterm-mode term-mode eshell-mode shell-mode)
  "List of major modes that should not use `rs-edit-mode'."
  :type 'sexp)

(defun rs-edit-mode-on ()
  (unless (member major-mode rs-mode-disabled-major-modes)
    (rs-edit-mode)))

;;;###autoload
(define-globalized-minor-mode global-rs-edit-mode
  rs-edit-mode
  rs-edit-mode-on)

But we could change the way the global prelude mode is initialised to be more like this if we want to allow it to support being disabled in some modes, but on by default.

Perhaps we can move this keybinding (or prelude-mode) to text-mode and prog-mode hooks only? Seems like a simple enough solution, although one can argue that many of the commands there are useful in any context.

I think it would be a good idea to move prelude-mode rather than just this keybinding.

Here's a work-around simple enough for me to understand:

(define-key prelude-mode-map (kbd "C-a") nil)
(define-key prog-mode-map (kbd "C-a") 'crux-move-beginning-of-line)
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!