Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTerm compatability #1332

Open
russell opened this issue Jun 14, 2021 · 5 comments
Open

VTerm compatability #1332

russell opened this issue Jun 14, 2021 · 5 comments

Comments

@russell
Copy link

russell commented Jun 14, 2021

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.

@russell
Copy link
Author

russell commented Jun 14, 2021

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.

@bbatsov
Copy link
Owner

bbatsov commented Jun 15, 2021

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.

@termlen0
Copy link

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

@Artefact2
Copy link

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
Copy link

stale bot commented Apr 16, 2022

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!

@stale stale bot added the stale label Apr 16, 2022
@bbatsov bbatsov added the Bug label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants