Top Related Projects
Emacs Mini-Buffer Actions Rooted in Keymaps
Jump to things in Emacs tree-style
The extensible vi layer for Emacs.
Project Interaction Library for Emacs
Modular in-buffer completion framework for Emacs
Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
Quick Overview
Ace-window is an Emacs package that provides a quick and efficient way to switch between windows in Emacs. It assigns a unique letter to each window and allows users to jump to a specific window by pressing the corresponding key, making window navigation faster and more intuitive.
Pros
- Significantly speeds up window navigation in Emacs
- Customizable appearance and behavior
- Integrates well with other Emacs packages
- Lightweight and easy to use
Cons
- May require some time to get used to the new navigation method
- Can be less useful for setups with only a few windows
- Some users might prefer traditional window switching methods
Code Examples
- Basic window switching:
(ace-window)
This command activates ace-window, allowing you to switch to a window by pressing its assigned letter.
- Deleting a window:
(ace-window 4)
This command allows you to delete a window by selecting it with ace-window.
- Swapping windows:
(ace-window 2)
This command lets you swap the positions of two windows using ace-window.
Getting Started
To use ace-window, follow these steps:
- Install the package using your preferred method (e.g., package.el, use-package)
- Add the following to your Emacs configuration:
(require 'ace-window)
(global-set-key (kbd "M-o") 'ace-window)
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
This sets up ace-window and binds it to the "M-o" key combination. You can customize the key binding and the letters used for window selection as needed.
Competitor Comparisons
Emacs Mini-Buffer Actions Rooted in Keymaps
Pros of Embark
- More versatile, offering context-sensitive actions for various Emacs objects
- Provides a unified interface for many different types of actions
- Extensible with custom actions and integrations
Cons of Embark
- Steeper learning curve due to its broader functionality
- May be overkill for users who only need window management features
- Requires more configuration to fully utilize its capabilities
Code Comparison
Ace-window:
(global-set-key (kbd "M-o") 'ace-window)
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
Embark:
(global-set-key (kbd "C-,") 'embark-act)
(global-set-key (kbd "C-.") 'embark-dwim)
(setq prefix-help-command #'embark-prefix-help-command)
Summary
Ace-window is a focused tool for efficient window management in Emacs, while Embark is a more comprehensive package that provides context-sensitive actions for various Emacs objects. Ace-window excels in simplicity and ease of use for window navigation, whereas Embark offers a wider range of functionality at the cost of increased complexity. The choice between the two depends on whether you need a dedicated window management solution or a more versatile action dispatcher for various Emacs operations.
Jump to things in Emacs tree-style
Pros of avy
- More versatile, allowing for navigation beyond just windows
- Offers a wider range of navigation commands (e.g., goto-char, goto-line)
- Can be used for text selection and manipulation
Cons of avy
- Steeper learning curve due to more complex functionality
- May require more keystrokes for simple window switching tasks
- Configuration can be more involved for optimal use
Code Comparison
avy:
(avy-goto-char ?a)
(avy-goto-line)
(avy-copy-line)
ace-window:
(ace-window 1)
(ace-swap-window)
(ace-delete-window)
Key Differences
- Scope: avy focuses on general navigation within buffers, while ace-window specializes in window management
- Functionality: avy offers more diverse commands for text navigation and manipulation, whereas ace-window provides streamlined window operations
- Ease of use: ace-window is generally simpler for basic window switching, while avy offers more power at the cost of complexity
Use Cases
- Choose avy for comprehensive in-buffer navigation and text manipulation
- Opt for ace-window when primarily focused on efficient window management and switching
Both projects are maintained by the same developer (abo-abo) and can be used complementarily in an Emacs configuration to enhance overall navigation and window management capabilities.
The extensible vi layer for Emacs.
Pros of evil
- Provides a comprehensive Vim emulation layer for Emacs
- Offers a more familiar editing experience for Vim users
- Includes a wide range of Vim-like commands and motions
Cons of evil
- Steeper learning curve for users not familiar with Vim
- May conflict with some native Emacs keybindings
- Requires more configuration to integrate with certain Emacs packages
Code comparison
ace-window:
(defun aw-switch-to-window (window)
"Switch to the window WINDOW."
(let ((frame (window-frame window)))
(when (and (frame-live-p frame)
(not (eq frame (selected-frame))))
(select-frame-set-input-focus frame))
(if (window-live-p window)
(select-window window)
(error "Got a dead window %S" window))))
evil:
(evil-define-command evil-window-next (count)
"Move the cursor to the next window in the cyclic order.
With COUNT go to the count-th window in the order starting from
top-left."
:repeat nil
(interactive "P")
(dotimes (_ (or count 1))
(select-window (next-window))))
The ace-window code focuses on switching to a specific window, while the evil code implements a Vim-like command for cycling through windows. evil's approach is more aligned with Vim's modal editing philosophy, whereas ace-window provides a more Emacs-native window management solution.
Project Interaction Library for Emacs
Pros of Projectile
- Broader scope: Manages projects and provides project-wide operations
- Extensive feature set: File navigation, search, and project management tools
- Integration with various version control systems and build tools
Cons of Projectile
- Steeper learning curve due to more complex functionality
- Potentially heavier resource usage for large projects
- May require additional configuration for optimal performance
Code Comparison
Projectile (project file navigation):
(projectile-find-file)
(projectile-switch-project)
(projectile-grep)
Ace-window (window management):
(ace-window)
(ace-delete-window)
(ace-swap-window)
Key Differences
- Scope: Projectile focuses on project management, while Ace-window specializes in window navigation
- Functionality: Projectile offers project-wide operations, whereas Ace-window enhances window switching and manipulation
- Use case: Projectile is ideal for developers working on multiple projects, while Ace-window benefits users who frequently switch between windows
Conclusion
Projectile and Ace-window serve different purposes in Emacs. Projectile is a comprehensive project management tool, while Ace-window streamlines window navigation. The choice between them depends on the user's specific needs and workflow preferences.
Modular in-buffer completion framework for Emacs
Pros of company-mode
- Provides comprehensive auto-completion functionality for various programming languages and modes
- Highly customizable with a wide range of configuration options
- Integrates well with other Emacs packages and can be extended with backends
Cons of company-mode
- May have a steeper learning curve due to its extensive features and configuration options
- Can potentially slow down Emacs performance if not configured properly, especially with many backends enabled
Code comparison
company-mode:
(use-package company
:config
(setq company-idle-delay 0.3)
(global-company-mode 1))
ace-window:
(use-package ace-window
:bind ("M-o" . ace-window)
:config
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))
Key differences
- Purpose: company-mode focuses on auto-completion, while ace-window is for efficient window navigation
- Scope: company-mode is a global minor mode affecting text editing, whereas ace-window is a command for window management
- Complexity: company-mode is more complex with various backends and configuration options, while ace-window is simpler and more focused on a single task
Both packages are popular and well-maintained, but they serve different purposes in an Emacs configuration. company-mode enhances the coding experience with intelligent auto-completion, while ace-window improves window navigation efficiency.
Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
Pros of Swiper
- Provides powerful and flexible search capabilities across various Emacs buffers and files
- Offers a visually appealing and interactive interface for searching and navigating
- Includes additional features like counsel and ivy for enhanced functionality
Cons of Swiper
- May have a steeper learning curve due to its extensive feature set
- Can be more resource-intensive, especially on larger projects or codebases
- Might be considered overkill for users who only need simple window management
Code Comparison
Swiper:
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key "\C-s" 'swiper)
Ace-window:
(global-set-key (kbd "M-o") 'ace-window)
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
Summary
While Swiper focuses on powerful search and navigation capabilities, Ace-window specializes in efficient window management. Swiper offers a more comprehensive solution for navigating and searching within Emacs, but may be more complex for new users. Ace-window, on the other hand, provides a simpler and more focused approach to window management, making it easier to adopt for those primarily interested in that functionality.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ace-window
GNU Emacs package for selecting a window to switch to
What and why
I'm sure you're aware of the other-window
command. While it's great
for two windows, it quickly loses its value when there are more windows.
You need to call it many times, and since it's not easily predictable,
you have to check each time if you're in the window that you wanted.
Another approach is to use windmove-left
, windmove-up
, etc. These
are fast and predictable. Their disadvantage is that they need 4 key
bindings. The default ones are shift+arrows, which are hard to reach.
This package aims to take the speed and predictability of windmove
and pack it into a single key binding, similar to other-window
.
Setup
Just assign ace-window
to a short key binding, as switching windows
is a common task. I suggest M-o, as it's short and not
bound to anything important in the default Emacs.
Usage
When there are two windows, ace-window
will call other-window
(unless aw-dispatch-always
is set non-nil). If there are more, each
window will have the first character of its window label highlighted
at the upper left of the window. Pressing that character will either
switch to that window or filter to the next character needed to select
a specific window. Note that, unlike ace-jump-mode
, the position of
point will not be changed, i.e. the same behavior as that of
other-window
.
A special character defined by aw-make-frame-char
(default = z
)
means create a new frame and use its window as the target. The new
frame's location is set relative to the prior selected frame's location
and given by aw-frame-offset
. The new frame's size is given by
aw-frame-size
. See their documentation strings for more information.
The windows are ordered top-down, left-to-right. This means that if you
remember your window layouts, you can switch windows without even
looking at the leading char. For instance, the top left window will
always be 1
(or a
if you use letters for window characters).
ace-window
works across multiple frames, as you can see from the
in-action gif.
Swap and delete window
-
You can swap windows by calling
ace-window
with a prefix argument C-u. -
You can delete the selected window by calling
ace-window
with a double prefix argument, i.e. C-u C-u.
Change the action midway
You can also start by calling ace-window
and then decide to switch the action to delete
or swap
etc. By default the bindings are:
- x - delete window
- m - swap windows
- M - move window
- c - copy window
- j - select buffer
- n - select the previous window
- u - select buffer in the other window
- c - split window fairly, either vertically or horizontally
- v - split window vertically
- b - split window horizontally
- o - maximize current window
- ? - show these command bindings
For proper operation, these keys must not be in aw-keys
. Additionally,
if you want these keys to work with fewer than three windows, you need to
have aw-dispatch-always
set to t
.
Customization
Aside from binding ace-window
:
(global-set-key (kbd "M-o") 'ace-window)
the following customizations are available:
aw-keys
aw-keys
- the list of initial characters used in window labels:
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
aw-keys
are 0-9 by default, which is reasonable, but in the setup
above, the keys are on the home row.
aw-scope
The default one is global
, which means that ace-window
will work
across frames. If you set this to frame
, ace-window
will offer you
only the windows of the current frame.
aw-background
By default, ace-window
temporarily sets a gray background and
removes color from available windows in order to make the
window-switching characters more visible. This is the behavior
inherited from ace-jump-mode
.
This behavior might not be necessary, as you already know the locations where to look, i.e. the top-left corners of each window. So you can turn off the gray background with:
(setq aw-background nil)
aw-dispatch-always
When non-nil, ace-window
will issue a read-char
even for one window.
This will make ace-window
act differently from other-window
for one
or two windows. This is useful to change the action midway and execute
an action other than the default jump action.
By default, this is set to nil
.
aw-dispatch-alist
This is the list of actions you can trigger from ace-window
other than the
jump default. By default it is:
(defvar aw-dispatch-alist
'((?x aw-delete-window "Delete Window")
(?m aw-swap-window "Swap Windows")
(?M aw-move-window "Move Window")
(?c aw-copy-window "Copy Window")
(?j aw-switch-buffer-in-window "Select Buffer")
(?n aw-flip-window)
(?u aw-switch-buffer-other-window "Switch Buffer Other Window")
(?c aw-split-window-fair "Split Fair Window")
(?v aw-split-window-vert "Split Vert Window")
(?b aw-split-window-horz "Split Horz Window")
(?o delete-other-windows "Delete Other Windows")
(?? aw-show-dispatch-help))
"List of actions for `aw-dispatch-default'.")
When using ace-window, if the action character is followed by a string,
then ace-window
will be invoked again to select the target window for
the action. Otherwise, the current window is selected.
aw-minibuffer-flag
When non-nil, also display ace-window-mode
string in the minibuffer
when ace-window
is active. This is useful when there are many
side-by-side windows and the ace-window-mode
string is cutoff in the
minor mode area of the modeline.
aw-ignored-buffers
List of buffers and major-modes to ignore when choosing a window from
the window list. Active only when aw-ignore-on
is non-nil. Windows
displaying these buffers can still be chosen by typing their specific
labels.
aw-ignore-on
When t, ace-window
will ignore buffers and major-modes in
aw-ignored-buffers
. Use M-0 ace-window
to toggle this value.
:type 'boolean)
aw-ignore-current
When t, ace-window
will ignore `selected-window'.
Top Related Projects
Emacs Mini-Buffer Actions Rooted in Keymaps
Jump to things in Emacs tree-style
The extensible vi layer for Emacs.
Project Interaction Library for Emacs
Modular in-buffer completion framework for Emacs
Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot