PPocket Editor DOCUMENTATION
Editor / POCKET EDITOR

Using Pocket Editor

Launch

sh
cd pocket-editor
python3 -B pocket_editor.py

Open a file with python3 -B pocket_editor.py path/to/file.py. Start without plugins with python3 -B pocket_editor.py --safe-mode.

On Windows use py pocket_editor.py; on macOS use python3 pocket_editor.py with a Python installation that includes Tkinter. These platforms have not yet been verified. Debian requires Tkinter (python3-tk). Black must be available in the interpreter running the editor; it was available on the development computer during verification.

Appearance and preferences

The interface uses a near-black palette inspired by the reference layout, a compact New/Open/Save toolbar, a scrollable Plugins menu and vertical plugin tabs, wrapping file tabs with close buttons and unsaved markers, and a detailed status bar. Settings → Preferences changes document font, tabs, line numbers, and wrapping. Document font changes do not alter UI or gutter fonts. Code Theme controls the document color scheme independently of the UI palette.

Use Plugins in the menu bar or your chosen vertical tabs to open plugin tools. The Plugins window has a fixed size and a vertical scrollbar. Choose a plugin to see its actions; choosing a group does not run a command. Right-click a vertical tab for the same action list.

Documents and settings

Open selects one or more files. Each file has its own tab, edits, undo history, cursor, and formatting. Opening the same file again selects its existing tab. New creates another untitled tab. Click × or press Ctrl+W (Cmd+W on macOS) to close the current file; modified files offer Save, Discard, or Cancel. Canceling Save As or a failed save keeps the file open. Save writes the selected file; File → Save All saves edited and untitled files. With session persistence enabled, closing the editor preserves every draft and the workspace; closing an individual tab still checks unsaved changes. Plain-text saving still requires a formatted copy to preserve rich-text styles.

Plain UTF-8 saves retain the detected BOM and newline convention. Mixed newline conventions are normalized on opening. Saves and settings use a temporary sibling file and atomic replacement; existing symlinks are followed.

Use Rich Text → Save Formatted Copy for .pocket documents. File → Save writes plain text. Unsaved formatting is protected by a separate discard confirmation. Rich formatting operations do not have formatting undo; text changes have Tk undo/redo. Word .docx support is not implemented.

Command palette

Press Ctrl+Shift+P (Cmd+Shift+P on macOS), or choose Edit → Command Palette…. Type words from a command name or menu category, use ↑/↓ to select, and press Enter to run. Escape closes without making changes. Plugin commands appear automatically from the live menus; reopen the palette after loading new plugins. Disabled commands are excluded, and the palette works in safe mode.

The bundled editor_commands plugin adds 14 everyday commands: Duplicate Line / Selection, Move Lines Up/Down, Delete Lines, Trim Trailing Whitespace, Go to Line, Copy File/Folder Path, Next/Previous Tab, Close Other Tabs, and Zoom In/Out/Reset. Line commands act on selected lines or the cursor's line and support Undo. Close Other Tabs checks unsaved changes and stops on cancellation or save failure. Zoom changes persist in editor settings. Load New Plugins or restart to enable newly installed commands; they are available from Extensions and the palette.

Session restore and draft recovery

Normal application launch restores saved file tabs, the active tab, cursor positions, and vertical scroll positions. While the editor is running, a local snapshot is written every five seconds to pocket_editor_session.json beside its settings file. After an interrupted session, a prompt offers to restore unsaved text and rich-text styles; original files remain unchanged until you save. Edits made since the last snapshot may be lost. Undo history is retained while switching tabs, but is not restored across application restarts.

Normal closing preserves unsaved edits, untitled documents and rich-text styles in the clean workspace snapshot, then restores them automatically on the next launch. Files on disk are changed only by explicit Save. The snapshot also retains the window size, split view and Explorer state. If saving the snapshot fails, the editor stays open. Closing an individual tab still offers Save/Discard/Cancel; --no-session retains the legacy exit prompts. Missing files are skipped with a notice. Malformed snapshots are backed up as pocket_editor_session.invalid.json. A file lock keeps a second editor instance from overwriting the first instance's recovery data; that instance runs without session persistence. The snapshot contains local document contents, including unsaved drafts.

Use python3 -B pocket_editor.py --no-session to launch without restoring or writing a session. A file supplied on the command line opens after session restoration. Run python3 -B -m unittest -v test_editor_session for the persistence and recovery checks.

Quick Open

Press Ctrl+P (Cmd+P on macOS), choose File → Quick Open…, or search for Quick Open in the command palette. Type part of a filename or relative path; multiple search words and case-insensitive matching are supported. Use ↑/↓ and Enter, or double-click a result. Escape cancels. Files already open select their existing tab, preserving edits.

The search root comes from Project Explorer's selected project, otherwise the current file's folder, otherwise a folder picker. With no current file, the picker remembers its last selected folder for that editor session. Reopening Quick Open refreshes the index. File discovery runs in a background thread and skips .git, .hg, .svn, node_modules, __pycache__, .venv, venv, and vendor; directory symlinks are not traversed. Up to 50,000 files and 20,000 directories are scanned, and the first 200 matching results are shown. If a limit is reached, narrow the project folder. Unreadable folders are reported in the picker footer.

Run python3 -B -m unittest -v test_quick_open test_command_palette for discovery, cancellation, existing-tab reuse, and palette checks.

Split editor

Choose View → Split Editor Right, or find that command with Ctrl+Shift+P. The current file stays on the left and another open file appears on the right. With only one document, the editor creates an empty second tab. Drag the divider to resize the panes. Both panes are editable and scroll independently, with line numbers and filename/unsaved indicators.

Click a pane to activate its document. Save, Undo, palette commands, plugins, and syntax diagnostics use that active document. Choosing a tab already visible focuses its pane; another tab replaces the active pane's file. View → Focus Other Pane switches panes. View → Close Split returns to one pane without closing any tabs or discarding edits. Closing a file still checks unsaved changes and collapses the split when only one document remains. Font, tab width, wrapping, and line-number preferences apply to both panes. Session restore retains documents and cursor positions; the split arrangement itself is not restored.

Verify with python3 -B -m unittest -v test_split_editor.

About and tab appearance

Help → About Pocket Editor… (also in the command palette) shows Somi Douth, somidouth@gmail.com, a short editor description, and a Python/Tkinter technology credit. Publisher information is read-only; the About window provides Copy details and Close. Old local About override files do not replace the published author information.

Document tabs now use consistent active/inactive backgrounds and readable titles: white for selected clean files, muted light text for inactive files, and amber for unsaved files. Close buttons match the tab background. Selected, hovered, disabled, and inactive notebook tabs have explicit contrasting colors across plugin windows, including Terminal Settings and Plugin Builder. Split-pane headings use matching active/inactive title colors.

Created by Somi Douth · Built with Python and Tkinter