Northern Commander

Text and bytes

The text viewer shows any file as lines of text, or as the bytes it is made of. ⇧F3 opens every file here, and F3 any file that has no view of its own.

At a glance

KeyAction
F2Wrap the long lines
F5Line numbers
⇧F9Spaces and tabs
F4Show the bytes
⌘EEncoding…
⌘RRe-read
⇧F4Edit this file
Follow the endFollow the end
⌥→Next file
⌥←Previous file
EscClose

Moving around

  • ↑ and ↓ move a line. Page Up and Page Down move a screen, keeping the last line of one at the top of the next.
  • Home and End go to the start and the end of the file. The end is there at once, however big the file, with its last line on the bottom row. Going to 100% lands on the last line. End again once there follows the file.
  • ← and → move long lines sideways, a column at a time, while they are not wrapped.
  • ⌘G goes to a line or a percentage — see going to a line.
  • ⌥→ and ⌥← show the next file in the pane and the one before — see going on to the next file.

The header line

The file was written to while it was open, so that comes first.

The name and size are on the left. On the right, whichever of these apply:

changed on disk, changed on disk (now shorter), replaced on disk, moved or deleted on disk
The file has changed since it was read — see files that change.
following
New lines are kept on screen as they are added — see following a file that grows.
hex
The bytes are shown rather than the text.
UTF-8 (detected)
How the bytes are read as characters, and how that was decided: (BOM) the file says so at its start, (detected) worked out from its bytes, (chosen) chosen by you. See characters that come out wrong.
LF, CRLF, CR, mixed
How its lines end. mixed is more than one way in the same file.
Go
The language it is colored as.
line 12 of 31
The line at the top of the screen, and how many there are. With no total, the file has not been counted to its end yet; ? is a line it has not been counted as far as. Showing the bytes, it is byte and where the top row starts, in decimal.
empty
The file has no text, in place of the line. Nothing is wrong with it.
going to a line…, indexing 40%
Counting lines, to get somewhere or through a big file.
searching…, not found, 6 matching
What a search or a filter came to — see searching a file.
copied 42 lines, saved 42 lines to name.log
What copying or saving the lines of a filter came to — see the lines it kept.
too much to copy
More is selected than a copy takes — see selecting and copying.

When the window is too narrow for all of it, the name gives up its room first, then details drop off from the right.

The bar down the right edge shows where the screen is and how much of the file it covers. It measures bytes, so it is right from the start, even while the header cannot yet say which line this is.

Choosing what is shown

F2 Wrap the long lines
Folds a long line at the window’s edge instead of running it off. It is still one line, with one number.
F5 Line numbers
Numbers the lines down the left. Turning them on counts through the file, so a big one may show ? for a moment.
⇧F9 Spaces and tabs
Draws what is otherwise invisible — below.

F10 lists all of these together with how each stands now, and with them the bytes, the filter, the encoding, the language the text is colored as and how far apart tab stops are.

Wrapping and line numbers start off for every file. Line numbers in the editor is the editor’s own and does not reach the viewer.

Invisible characters

Off: the tabs, the spaces at the end and the odd line ending cannot be seen.
On: the line after test: ends differently from the rest.
You see It is
→ then blank to the next stop A tab
· at the end of a line A space at the end of the line
° A space that is not the ordinary one — a no-break or a thin space
↓, ↵, ← after the line How it ends: a line feed, a carriage return and line feed, a carriage return alone

A control character is always shown, as a red ·, since it would otherwise take no room at all.

However a file reaches the viewer — F3, ⇧F3, F4 from a format’s view, or stepping on to the next file — it starts with invisibles drawn or not as Show spaces and line endings says, lays tabs out every Tab width columns, and keeps a change to the invisibles in that setting, which the editor shares. The license and the report text the application shows you are always plain.

Seeing the bytes

F4 shows the file as bytes: the offset in hex, sixteen bytes in hex — eight in a narrow window — and the same bytes as characters.

A PNG opens as bytes, because it is not text.
  • The characters column is plain ASCII: any other byte is a ., whatever the encoding.
  • Switching keeps the exact place. Wrapping, line numbers and a filter are put aside, and come back with the text.
  • A file over 4 GB has twelve-digit offsets.
  • The search can look for bytes, and going to a place takes an offset — see searching a file.

Files that are not text

A file whose first 64 KB hold a zero byte, or are more than a third control characters, opens as bytes. F4 still shows it as text — the way to read the strings inside a program.

Selecting and copying

Select with the mouse, then copy with ⌘C or Copy block in the Edit menu.

A drag from the comment to the closing brace. The selection is the gray ground.
Do And it selects
Drag From where you pressed to where you let go
Double-click The word; drag on to take more, a word at a time
Triple-click The line; drag on to take more, a line at a time
⇧-click From where you last pressed to here
⌘A The whole file, whatever its size
  • Dragging past the top or bottom of the window scrolls the file as you move.
  • A click anywhere drops the selection. So does changing the encoding or reading the file again; scrolling, wrapping and showing the bytes do not.
  • What is copied is the file’s own text, with its own line endings.
  • Showing the bytes, a drag selects bytes, a double-click one byte and a triple-click a row. What is copied is their characters, as the column on the right shows them, in one run.
  • At most 16 MB is copied. With more selected, nothing is copied and the header says too much to copy.
  • There is no selecting with the keyboard, and none in a filter, where copy takes every line shown.
  • In a tab or a wide character, the selection starts at whichever edge of it is nearer.

Characters that come out wrong

⌘E reads the file again with the next encoding in turn, keeping your place:

detected → UTF-8 → UTF-16 LE → UTF-16 BE → Latin-1 → detected

Detected means, in order: what a byte-order mark at the start says; UTF-16, if the zero bytes fall every other byte; UTF-8, if every byte is valid UTF-8; and otherwise Latin-1, which reads anything.

  • There are no others — no Windows-1252, no Shift JIS.
  • A filter is taken off, since it was read the old way.
  • The bytes’ characters column does not change.
  • Each file opens detected again.

Colors

Text is colored by its language: keywords, strings, comments and numbers each have a color. The language comes from the first of these that says one:

  1. A file type of your own that names a language.
  2. The file’s name — .go, .py, Makefile.
  3. Only if the name says nothing, the start of the file: an editor’s mode line such as -*- mode: python -*- or vim: ft=python, a #! line such as #!/usr/bin/env python3, or <?xml.

Nothing is guessed from how the text looks. Forty-nine languages are known.

Language…, in the View menu, colors the file as another language or as none. Tick Always color .go files like this to keep the choice for every file with that ending — it is saved as a file type of your own. A file with no ending has nothing to keep it for, so the box is gray.

In a big file the colors arrive a moment after the text. The bytes, and a filtered view, are never colored.

Big files

A file of any size opens at once: the viewer reads only the part on screen.

  • A file under 64 MB is counted through as soon as it opens, which gives the header its total. A bigger one is counted as far as you have looked, and further when line numbers or going to a line need it.
  • A run of more than 64 KB with no line ending is broken into lines; a red ↵ at the right edge marks a break the viewer made, not one in the file.

Changing the file

⇧F4 opens the file in the editor over the viewer, starting at the line at the top of your screen. When you close the editor, the viewer reads the file again and shows the line that was at the top of the editor. In a very large file the lines up to your place are counted first, which takes a moment.

Files that change

The viewer looks at the file once a second. When it has changed, the header says so, and nothing moves under you.

⌘R reads it again, keeping your place. A filter and a search’s mark are dropped.

Following a file that grows

Follow the end — or End pressed with the end of the file already on screen — keeps the end on screen as lines are added, the way a log is watched. Only what was added is read, so a big log costs no more than a small one. The header says following, and a last row reads following: new lines appear here · ↑ stops. Moving up in any way stops it, so nothing moves while you read further up.

  • Filtered, new lines that match are added to the matching lines.
  • Cut short or replaced, as logs are when they are rotated, the file is opened again at its new end, and the header says which happened.