The Kalem Book GitHub

This Book describes Kalem's main branch, which may be ahead of the latest release.

The file manager

Kalem has a file manager like Emacs's Dired. Ctrl+Alt+D lists the folder of the document with the cursor on its file, and goes back to the document; the toolbar's File Manager and Projects buttons, the File and Project menus and the palette get there too, and opening a folder (Ctrl+O, kalem FOLDER, :e FOLDER) lists it. A window has one file manager, which goes from folder to folder.

The normal view lists a folder: permissions, size, modification time and name, folders first. The projects view (Ctrl+Alt+Shift+D, or Projects in the Project menu) lists every project as if they were in one folder; P switches between the two, and the projects' menu (right click) opens a project, removes it from the list (the folder stays) or adds one. Going up from a project's folder shows the projects again; going up from the projects goes to the folder above the project at the cursor.

The listing is read-only text: the arrow keys, search, and with Vim keys j k gg G and / work as in any document. A click on a name opens it. Commands act on the marked entries, or on the one at the cursor.

Keys Command
Enter, click Open: a folder is listed, a file opens
^, -, Backspace Parent folder (from a project's folder: the projects)
n, p Next, previous line
P Projects view, and back
g Read the folder again
(, . Details; dot files
s Sort by name, time, size, extension
F Filter by name
m, u, U, t Mark, unmark, unmark all, toggle marks
d, x Flag for deletion; move the flagged to the trash
% m, * /, * . Mark by regular expression, folders, extension
* t Mark the entries changed since a time
i List the folder at the cursor below this one
K Take the listed folder at the cursor out again
c New file (a name ending with / makes a folder)
+ New folder
R, F2 Rename or move
C Copy
D, Delete Move to the trash (asks first)
S, M, T Symbolic link, permissions, touch
Ctrl+Z Undo the last rename, move or move to the trash
e Edit the names as text; Ctrl+S renames, Escape stops
% f Find by name under the folder (*.org, or a part)
A Search the text of the files under the folder
W Open with the system's application
! Shell command on the marked files (asks first)
v, Ctrl+T Preview pane; thumbnails of the pictures (graphical)
w Copy the names
q Close the file manager

The keys every file manager has work too, with Command in place of Ctrl on macOS:

Keys Command
Ctrl+C, Ctrl+X Copy, cut the marked entries (or the one at point)
Ctrl+V Paste them into the folder listed
Ctrl+A Mark all
Ctrl+N, Ctrl+Shift+N New file, new folder
Shift+Delete Delete for good (asks first)
Space Preview pane (not with Vim keys)
Alt+Enter Properties
Ctrl+click, Shift+click Mark one entry, mark a range

A right click (Shift+F10 or the Menu key from the keyboard) opens a menu with the usual entries of a file manager, from Open to Properties; the terminal shows it as a list to pick from, its groups parted by rules until something is typed. Delete for Good, Copy Paths, Reverse Order, Show in System File Manager and Stop File Operations are in the palette.

Copying and moving run in the background, with their progress in the status bar. When a file is already at the destination, Kalem asks: overwrite, skip, or keep both (name (2).ext), for that file or for all that are left. Ctrl+Z takes back the renames, moves and moves to the trash of this session, the last first. Cut and Copy keep the paths in Kalem's own file clipboard and put them on the system clipboard as text. In the graphical editor Paste also takes files copied in another application: the file list Finder or Explorer puts on the clipboard, or text whose every line is a file that exists, as a path or a file:// URI (what the Linux file managers give as text, with GNOME's cut line making it a move); Kalem's own copy wins when the clipboard holds the same paths. Pasting Kalem's files into Finder or Explorer as files does not work yet: the toolkit writes only text and pictures to the clipboard, so they paste there as their paths.

In the graphical editor, entries can be dragged (the marked ones when the line is marked): dropped on a listing, in another pane or the same one, they move into the folder under the pointer, or the listing's folder, with the same questions as Paste; with Alt (Option on macOS) held they are copied. Dropped on a document they are linked at the pointer, in its syntax: [[file:sub/b.org][b.org]] in Org, [b.org](sub/b.org) in Markdown, \href{…}{…} in LaTeX, relative to the document's folder when they are in it or below. Open in New Pane in the menu, or o as in Emacs, opens the entry beside the listing.

e makes the names editable, as Emacs's wdired does: change them with any editing command (old/a.txt moves the file there), then Ctrl+S renames them all at once, swaps included, and Escape leaves them as they were. Nothing changes when a name is empty or taken, or a line was changed outside its name; the edit stays to fix.

% f lists the files and folders under the folder, at any depth, whose names match a shell pattern (*.org) or contain the text given; they take marks and commands as other entries do, and ^ goes back. A searches the text of the files under the folder and opens a match at its line. i lists the folder at the cursor below the folder's own entries, as Dired does, and K takes it out again. * t marks the entries changed since an age (30m, 3d, 1w), today, yesterday or a date and time. ! runs a shell command on the marked files in their folder: a * standing alone is replaced by all of them, a ? runs the command once per file, as in Dired. In the graphical editor v shows the file at the cursor in a pane beside the listing, and Ctrl+T the listing's pictures as thumbnails.

With Vim keys the file manager's keys come first, except n, p, w and Backspace, which Vim keeps. From a document, - opens the file manager (as vim-vinegar and Doom do), and so do :Ex and :Explore; :Projects shows the projects. The keys are Doom Emacs's (its dired module with evil-collection and dirvish), listed below with what each does here or why it does not yet; the table is generated from tests/keys/doom-dired.toml, which the tests check against the keymaps.

Doom What it does In Kalem
j, k Next, previous entry Vim
h Parent folder dired.up
l Open the entry dired.open
- Parent folder dired.up
^ Parent folder dired.up
gg First entry dired.first
G Last entry Vim
gr Read the folder again dired.refresh
q Close the file manager dired.close
o Open in the other pane dired.openInPane
TAB Expand a folder in place No subtree expanded in place yet; I lists the folder below the listing (Dired's i), $ takes it out
i Vim's insert, for the editable listing; I lists a subfolder below Vim
I List a subfolder below dired.insertSubdir
$ Take a listed subfolder out dired.removeSubdir
m Mark dired.mark
u Unmark dired.unmark
U Unmark all dired.unmarkAll
t Toggle the marks dired.toggleMarks
* . Mark by extension dired.markExtension
* / Mark the folders dired.markDirectories
* * Mark the executables dired.markExecutables
% m Mark by regular expression dired.markRegexp
d Flag for deletion dired.flag
x Move the flagged to the trash dired.executeFlagged
C Copy dired.copy
R Rename or move dired.move
D Move to the trash dired.delete
+ New folder dired.mkdir
T Touch dired.touch
M Permissions dired.chmod
S Symbolic link dired.symlink
Z Compress to a zip, or extract an archive dired.compress
! Shell command on the files dired.shellCommand
& Shell command on the files (Kalem runs both in the background) dired.shellCommand
A Search the text of the files under the folder dired.searchFiles
Q Replace in the marked files Replacing in several files is not there yet; A finds the matches
% u Rename to upper case dired.upcase
% l Rename to lower case dired.downcase
% R Rename by regular expression dired.renameRegexp
= Compare with the file at point Kalem has no view of the differences between two files yet
yy, Y Copy the paths dired.copyPath
Y Copy the paths dired.copyPath
yn Copy the names dired.copyName
yr Copy the paths from the project (or the folder) dired.copyRelativePath
w Vim's word motion; yn copies the names Vim
( Details dired.toggleDetails
. Hidden files dired.toggleHidden
s Sort by name, time, size, extension dired.sort
N Narrow the listing dired.filter
v Preview pane dired.togglePreview
f File information dired.properties
a Quick access: the projects dired.projects
W Open with the system's application dired.openExternal
C-x C-q Edit the names as text dired.editNames
SPC . Open a file by path, from the listing's folder; a new name makes the file file.open
SPC f f Open a file by path, from the listing's folder file.open
SPC f D Delete the entry at point dired.delete
SPC f R Rename or move the entry at point dired.move
SPC f C Copy the entry at point dired.copy
SPC o - The file manager, and back dired.jump
SPC p D The project's folder dired.projectRoot