Skip to content

Commit e4beea8

Browse files
ndemiancclaude
andcommitted
Atom++ M3: Atom + Notepad++ keymap presets
New keymaps.js in atom-hackability — "Atom++: Apply Keymap Preset" writes a curated preset into keybindings.json (timestamped backup first; VS Code live-reloads, no restart): - Atom: ⌘T finder, ⌘\ tree, ⌘K+arrows splits, ⌘R/⌘⇧R symbols, ⌃⌘↑↓ move lines, ⌘⇧D duplicate — only the bindings that differ from VS Code's mac defaults. - Notepad++: Windows-style Ctrl bindings (Ctrl+D/G/Q/J, F3, Ctrl+Shift+F, …), scoped to the editor so they don't fight macOS navigation. Clears the old M1 keymap leftover. - VS Code default option clears the preset. Docs: CLAUDE.md/PLAN.md note keymap presets; mark M1 fully done. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent bdb01a4 commit e4beea8

5 files changed

Lines changed: 124 additions & 6 deletions

File tree

‎CLAUDE.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ branding/icons/ app icon source PNG, generated .icns, 1024 png
3636
extensions/atom-npp-pack/ Notepad++ power-editing pack (plain JS, no build step)
3737
extensions/atom-ai/ native Claude AI (chat, inline completion, providers, edit-with-diff, LM provider)
3838
extensions/atom-themes/ signature One Dark / One Light themes (JSON, default via configurationDefaults)
39-
extensions/atom-hackability/ user init script (~/.atom-plus-plus/init.js) — runs your code at startup, live-reloadable
39+
extensions/atom-hackability/ user init script (~/.atom-plus-plus/init.js, live-reloadable) + Atom/NPP keymap presets
4040
patches/atom-core.patch our core source edits, applied on bootstrap
4141
scripts/ bootstrap.sh, apply-branding.mjs, run-dev.sh, build-macos.sh, make-dmg.sh, make-icon.sh
4242
vscode/ GITIGNORED upstream Code-OSS checkout (generated)
@@ -119,8 +119,10 @@ big-file mode badge. Files: extension.js + fileOps/lineOps/columnOps/encodingEol
119119
multi-session core effort. We use the diff-tab review instead.
120120
- Built since M2 shipped: inline tab-completion (`inlineComplete.js`), multi-file + auto-retrieval chat context
121121
(`gatherAutoContext`), chat moved to the right side bar, typewriter streaming, `make-dmg.sh` packaging.
122-
- Not yet built: Notepad++ keymap preset (M1 leftover); agentic multi-file tasks (M4); M3 hackability
123-
(settings UI, user init script, package generator, theme studio, settings import).
122+
- M3 so far: One Dark/Light themes (`atom-themes`), user init script + Atom/Notepad++ keymap presets
123+
(`atom-hackability`). The Atom/NPP keymap also clears the old M1 leftover.
124+
- Not yet built: agentic multi-file tasks (M4); remaining M3 hackability — settings UI, package generator +
125+
hot reload, theme studio, VS Code settings import.
124126

125127
## Conventions
126128

‎PLAN.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ Each milestone is a thing you can actually run and judge. Because AI writes most
9191
**M0 — It builds and it's ours (foundation). — ✅ DONE**
9292
Clone/fork Code-OSS, get a reproducible macOS build, replace `product.json` with Atom++ branding, strip MS telemetry, repoint gallery to Open VSX, ship custom icon + title bar. *Exit test: a signed Atom++.app launches on your Mac, installs an extension from Open VSX, and has zero Microsoft branding.* (Plus `make-dmg.sh` for single-file distribution.)
9393

94-
**M1 — Notepad++ power-editing. — ✅ DONE (keymap preset still pending)**
94+
**M1 — Notepad++ power-editing. — ✅ DONE**
9595
Build the Notepad++ Pack: macro record/replay, big-file mode, encoding/EOL controls, column-mode extras, line ops. Add the NPP keymap preset. *Exit test: open a 500 MB log, record a macro to reformat lines, replay it, switch encoding — all smooth.*
9696

9797
**M2 — Native AI core. — ✅ DONE**
9898
Provider abstraction + BYO-key (Claude first), inline completions, codebase chat, accept/reject AI diffs. Direct-to-provider, no backend. *Exit test: tab-complete a function, ask the chat about your repo, refactor a file via AI diff — using your own API key.* Shipped: right-sidebar chat (opens by default), Codex-style composer with typewriter streaming, inline ghost-text completion, multi-file pinning + automatic ripgrep-based context retrieval, native LM provider.
9999

100100
**M3 — Hackability + Atom feel. — 🚧 IN PROGRESS**
101-
Settings UI, user init script, package generator + hot reload, theme studio, One Dark-derived default theme, VS Code/Atom settings import. *Exit test: import your current VS Code setup, write a tiny package, restyle a color live.* Done so far: **Atom++ One Dark / One Light** themes (`extensions/atom-themes/`), built from Atom's MIT palette and set as the default; **user init script** (`extensions/atom-hackability/`) — `~/.atom-plus-plus/init.js` runs your code at startup with an `atompp` API + full `vscode`, live-reloadable without restart.
101+
Settings UI, user init script, package generator + hot reload, theme studio, One Dark-derived default theme, VS Code/Atom settings import. *Exit test: import your current VS Code setup, write a tiny package, restyle a color live.* Done so far: **Atom++ One Dark / One Light** themes (`extensions/atom-themes/`), built from Atom's MIT palette and set as the default; **user init script** (`extensions/atom-hackability/`) — `~/.atom-plus-plus/init.js` runs your code at startup with an `atompp` API + full `vscode`, live-reloadable without restart; **Atom + Notepad++ keymap presets** (apply via "Atom++: Apply Keymap Preset", written to keybindings.json with a backup).
102102

103103
**M4 — Agentic AI + Mac polish + release prep.**
104104
Agentic multi-file tasks with approval gates; native menus, traffic-light polish, cold-start optimization; auto-update channel; final name + original logo + trademark check; first public/personal release. *Exit test: give it a multi-file goal and approve its plan; the app feels native and updates itself.*

‎extensions/atom-hackability/extension.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const os = require('os');
1616
const fs = require('fs');
1717
const path = require('path');
1818
const { createRequire } = require('module');
19+
const { registerKeymaps } = require('./keymaps');
1920

2021
const INIT_DIR = path.join(os.homedir(), '.atom-plus-plus');
2122
const INIT_PATH = path.join(INIT_DIR, 'init.js');
@@ -144,6 +145,7 @@ function activate(context) {
144145
vscode.commands.registerCommand('atompp.init.reload', () => runInit(true)),
145146
{ dispose: disposeUser }
146147
);
148+
registerKeymaps(context);
147149
runInit(false);
148150
}
149151

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Atom++ — Hackability: keymap presets
3+
*
4+
* Apply an Atom or Notepad++ keybinding preset so muscle memory transfers. A preset is
5+
* written into the user's keybindings.json (backed up first); VS Code live-reloads it, so
6+
* no restart is needed. We only override the bindings that DIFFER from the defaults — the
7+
* many shortcuts Atom/NPP already share with VS Code are left untouched.
8+
*--------------------------------------------------------------------------------------------*/
9+
// @ts-check
10+
'use strict';
11+
12+
const vscode = require('vscode');
13+
const fs = require('fs');
14+
const path = require('path');
15+
16+
const EDIT = 'editorTextFocus && !editorReadonly';
17+
18+
// Atom keymap — only the bindings that differ from VS Code's mac defaults.
19+
const ATOM = [
20+
{ key: 'cmd+t', command: 'workbench.action.quickOpen' },
21+
{ key: 'cmd+\\', command: 'workbench.action.toggleSidebarVisibility' },
22+
{ key: 'cmd+k cmd+up', command: 'workbench.action.splitEditorUp' },
23+
{ key: 'cmd+k cmd+down', command: 'workbench.action.splitEditorDown' },
24+
{ key: 'cmd+k cmd+left', command: 'workbench.action.splitEditorLeft' },
25+
{ key: 'cmd+k cmd+right', command: 'workbench.action.splitEditorRight' },
26+
{ key: 'cmd+r', command: 'workbench.action.gotoSymbol' },
27+
{ key: 'cmd+shift+r', command: 'workbench.action.showAllSymbols' },
28+
{ key: 'ctrl+cmd+up', command: 'editor.action.moveLinesUpAction', when: EDIT },
29+
{ key: 'ctrl+cmd+down', command: 'editor.action.moveLinesDownAction', when: EDIT },
30+
{ key: 'cmd+shift+d', command: 'editor.action.copyLinesDownAction', when: EDIT }
31+
];
32+
33+
// Notepad++ keymap — Windows-style Ctrl bindings (scoped to the editor so they don't
34+
// fight macOS text navigation outside it).
35+
const NPP = [
36+
{ key: 'ctrl+d', command: 'editor.action.copyLinesDownAction', when: EDIT },
37+
{ key: 'ctrl+shift+up', command: 'editor.action.moveLinesUpAction', when: EDIT },
38+
{ key: 'ctrl+shift+down', command: 'editor.action.moveLinesDownAction', when: EDIT },
39+
{ key: 'ctrl+g', command: 'workbench.action.gotoLine' },
40+
{ key: 'ctrl+q', command: 'editor.action.commentLine', when: EDIT },
41+
{ key: 'ctrl+shift+q', command: 'editor.action.blockComment', when: EDIT },
42+
{ key: 'ctrl+j', command: 'editor.action.joinLines', when: EDIT },
43+
{ key: 'ctrl+h', command: 'editor.action.startFindReplaceAction', when: 'editorFocus' },
44+
{ key: 'ctrl+shift+f', command: 'workbench.action.findInFiles' },
45+
{ key: 'f3', command: 'editor.action.nextMatchFindAction', when: 'editorFocus' },
46+
{ key: 'shift+f3', command: 'editor.action.previousMatchFindAction', when: 'editorFocus' },
47+
{ key: 'ctrl+w', command: 'workbench.action.closeActiveEditor' }
48+
];
49+
50+
const PRESETS = {
51+
atom: { label: 'Atom', bindings: ATOM, note: '' },
52+
npp: { label: 'Notepad++', bindings: NPP, note: 'Uses Windows-style Ctrl bindings — they apply inside the editor, so macOS Ctrl text-navigation still works elsewhere.' },
53+
default: { label: 'VS Code default', bindings: [], note: 'Cleared the preset — your keybindings.json is now empty (defaults apply).' }
54+
};
55+
56+
/** keybindings.json lives next to globalStorage, two levels up: <userData>/User/keybindings.json */
57+
function keybindingsPath(context) {
58+
const userDir = path.dirname(path.dirname(context.globalStorageUri.fsPath));
59+
return { userDir, file: path.join(userDir, 'keybindings.json') };
60+
}
61+
62+
/** @param {vscode.ExtensionContext} context */
63+
async function applyKeymap(context) {
64+
/** @type {any[]} */
65+
const items = [
66+
{ label: '$(star) Atom', description: '⌘T finder · ⌘\\ tree · ⌃⌘↑↓ move lines · ⌘R symbols · ⌘⇧D duplicate', _key: 'atom' },
67+
{ label: '$(keyboard) Notepad++', description: 'Windows-style Ctrl bindings (Ctrl+D, Ctrl+G, Ctrl+Q, F3, …)', _key: 'npp' },
68+
{ label: '$(discard) VS Code default', description: 'Clear the preset (empty keybindings.json)', _key: 'default' }
69+
];
70+
const pick = await vscode.window.showQuickPick(items, {
71+
placeHolder: 'Apply a keymap preset — overwrites keybindings.json (a backup is saved first)'
72+
});
73+
if (!pick) { return; }
74+
const preset = PRESETS[pick._key];
75+
76+
const proceed = await vscode.window.showWarningMessage(
77+
`Apply the ${preset.label} keymap? This replaces your keybindings.json. A timestamped backup is saved first.`,
78+
{ modal: true }, 'Apply'
79+
);
80+
if (proceed !== 'Apply') { return; }
81+
82+
const { userDir, file } = keybindingsPath(context);
83+
try {
84+
fs.mkdirSync(userDir, { recursive: true });
85+
// Back up any existing non-empty keybindings.
86+
if (fs.existsSync(file)) {
87+
const cur = fs.readFileSync(file, 'utf8').trim();
88+
if (cur && cur !== '[]') {
89+
fs.copyFileSync(file, path.join(userDir, 'keybindings.backup-' + Date.now() + '.json'));
90+
}
91+
}
92+
const header = '// Atom++ — ' + preset.label + ' keymap preset.\n' +
93+
'// Applied via "Atom++: Apply Keymap Preset". Edit freely; re-apply any time.\n';
94+
fs.writeFileSync(file, header + JSON.stringify(preset.bindings, null, 2) + '\n', 'utf8');
95+
} catch (e) {
96+
vscode.window.showErrorMessage('Atom++: could not write keybindings.json: ' + ((e && e.message) || e));
97+
return;
98+
}
99+
100+
const open = 'Open Keybindings';
101+
const msg = `Atom++: applied the ${preset.label} keymap.` + (preset.note ? ' ' + preset.note : '');
102+
vscode.window.showInformationMessage(msg, open).then((c) => {
103+
if (c === open) { vscode.commands.executeCommand('workbench.action.openGlobalKeybindingsFile'); }
104+
});
105+
}
106+
107+
function registerKeymaps(context) {
108+
context.subscriptions.push(
109+
vscode.commands.registerCommand('atompp.keymap.apply', () => applyKeymap(context))
110+
);
111+
}
112+
113+
module.exports = { registerKeymaps };

‎extensions/atom-hackability/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"contributes": {
2222
"commands": [
2323
{ "command": "atompp.init.edit", "title": "Open Init Script", "category": "Atom++" },
24-
{ "command": "atompp.init.reload", "title": "Reload Init Script", "category": "Atom++" }
24+
{ "command": "atompp.init.reload", "title": "Reload Init Script", "category": "Atom++" },
25+
{ "command": "atompp.keymap.apply", "title": "Apply Keymap Preset…", "category": "Atom++" }
2526
],
2627
"configuration": {
2728
"title": "Atom++ Hackability",

0 commit comments

Comments
 (0)