Next: Introduction [Contents][Index]
swsw provides a minor mode for switching to windows using IDs assigned to them automatically.
This manual is for swsw version 2.3.
Copyright © 2020-2022 Daniel Semyonov
You can redistribute this document and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
• Introduction | ||
• Installation | ||
• Usage | ||
• Customization | ||
• Keystroke Index | ||
• Command Index | ||
• Function Index | ||
• Variable Index | ||
— The Detailed Node Listing — Installation | ||
---|---|---|
• Installing a release | ||
• Installing from the Git repository | ||
Customization | ||
• ID display | ||
• Window commands | ||
Next: Installation, Previous: Top, Up: Top [Contents][Index]
swsw provides a minor mode for switching to windows using IDs assigned to them automatically. It’s implementation is simple and extensible, providing various advanced customization features for users, while keeping the code base small and easy to hack on.
Next: Usage, Previous: Introduction, Up: Top [Contents][Index]
swsw can be installed from NonGNU ELPA:
• Installing a release | ||
• Installing from the Git repository |
Next: Installing from the Git repository, Up: Installation [Contents][Index]
Simply download a release (from <https://dsemy.com/projects/swsw>), and install it:
Previous: Installing a release, Up: Installation [Contents][Index]
Clone the repository and build the package archive:
$ git clone https://git.sr.ht/~dsemy/swsw $ cd swsw $ make
Install the package:
Next: Customization, Previous: Installation, Up: Top [Contents][Index]
In order to use any feature of the package, swsw-mode
must be enabled:
You can also add (swsw-mode)
to your init file, instead.
When swsw-mode
is enabled, window IDs are shown as mode line
lighters of the form <ID>
(by default, See ID display), and
other-window
(C-x o) is remapped to swsw-select
.
Select the window corresponding to ID in the current scope
(See Customization) (swsw-select
).
Delete the window corresponding to ID in the current scope (swsw-delete
).
Make the window corresponding to ID the in the current scope the sole
window of its frame (swsw-delete-other
).
Split the window corresponding to ID in the current scope from below
(swsw-split-window-below
). This window command accepts a
prefix argument (with the same semantics as split-window-below
).
Split the window corresponding to ID in the current scope from the right
(swsw-split-window-right
). This window command accepts a
prefix argument (with the same semantics as split-window-right
).
Display the buffer of the next command in the window corresponding to
ID in the current scope (swsw-delete
).
Swap the states of the current window and the window corresponding to
ID in the current scope (swsw-delete
).
Switch to the minibuffer if it’s active (swsw-select-minibuffer
).
See Window commands for information regarding defining new commands.
Next: Keystroke Index, Previous: Usage, Up: Top [Contents][Index]
All customization, except for defining custom display functions and custom window commands, can be done through the customize interface:
Base set of character from which window IDs are constructed. This should be a
list of characters. By default, the home row (a s d f g h j k l
) is
used.
Scope of all window operations. Used to determine on which frames to track
windows. A value of t
means consider all windows on all frames, 0
(the number zero) means consider all windows on all visible and iconified
frames, visible
means consider all windows on all visible frames and
current
means consider only the currently selected frame. By default,
t
is used.
• ID display | ||
• Window commands |
Next: Window commands, Up: Customization [Contents][Index]
By default, the ID of each tracked window is displayed as a mode line
lighter. This behavior is controlled by swsw-display-lighter
.
Additionally, (custom) display functions could be added to
swsw-mode-hook
. These functions should enable ID display when
swsw-mode
is enabled, and disable ID display when
swsw-mode
is disabled. They can also make use of
swsw-before-command-hook
and swsw-after-command-hook
(see See Window commands) to display IDs only during window
selection. See the description and implementation of
swsw-mode-line-display-function
and
swsw-mode-line-conditional-display-function
below for more
information.
It is also possible to use swsw-format-id
directly in
e.g. mode-line-format
, although details vary depending on how
and where you want the IDs to be displayed.
Whether or not to show a mode line lighter. A non-nil value means show
a mode line lighter. A value of nil
means don’t show a mode
line lighter. By default, t
is used.
Hook run when enabling or disabling swsw-mode
.
Format string for the window ID. Used in the mode line lighter, and
display functions may use this format string to display the ID, but
they can also ignore it. The string should contain a single occurrence
of %s
, which will be replaced by the ID. By default,
" <%s>"
is used.
Format an ID string (according to swsw-id-format
) for WINDOW.
Reference implementation of a “simple” display function, displaying
window IDs at the beginning of the mode line. Display window IDs if
swsw-mode
is enabled, and disable displaying window IDs if
swsw-mode
is disabled. This display function respects
swsw-id-format
.
Reference implementation of a conditional display function, displaying
window IDs at the beginning of the mode line during window selection.
Add a hook to swsw-before-command-hook
which displays window
IDs on the mode line and add a hook to swsw-after-command-hook
which hides window IDs from the mode line if swsw-mode
is
enabled, and remove those hooks if swsw-mode
is disabled. This
display function respects swsw-id-format
.
Previous: ID display, Up: Customization [Contents][Index]
Window commands are used to perform operations on specific windows,
chosen by their ID (or the next window, if less than
swsw-minimum
(3 by default) windows are currently in scope).
Alternatively, other commands available in swsw-command-map
can
be chosen. Not all commands in swsw-command-map
are window
commands (by default). For more information about included window
commands, See Usage.
Window commands can easily be defined using
swsw-define-window-command
. For more complex use cases,
the lower level swsw-run-window-command
can be used.
Minimum number of tracked windows for which interactive selection
occurs when using window commands. In practice, only window commands
defined using swsw-define-window-command
automatically adhere
to this rule.
Key map which is populated automatically with elements corresponding
to all tracked windows. The ID of each window is converted to a vector
(to serve as a key sequence), and is bound to a command which calls
last-command
with the window corresponding to the ID as the
sole argument. There should be no reason to modify it directly; it is
reset whenever window configuration is updated.
Key map which holds bindings to window commands. This key map is set
as the parent of swsw--id-map
, so all window commands are
available when it’s active (unless they are shadowed by a window ID).
Amount of windows currently tracked, including the minibuffer (if it’s active). It can be used to change the behavior of window commands (or display functions, See ID display).
Define NAME as a window command with DOCSTRING as its documentation string. PREFIX (a symbol) is passed as an argument to the command (when not omitted or nil), with it’s value being the raw prefix argument.
BODY is used as the body of an anonymous function which receives
WINDOW (a symbol) as an argument, with its value being a selected
window. If there are less than swsw-minimum
(3 by default)
windows in the current scope (See Customization), the function is
called with the window returned by next-window
. In this case,
if MINIBUFFER is non-nil, it can be selected if it’s active.
Otherwise, the function is run using swsw-run-window-command
.
Run FUN as a window command. Run swsw-before-command-hook
, set
this-command
to FUN, and set swsw--id-map
as a transient
map which runs swsw-after-command-hook
on exit. The hooks run
by this function are expected by swsw to run for any window command
which requires ID selection; they should be manually added even if
this function isn’t used when defining a new window command.
Next: Command Index, Previous: Customization, Up: Top [Contents][Index]
Jump to: | C |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
C | |||
C-x o : | Usage | ||
C-x o 0 : | Usage | ||
C-x o 1 : | Usage | ||
C-x o 2 : | Usage | ||
C-x o 3 : | Usage | ||
C-x o 4 : | Usage | ||
C-x o m : | Usage | ||
C-x o o : | Usage | ||
C-x o t : | Usage | ||
|
Jump to: | C |
---|
Next: Function Index, Previous: Keystroke Index, Up: Top [Contents][Index]
Jump to: | S |
---|
Jump to: | S |
---|
Next: Variable Index, Previous: Command Index, Up: Top [Contents][Index]
Jump to: | S |
---|
Jump to: | S |
---|
Previous: Function Index, Up: Top [Contents][Index]
Jump to: | S |
---|
Jump to: | S |
---|