Discovering the Mini Scope
The concept of the mini
scope is geared towards handling single-line inputs. Instances like the "Find" or "Find in Project" panels utilize mini
editors to receive input. By using the selector not([mini])
, you can exclude these mini editors, ensuring that your binding only affects code editor windows/panes.
In practical terms for this scenario, it may not have a substantial impact since mini editors typically do not respond to actions like page-up
or page-down
. However, adhering to proper scoping practices for key bindings is considered a good habit rather than applying them globally.
Understanding Selectors
A suitable selector you already possess (atom-text-editor:not([mini])
). Your question touched on additional selectors such as atom-workspace
and ::shadow
. While I lack a thorough explanation of ::shadow
, you may delve further into it including resources like this link.
atom-text-editor
is scoped to text editor panes while atom-workspace
has a broader scope encompassing the entire window, possibly including elements like the tree view, tabs, and status bars.
Anatomy of a Key Binding
To create a key binding, there are three essential components:
- A selector defining where the binding applies. This was addressed in your query:
atom-text-editor:not([mini])
- The specific key bindings to use, documented in Atom's documentation. For this case,
alt-up
and alt-down
are required.
- An Atom command corresponding to each key binding.
Navigating Atom Commands
Utilizing the Command Palette
You can access all Atom commands through the Command Palette (CmdShiftP). Upon searching for terms like "page", relevant commands like "Core: Page Up" and "Core: Page Down" will appear. To convert these into usable commands, follow these steps:
Remove the space after the colon
Replace spaces with hyphens
Lowercase all characters
This transformation results in core:page-up
and core:page-down
.
Using the Key Binding Resolver
If you wish to remap a command linked to one key to another key, you can leverage Atom's Key Binding Resolver. Pressing Cmd. will activate the resolver, indicating which command each keypress corresponds to. In this case, pressing PageUp or PageDown reveals the associated core:page-up
and core:page-down
commands.
Implementing Your Keymap
Access Atom's preferences to click "Open Config Folder," opening a new editor window loaded with the config folder contents. Within the keymap.cson
file, include your new keymap like so:
'atom-text-editor:not([mini])':
'alt-up': 'core:page-up'
'alt-down': 'core:page-down'
Save the file, and your updated keymap should take effect immediately.