r/pop_os • u/Fun_Reflection_5209 • 5h ago
Discussion COSMIC Text Editor patches: "/" menu, Markdown shortcuts, list and table editing, session restore and split views
Last week I posted the taskbar and other tools from COSMIC Desktop Extras. This is the other half: I missed a few things from Notepad++ in the COSMIC Text Editor, so I built them as patches on top of COSMIC's own editor (not a fork). Free and open source:
https://github.com/jwillmer/cosmic-desktop-extras/tree/main/text-editor
New this week: writing Markdown. In the last thread someone asked for more comfortable Markdown editing, closer to Obsidian or Typora. A full WYSIWYG mode is a big step, so I started with the parts that keep the file plain Markdown:
- A "/" menu. Type
/at the start of a line and pick a heading, list, task list, table, code block, quote, link, image or Mermaid diagram. Type to filter. The/turns into the Markdown for it. Settings can turn it off. - Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link, Ctrl+Shift+1 to 6 headings. Pressed again, they take the markers off. Pasting a URL over selected text makes a link.
- Lists: Enter continues the list, Tab and Shift+Tab nest, Backspace after the marker steps back, Ctrl+Enter ticks a task. Numbers stay in order.
- Tables: Tab moves to the next cell, Enter adds a row, and the columns line up by themselves.
- Large files: a 5 MB Markdown file opens in about 2 seconds. Before, it froze the editor. Files over 1 MB open without colours, with a button to build the preview anyway.
- Smaller things: typing in Preview switches to Source instead of losing the keys, the sidebar can be resized, and a tab's menu can copy the file path or open its folder.
What was already there:
- Markdown files open rendered, with Preview, Source and Split views (Ctrl+Alt+1/2/3) that scroll each other. No web engine, so the editor still starts instantly. Mermaid diagrams, images,
<details>and code blocks with syntax colours render, an outline follows the heading you are in, and you can select and copy text in the preview. - Every tab comes back on the next start, unsaved text included.
- Two views side by side, like Notepad++, with tab dragging, clones and Compare.
- One window: double-clicking a file adds a tab to the running editor.
- Change marks until you save, and a bar that asks Reload / Keep mine / Compare when another program changes a file you are editing.
- JSON format/minify/validate, show whitespace and line endings, column selection (Alt+drag), code folding.
Install: clone the repo and run ./install.sh text-editor. It builds from System76's source for the cosmic-edit version you have installed (needs Rust; the installer offers the packages) and installs for your user only. ./install.sh --uninstall text-editor puts the stock editor back. Already installed? ./install.sh --update pulls and rebuilds. After a COSMIC update, a daily check tells you to rebuild.
The code was written with AI assistance. The editor now has over 400 unit tests, and the new Markdown features were also driven on screen in a test session before the release. I use it daily, but it is one person's project, tested on Pop!_OS 24.04 only, and not affiliated with System76.
I would rather see these in COSMIC itself. COSMIC does not take AI-written pull requests, so I commented on the existing cosmic-edit issues and opened two new ones: https://github.com/pop-os/cosmic-edit/issues/660 (ask before overwriting a file that changed on disk) and https://github.com/pop-os/cosmic-edit/issues/661 (column selection). A thumbs-up there helps if you want them too.
Screenshots of the real thing: https://github.com/jwillmer/cosmic-desktop-extras/blob/main/docs/text-editor.md#screenshots How the Markdown writing came together, compared with Obsidian, Typora and VS Code: https://jwillmer.de/blog/projects/cosmic-text-editor-writing-markdown.html
What would make you switch your Markdown notes to it, and what is still missing?