English | 日本語
XeFM has a built-in text viewer for source code, config files, logs, and any
other text. The encoding is detected automatically — UTF-8 with or without
BOM, Shift-JIS, EUC-JP, ISO-2022-JP, Latin-1 / CP1252 and more, with a manual
override through change_encoding (see
Text Encodings). Put the cursor on a file and run
view_file (or open_item on a file with no other enter
rule) to open it full-window, without leaving XeFM. Binary files are detected
and show a short placeholder instead of mojibake.
For file types with a richer renderer — Markdown especially — the viewer can switch between the rendered view and the plain source (see below and Markdown Viewer).
The viewer draws its own keys along the bottom, and F1 inside it lists them all
— both read from your KEY_BINDINGS, so they are right whatever you have bound.
| Action | What it does |
|---|---|
view_file |
View the focused file in the text viewer |
open_item |
Same, for a file with no other enter rule |
↑ ↓ PgUp PgDn Home End |
Scroll by line, page, or to either end (Vim style adds its own scroll keys) |
← → |
Scroll horizontally (when line wrap is off) |
toggle_wrap |
Toggle line wrapping |
isearch |
Incremental search — then ↑ / ↓ step between matches |
toggle_view_mode |
Toggle rendered / raw view (Markdown and other rich types) |
change_encoding |
Choose the text encoding (Auto / explicit) |
edit_files |
Edit the viewed file in the configured editor |
Cmd/Ctrl + C |
Copy the current selection |
Cmd/Ctrl + A |
Select the whole file |
F1 |
Key help |
quit / Esc |
Close the viewer |
The keys of isearch, edit_files and quit, and Vim style’s extra scroll
keys, depend on your keymap preset — see Keymap Presets.
Apart from Esc and the copy / select-all chords, which are fixed, every key
here is an action you can rebind in your config’s KEY_BINDINGS. The scroll keys are actions too —
text_viewer.scroll_up / scroll_down, text_viewer.page_up / page_down,
text_viewer.scroll_top / scroll_bottom and text_viewer.scroll_left /
scroll_right — and keep the arrow / page / home / end keys unless you list
them.
LEXERS in
config.py.← / →). Press W to wrap instead; a WRAP indicator shows in the footer.You can select text with the mouse and copy it to the clipboard.
| Gesture | Selects |
|---|---|
| Click & drag | An arbitrary range from where you press to where you release |
| Double-click | The whole word under the pointer |
| Triple-click | The whole line under the pointer |
| Drag after a double / triple click | Extends by whole words / lines |
| Shift-click | Extends the current selection to the click |
Cmd/Ctrl + A |
Selects the entire document |
The highlighted range tracks the pointer as you drag, and the selection survives scrolling — scroll away and back and it is still there.
To select more than one screenful, drag past the top or bottom of the text and hold there: the view keeps scrolling under the pointer and the selection grows with it, faster the further out you hold. Drag back inside, or release, and it stops.
Press Cmd+C (macOS) or Ctrl+C (Linux / Windows) to copy. The text
viewer copies the selected source text exactly, each display line on its own
line.
Whether the copy reaches your system clipboard depends on the terminal supporting the OSC 52 clipboard escape (most modern terminals do). The copy always works for pasting back inside XeFM regardless.
When you copy from the rendered Markdown view (toggle_view_mode on a
.md file),
the copy carries rich formatting — bold, italics, inline code, links, headings
and tables come across intact when you paste into a formatting-aware app, while
a plain editor gets the plain text. See
Markdown Viewer for the details.
.md filesdoc/dev/TEXT_VIEWER_SYSTEM.md