A terminal-based Markdown and code editor with WYSIWYG rendering and LSP support.

Overview
mq-edit is a Rust-based TUI (Text User Interface) editor that provides:
- Markdown WYSIWYG: The line under the cursor displays source, other lines show rich formatted text
- LSP Integration: Full Language Server Protocol support for code intelligence
- Multi-language support: Rust, Python, MQ (Markdown Query Language), and more
Built on top of the mq-markdown parser with full LSP capabilities.
Using the Installation Script (Recommended)
|
The installer will:
- Download the latest release for your platform
- Verify the binary with SHA256 checksum
- Install to
~/.mq-edit/bin/ - Update your shell profile (bash, zsh, or fish)
After installation, restart your terminal or run:
Cargo
# Install from crates.io
# Install using binstall
From Source
# Binary will be at target/release/mq-edit
Usage
# Open a Markdown file
# Open a Rust file (with LSP support)
# Open an MQ file (Markdown Query Language)
# Create a new file (empty buffer)
# Initialize default configuration file
# Show help
Keyboard Shortcuts
| Key | Action |
|---|---|
Ctrl+S |
Save file (opens save dialog for new files) |
Ctrl+Q / Esc |
Quit |
Alt+B / F2 |
Toggle file browser |
Ctrl+Space |
Code completion (LSP) |
Ctrl+D |
Go to definition (LSP) |
Ctrl+B |
Navigate back |
Ctrl+F |
Navigate forward |
Ctrl+G |
Go to line |
Ctrl+E |
Execute mq query |
F3 |
Search |
F4 |
Find and replace |
Up/Down |
Move cursor / Select completion |
Enter |
Apply completion |
Pipe Mode
mq-edit supports pipe mode, allowing you to read from stdin and write to stdout. This is useful for combining with mq and other command-line tools. In pipe mode, pressing Esc exits immediately without a save confirmation dialog — the edited content is written to stdout on exit.
# Edit mq output interactively, then pass the result to the next command
| | |
# Extract links, edit them, and save to a file
| |
# Transform markdown with mq, review and edit interactively, then write back
|
# Edit text from clipboard (macOS)
| |
Configuration
mq-edit uses a TOML configuration file for customizing keybindings and LSP servers.
Config File Location
- Linux:
~/.config/mq/edit/config.toml - macOS:
~/Library/Application Support/mq/edit/config.toml - Windows:
%APPDATA%\mq/edit\config.toml
Initialize Config
Run mq-edit --init-config to create a default configuration file with all available keybindings.
LSP Configuration
Configure language servers for different file types:
# Rust Language Server
[]
= "rust-analyzer"
= []
= true
= true
= true
# MQ Language Server (for .mq files)
[]
= "mq-lsp"
= []
= true
= true
= true
# Python Language Server
[]
= "pyright-langserver"
= ["--stdio"]
= true
= true
= true
Customize Keybindings
Edit the config file to change keybindings. Example:
[]
= "q"
= ["ctrl"] # Ctrl+Q to quit
[]
= "esc"
= [] # Esc to quit (alternative)
[]
= "s"
= ["ctrl"] # Ctrl+S to save
Theme Configuration
Choose from built-in syntax highlighting themes:
[]
# Syntax highlighting theme
= "base16-ocean.dark" # Default dark theme
# Other available themes:
# theme = "base16-ocean.light" # Light ocean theme
# theme = "base16-mocha.dark" # Mocha dark theme
# theme = "base16-eighties.dark" # Eighties dark theme
# theme = "InspiredGitHub" # GitHub-inspired light theme
# theme = "Solarized (dark)" # Solarized dark
# theme = "Solarized (light)" # Solarized light
All themes are provided by the syntect library.
Keybindings
Note: Default keybindings have been changed to avoid conflicts with VSCode, Zellij, and other editors. All keybindings are customizable via the config file.
Navigation
Arrow keys- Move cursorHome- Start of lineEnd- End of linePage Up/Down- Scroll page
Editing
Character keys- Insert textEnter- Insert newlineBackspace- Delete characterTab- Insert tab
File Operations
Ctrl+S- Save file (opens save-as dialog for new files)Ctrl+QorEsc- Quit applicationAlt+B- Toggle file browser (changed fromCtrl+Bto avoid VSCode conflict)F2- Toggle file browser (alternative)
LSP Features
Ctrl+D- Go to definition (changed fromCtrl+Gto avoid conflict with goto line)Ctrl+B- Navigate back in jump historyCtrl+F- Navigate forward in jump historyCtrl+Space- Trigger code completionCtrl+L- Toggle line numbersCtrl+Shift+L- Toggle current line highlight
mq Query Execution
mq-edit has built-in support for mq (Markdown Query Language). Press Ctrl+E to open the query dialog and run mq queries against the current document.
Ctrl+E- Open mq query dialog- Type a query (e.g.
.heading,.link,.[] | upcase()) Enter- Execute query and insert result at cursor positionEsc- Close dialog
The query result is inserted at the current cursor position, and the cursor remains at the insertion start so you can review the output.
Search and Navigation
F3- Open search dialogF4- Open find and replace dialogCtrl+G- Go to line (opens line number dialog)
File Browser (when visible)
Up/Down- Navigate files and directoriesRight- Expand directoryLeft- Collapse directoryEnter- Open file or toggle directoryEsc- Close file browser
License
Same license as the mq project (MIT).