Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Add a F# module.
* Auto-install `use-package`.
* Add `prelude-vertico` module. Vertico a simpler alternative to `ivy-mode` and supersedes Selectrum.
* Disable windmove in org mode buffers.

### Changes

Expand Down
2 changes: 2 additions & 0 deletions modules/prelude-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
(define-key newmap (kbd "C-c -") nil)
(define-key newmap (kbd "C-a") 'org-beginning-of-line)
(make-local-variable 'minor-mode-overriding-map-alist)
;; windmove bindings clash badly with org mode, so disable them in org mode buffers
(windmove-mode -1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a global minor mode, so you'll disable it everywhere, not just in org-mode with this approach.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I overlooked that, sorry.

So I think there's not a straightforward way to do this, but it will have to be done by manually overriding the keybindings that windmove has installed, by poking into its code and seeing what they are. That's a shame. 😢

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few alternative suggestions how to solve this here https://www.reddit.com/r/orgmode/comments/kyj1zi/using_windmove_with_meta_and_orgmode_conflicts/, but indeed there's no very simple solution.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a solution suggested by org-mode's team here https://orgmode.org/manual/Conflicts.html

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should close this PR or adapt to consider this:

;; Make windmove work in Org mode:
(add-hook 'org-shiftup-final-hook 'windmove-up)
(add-hook 'org-shiftleft-final-hook 'windmove-left)
(add-hook 'org-shiftdown-final-hook 'windmove-down)
(add-hook 'org-shiftright-final-hook 'windmove-right)

(push `(prelude-mode . ,newmap) minor-mode-overriding-map-alist))
)

Expand Down