Add view_mode config option to open files with system default viewer#10
Merged
kooler merged 3 commits intokooler:mainfrom Apr 20, 2026
Merged
Conversation
Adds a `view_mode` setting under `[behavior]` in config.toml. When set to `"system"`, pressing F3 (View) opens the file using the OS default application (xdg-open on Linux, open on macOS, explorer on Windows) instead of the terminal pager. Useful for images, videos, PDFs, and other binary/non-text formats. Defaults to `"pager"` for unchanged backward-compatible behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fileActionCmd's "preview" case called viewFileCmd directly, bypassing the view_mode config. Now routes through openSystemDefaultCmd when view_mode = "system", consistent with the F3 View behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
view_modesetting under[behavior]inconfig.tomlwith two values:"pager"(default) — existing behaviour, opens in$PAGER/less"system"— opens the file using the OS default application (xdg-openon Linux,openon macOS,exploreron Windows)"pager"so nothing changes unless the user opts inMotivation
The F3 (View) key currently always opens files in a terminal pager, which is useless — or even broken — for binary and non-text formats like images, videos, PDFs, or office documents. With
view_mode = "system", pressing F3 hands the file off to whatever the OS has registered for that extension, so an image opens in an image viewer, a PDF in a PDF reader, and so on, without leaving mdc.Usage:
Notes
This feature was developed with assistance from Claude Code (Anthropic's AI coding tool). I found it genuinely useful for my own workflow but wanted to be transparent — feel free to reject this PR if AI-assisted contributions are a concern for the project.
🤖 Generated with Claude Code