L'éditeur
Cette page est un document du dépôt, et elle est en anglais.
The editor (F4)
Lines, with a block, undo over the whole session, and a save that writes a new file beside the old one and renames it over the top — so an interrupted save never leaves half a file.
F2 saves, Shift+F2 saves under another name. F6 hands the file to the viewer at the same
line.
F7 opens the same search dialog the viewer has — text, hex or a regular expression, case,
whole words, forwards or backwards — with one button more. All matches lists every line
that has a hit, with its number: type to narrow the list, Enter goes to the line, and
Shift+F7 goes on from there like after any other search. Whole words only means the hit is
not a piece of a longer word: no letter, digit or underscore stands right before it or right
after it. That is true of set in set = 1 and not in offset, and it works for something
that is not a word at all, like ++.
Ctrl+F7 replaces, and asks everything in one dialog: what to look for, what to put there,
text or regular expression, case, whole words, and Preserve style.
- In a regular expression the replacement can use what the groups caught:
$1is the first group,${name}a named one,$$a dollar. Write${1}xwhen a letter follows the group, since$1xwould be read as a group called1x. In a plain search a dollar is just a dollar. - Preserve style gives a plain replacement the capitals of what it replaces: replacing
foowithbarturnsFoointoBarandFOOintoBARas well. Three shapes are recognised — all lower case, all upper case, a capital first — and a word written any other way (fooBar) gets the replacement exactly as you typed it. It only matters when the search is not case sensitive. - Replace all does the whole file, says how many it changed, and is one
Ctrl+Z. Replace next changes the hit the cursor is on, or the next one, and selects the one after it, for going through a file one hit at a time.
The dialog opens on what you last looked for and how. Every replacement that ran is
remembered, and Alt+Shift+F7 lists them — the ones kept under a name first, then the recent
ones — for Enter to run again without retyping a regular expression; Ins keeps a recent
one under a name (it goes into fcmd.toml as an [[editor.replace]] block), Del forgets a
kept one. One of these runs the way the dialog was last set: as text or as a pattern, with or
without whole words.
Ctrl+Z undoes and Ctrl+Shift+Z redoes. A run of typing is one step, as in FAR: the word
you just typed goes with one Ctrl+Z, not letter by letter. So is a run of Backspace, and a
run of Del. A step ends when you do something else — move the cursor, press Enter, give a
command, or change from typing to deleting. The editor keeps the last 1000 steps of each file;
editor.undo_depth in the settings (Options → All settings) changes that for the files
opened afterwards.
A column block is a rectangle rather than a run of lines, which is how a column of numbers is moved without touching what is beside it.
Searching as you type, and the word under the cursor
Ctrl+S searches while you type. A line opens at the foot of the text, and at every key the
cursor goes to the first place from where you were that holds what you have typed so far, and
marks it. Add a letter and the search narrows; rub one out with Backspace and it goes back
to what the shorter text had found — it always looks from where you began, so the keys do not
walk you down the file.
| Key | What it does |
|---|---|
↓, or Ctrl+S again | the next place |
↑ | the one before |
Enter | stays there; Shift+F7 and Alt+F7 go on from it |
Esc | goes back to where you were, with the block you had marked |
When nothing matches, the status line says so and the cursor is back where it began, until
you rub a letter out. It searches the way the F7 dialog was last set — as text or as a
regular expression, with or without case and whole words — so that dialog is where you change
how; a pattern that is not finished yet is simply not found yet.
Ctrl+F3 goes to the next place the word under the cursor is written, and
Ctrl+Shift+F3 to the one before, round the end of the file. It is the word as a whole word
and in the same capitals: from count it does not stop at recount or at Count. Nothing
is asked and the F7 search is left as it was. A word that is written nowhere else, or a
cursor that is not on a word, is said on the status line.
When the file changed underneath
If something else wrote the file while you were editing it — a build, a git pull, another
editor — F2 does not save over it. It asks, and the question has four answers:
- Overwrite writes your text over what is there now.
- Reload reads the file again and drops your edits, which is also what
Ctrl+Rdoes at any time. - What changed puts the two side by side: the file as it is on the disk on the left, your
text with its unsaved edits on the right, on the same screen
Ctrl+Shift+Dcompares two files with —Alt+↓andAlt+↑go from one difference to the next,W,CandEignore spaces, case and line endings. It only shows: nothing is merged and nothing is written from there.Esccloses it and the question is asked again, now that you know what each answer would lose. - Cancel goes back to the editor with everything as it was;
Shift+F2from there saves your text under another name and leaves the file alone.
The arrows or Tab move between the buttons and Enter takes the one that is lit.
End of line, byte order mark and code page
A save writes a file the way it was read: the same line endings, the same code page, a byte
order mark if it had one, and no newline after the last line if there was none. The status
line says which — LF, CRLF or CR, then the code page, then BOM when the file starts
with one.
Shift+F8 is where you change it. The list has three groups, and in each the row that is true
now is marked: the end of line (LF, CRLF, CR), the byte order mark (written or not), and every
code page, in the order the viewer's list has them. Enter on a row converts; type to narrow
the list, which is the quick way to a page among forty.
A conversion changes nothing on the disk by itself. The file becomes modified, the status line
shows the new answer, and F2 writes it; Ctrl+Z takes it back, one conversion at a time,
like any other edit.
- A file with mixed line endings has none of the three rows marked. Choosing one gives every line the same ending.
- Only UTF-8 and UTF-16 have a byte order mark. Converting to UTF-16 adds it, because without one nothing but a guess tells the two byte orders apart; converting to a page that has none drops it.
- A code page that has no byte for one of the file's characters is refused, and nothing
changes:
中does not fit in Windows-1252, and a save that turned it into?would be a word quietly lost.
In the viewer the same key reads the bytes as another page. Here the text is already read, so the page you choose is the one it will be written in.
Colours
A file whose name says what it is — Rust, C, C++, Java, C#, JavaScript, TypeScript, PHP,
Python, Ruby, Go, shell, SQL, HTML, XML, CSS, Markdown, JSON, TOML, YAML, INI, Make,
Dockerfile, Lua, Perl, Pascal and Delphi — is coloured as you read it, and the status line names the language so
you can see at once when a file is being read as something you did not mean. The colours come
from the theme, so they follow it. ui.syntax = false in fcmd.toml turns them off.
When the name says nothing, or says the wrong thing — a script with no extension, a .txt
that is really a patch, an .inc that is PHP in one project and Pascal in the next —
Alt+Shift+Y lists the languages for you to choose from. Type a few letters to narrow the
list and press Enter. The first row goes back to what the name says, the second reads the
file as plain text with no colours, and the row in force is marked. The choice is remembered
for that file, where the viewer remembers the code page it read a file in, so the next F4
on it needs no telling (viewer.remember = false turns that memory off, for both).
In a Pascal or Delphi unit, and in a form read as text, a thin line runs down each block the
way the Delphi IDE draws it: from the line that opens it — begin, try, case, repeat,
asm, a class or record with a body, an object of a form — to its end or until, in
the column where that line starts, one line for each block inside another. They are the same
lines the viewer draws, and here they follow the text as you type: open a block and its line
appears, close one or comment its begin out and it goes. A line only ever passes through
blank cells, so it never hides a character, and it is not part of the file — nothing of it is
copied or saved. Its colour is the theme's syntax.guide, and the switch that turns the
colours off turns the lines off with them.
Line numbers
Alt+N numbers the lines in a margin on the left, and Alt+N again takes the numbers away —
mcedit's key. The margin is as wide as the number of the last line, and never narrower than
three digits; the text, the block guides and a marked block all sit to its right, and when a
long line scrolls sideways the numbers stay where they are. They are drawn in the theme's
syntax.guide, the colour of the block guides, and like those they are not part of the file:
nothing of them is copied or saved, and a click on a number moves nothing.
The key is for the file in front of you. Number the lines, in the editor settings
(editor.line_numbers in fcmd.toml), is what every file opens with.
Bytes instead of lines
F4 on a binary opens the same editor on its bytes, and Alt+H switches either way. Two
panes, the hex and the text; Tab moves between them and both type. Insert chooses between
overwriting and inserting — in a binary a shifted byte usually breaks the file, so overwriting
is what it starts in.
Changed bytes are drawn as changed until they are written, with the list of what changed beside
them: offset, old byte, new byte. Ctrl+Z takes one back. F2 writes, atomically.
F7 searches the bytes with the same dialog: as text, as hex bytes — DE AD ?? EF, where ??
is any byte — or as a regular expression. What is found is marked and the cursor goes to it;
Shift+F7 finds the next one and Alt+F7 the one before, and a search that runs off one end
of the file starts again from the other and says so. A file of any size is searched a piece
at a time, never loaded whole.
Ctrl+F7 (or F8) replaces. The replacement is typed the way the search was — hex for hex,
and an empty line to delete what was found. Replace stops at each match and asks: replace
this one, this one and all the rest, skip it, or stop. All does the whole file at once, and
one Ctrl+Z takes all of it back. A replacement of the same length overwrites; one of another
length moves everything after it, so it is done only after Insert has switched to inserting.
F3 marks a block and F12 says what to do with it: write it out to a file, read a file in,
fill it with a byte, exclusive-or it with a key, copy or move bytes from elsewhere in the same
file, insert zeros, delete. Each one says what the file's length will become before it happens.
F9 assembles one instruction where the cursor is — ret, xor eax, eax, mov rax, 1,
jmp 0x401010, call rax. A branch is written as the address you want to arrive at, not as a
displacement. Whatever it encodes is decoded again before it is shown, so what you see is the
instruction the processor will see.
Addresses are written the way a disassembly prints them: mov eax, [rbx], [rbx+8],
[rbx+rcx*4+8], [0x401000], and [rip+0x2e35] with the displacement counted from the end of
the instruction, so a line read off the screen can be typed straight back. When no register
says how wide the thing at the address is, a size word does: mov dword [rbx], 1, or
byte ptr if you write masm. Without one it asks rather than guess, because one byte and eight
are not the same patch. What it will not do — segment prefixes, far pointers, the
floating-point and vector registers — it refuses by name.
Alt+= is the calculator: one line of arithmetic answered in decimal, hex, octal, binary and
as characters at once. It reads the literals binary tools print — 0x1f, 1Fh, 0b1010,
'PE' — and the same reader takes the numbers typed into the assembler and the block
operations.
Devices
On Linux and macOS a disk is a file, so the hex editor opens /dev/sdb read-only and the
status line says what it is and how long it measured. The bytes are written out to a file,
never back over the disk.
On Windows the same works with the names Windows uses: \\.\PhysicalDrive0 for a disk and
\\.\C: for a volume, typed in rather than found in a panel — the filesystem does not list
them. The length comes from the device itself, since there is nothing to measure by seeking,
and the reading is done in whole sectors because that is all such a handle accepts. It needs
Administrator rights, and says so if it does not have them.
Brackets, joining and sorting
Alt+B jumps to the bracket that matches the one under the cursor, or the one just before it —
(), [], {} and <>, across lines — and again jumps back; it is mcedit's key. Brackets in
strings and comments count like any others: this is a file manager's editor, not one
language's. Alt+J joins the next line to this one, its indent turned into one space.
Alt+Shift+S sorts the lines of the block, and nothing outside it; Alt+Shift+U takes out
every line that repeats one above it — the first of each stays where it was, so the block does
not have to be sorted first — and says how many went; Alt+Shift+R turns the block's lines
upside down; Alt+Shift+N puts a number in front of each, from 1, lined up on the widest.
Alt+Shift+T takes the spaces and tabs off the end of every line. Each is one Ctrl+Z.
Take trailing blanks off when saving, in the editor settings, does the last one at every
F2. It is off by default, because a save that changes lines nobody touched is a diff nobody
asked for.
Tabs, whitespace and the odd key
F9 → Options → Editor settings has the six that matter. Tabs is three choices and not a
box: leave them as they are, turn a newly typed tab into spaces, or expand every tab in the file
when it is opened — the last one changes the file, so it says how many lines it touched and the
next save writes that. Show spaces and tabs draws a space as · and a tab as → and its
padding, which is how a mixed indent becomes visible. The cursor lands after the text a search
found is for typing over what was found rather than reading it.
The cursor may go past the end of a line is off by default. On, the arrows go into the
columns to the right of the text instead of jumping to the next line, which is what you want to
line up a column of numbers or to mark the same columns down lines of different lengths. Moving
about there writes nothing: the spaces appear at the keystroke that puts a character in one of
those columns, as part of the same edit, so one Ctrl+Z takes the character and its padding
away together. Backspace and Del out there move the cursor and leave the file alone.
Ctrl+Q puts the next key in as itself: a control character, or a real tab where tabs are being
expanded. There is no other way to get either into a file.
Alt+I and Alt+U move the block — or, with nothing selected, the line the cursor is on — one
indent right and left. Tab still types a tab, because that is the key one presses while
writing.
Ctrl+Shift+Ins adds the block to what is already on the clipboard instead of replacing it, so
a few pieces can be gathered from here and there and pasted in one go. Ctrl+N and Ctrl+E put
the cursor on the first and the last line on the screen, leaving the screen where it is.
A project's .editorconfig
When a file you open has a .editorconfig above it, what it says about that file wins over
the settings: spaces or tabs and how wide (indent_style, indent_size, tab_width), and
whether trailing blanks go on saving (trim_trailing_whitespace). For a new file, its line
ending and final newline as well (end_of_line, insert_final_newline); a file that already
exists keeps the ones it has.
Finishing a word, and characters you cannot type
Alt+/ finishes the word before the cursor with another word of the file that starts the same
way, the nearest one first; press it again for the next one, and after the last you are back to
what you typed. Alt+Shift+C lists the characters a keyboard does not have — accents, dashes
and quotes, currencies, arrows, mathematics, FAR's frame lines, Greek — each with its code:
type U+20AC or part of it to narrow the list, Enter to insert, Esc to go back.
Taking out the lines that match
Alt+Shift+D asks for a regular expression and takes out every line that matches it — in the
block if there is one, in the whole file otherwise. Start the pattern with ! to keep only the
lines that match and take out the rest: !ERROR leaves the errors of a log. One Ctrl+Z puts
them all back.
The case of a block
Alt+Shift+B encodes or decodes the marked block — or, with nothing marked, the run of
characters under the cursor — from a list: base64, base32, UUencode, XXencode, yEnc,
quoted-printable, hex, percent-encoding, HTML entities and ROT13, a row to encode and a row to
decode for each. It is one Ctrl+Z. What a decode gives that is not text — a picture written
down in base64 — is not put in: the status line says so and the text stays as it was.
Alt+C changes the case of the marked block, from a list of four:
| Row | Hello wORLD becomes |
|---|---|
| UPPER CASE | HELLO WORLD |
| lower case | hello world |
| Title Case | Hello World — a capital at the start of every word, small letters after it |
| tOGGLE | hELLO World — every capital made small and every small letter a capital |
Enter applies the row under the cursor, and it is one Ctrl+Z. The block stays marked, so
a second choice is made on the same text. On a column block only the marked columns change.
With nothing marked it is the word under the cursor that changes, or the one the cursor
stands right after. Accented letters follow their own rules — é becomes É, and the German
ß becomes SS, which makes the text a letter longer.
Each of the four is also a command of its own — editor.case.upper, editor.case.lower,
editor.case.title, editor.case.toggle — with no key until you give it one in the keymap.
A paragraph to a width
Alt+P lays the paragraph the cursor is in out again so that no line is wider than a number
of columns — mcedit's key for it. It asks the width, and Enter alone takes the last one
used, which starts at 72. A paragraph is the lines around the cursor up to the nearest empty
line each way. Its words are put back with one space between them, as many to a line as fit,
and every line gets the indent the paragraph's first line had, so an indented paragraph stays
indented. A word longer than the width has a line to itself; nothing is ever cut.
With a block marked, every paragraph in the block is laid out and the empty lines between
them stay. It is one Ctrl+Z either way. On an empty line with nothing marked there is no
paragraph, and it says so.
The date, and the name of the file
| Key | What goes in at the cursor |
|---|---|
Ctrl+F5 | the date and time, as 2026-11-11 17:42 |
Alt+Shift+F | the name of the file you are editing |
Ctrl+F | its whole path — FAR's key for it; for a file opened from a server, the address it has there |
Each is one Ctrl+Z. A new file that has not been saved has no name yet, and says so.
Alt+F5 prints the block, or the whole text when there is none — what is on the screen, not
what was last saved.
The list of commands (Alt+F9)
The key bar has room for twelve keys and the editor has many more. Alt+F9 lists the ones
described in the sections above — searching as you type, the word under the cursor, the block
through a command and out to a file, its case, the paragraph, what can be inserted, line
numbers, the language — each with the key that does it. Type to narrow the list, Enter runs
the row, Esc goes back. F9 alone is still the menu bar, as everywhere.
A block through a command, and files in and out
Four keys on Alt+Shift, beside the other block commands, connect the text to the programs
and files around it.
| Key | What it does |
|---|---|
Alt+Shift+P | runs the marked block through a command and puts what the command prints in its place |
Alt+Shift+O | puts what a command prints in at the cursor |
Alt+Shift+I | reads a file in at the cursor |
Alt+Shift+W | writes the marked block to a file |
Alt+Shift+P asks for a command line — sort -u, column -t, jq ., fmt -w 72, a
formatter — and gives it the block on its standard input. What it prints takes the block's
place and stays marked, so the next command can be run on the result. With nothing marked the
whole file goes through, and the question says so before you answer it. It is one
step: a single Ctrl+Z brings back what was there.
Nothing is replaced unless the command succeeded. If it ends with an error, the status line says which, with what the command itself said about it, and the text is as it was; what a command prints as warnings beside its result is not put in the file. The command runs in the folder of the file being edited, through the same shell the command line uses, and you can go on working while it runs: if the text it was given has changed by the time it answers, its answer is for something that is no longer there and is dropped, with a line saying so. A column block is refused — mark whole lines.
Alt+Shift+O runs a command that is given nothing and puts its output where the cursor
is: date, ls, git log -3. The newline a program ends its last line with is left out, so
one line of output goes into the middle of a line without breaking it. A block that happens
to be marked is left alone.
Alt+Shift+I asks for a file and reads it in at the cursor, as text: in its own code page
and with its own line endings, read the way F4 would read it, and written, at the next save,
the way the file you are editing is written. A name without a folder is looked for in the
panel's folder.
Alt+Shift+W asks for a name and writes the marked block there, with the end of line and
in the code page of the file you are editing. A file of that name is replaced, as Shift+F2
replaces one; the file you are editing is not, since a piece of it written over it would leave
only that piece.
The text goes to a command and comes back as UTF-8, whatever code page the file is saved in. Both the file and the block's target have to be on this machine.
Having a block rewritten
Mark a block and press Ctrl+Alt+W: fcmd asks what should become of it, in words — fix the typos, translate to English, make this a table, rename x to count — and sends the
block, with the file's name and your words, to an AI service (see Asking an AI in
Configuration). Before anything goes, a dialog says how much and to which host, with
Cancel lit and F3 to see exactly what is sent; secrets in the block are masked like
anywhere else.
The answer does not go into the file. It opens as a comparison: the block as it is on the
left, the model's version on the right, what differs painted, Alt+↓ and Alt+↑ from one
change to the next. There:
| Key | What it does |
|---|---|
Enter | puts the model's version in the block's place — in the buffer, not on the disk; saving is still F2 |
Esc | leaves the block exactly as it is |
Put in, the rewrite is one step: a single Ctrl+Z takes all of it out again, and the new
text stays marked, so you can ask again or undo and see the difference.
Only the marked text is sent, never the rest of the file, and it has to be an ordinary block
(not a column). You can go on working while the model writes: if by the time it answers the
block is no longer the text that was sent — you typed in it, unmarked it, closed the file —
nothing is offered and nothing is replaced; the model's version is kept in the answers' folder
(ai:), like every answer.
Ctrl+Alt+X (what is this?) from the editor works the same way round: the dialog comes up
over the editor, and the answer does not take the editor's place — the status line names the
file it was written to.