Skip to content
kaiport

Editor

Edit text files from the file browser and the transfer view in their own windows, save them straight back to the server, or use an external editor.

kaiport has a built-in code editor for text files from the file browser and the transfer view. Every file opens in a window of its own, and saving writes it straight back where it came from – over SFTP, FTP, S3, WebDAV, Azure or to your own disk. If you prefer your usual editor, kaiport can open files there instead.

The editor window with a configuration file, syntax highlighting and the AI Pilot assistant on the rightThe editor window with a configuration file, syntax highlighting and the AI Pilot assistant on the right

Open a file

  • In the file browser of a terminal tab: double-click a text file or click Edit in its row.
  • In the transfer view: the same, on either side.

Each file gets its own window, and you can open as many as you like; new windows appear slightly offset so they don't cover each other. If a file is already open, kaiport brings its window to the front instead of opening it twice.

The editor opens text files up to 2 MB. Binary files are downloaded instead, see Open and edit files.

The editor works through the connection of the tab you opened the file from. Keep that tab open until you've saved. If its connection drops, reconnect the tab and save again; if you close the tab, saving fails with No active session for file access.

The editor window

The toolbar at the top shows the file name – with a dot while there are unsaved changes – and the full path, followed by these buttons:

ButtonWhat it does
FindOpens the search and replace bar (⌘FCtrlF).
Word wrapWraps long lines at the window edge. kaiport remembers the choice for all editor windows.
AI PilotOpens the assistant next to the text.
SaveSaves the file (⌘SCtrlS). Available as soon as there are unsaved changes.

The status bar at the bottom shows the cursor position (for example Ln 12, Col 5), the number of lines, the indentation (2 spaces or Tabs), the line endings (LF or CRLF) and the language, or Plain text. Messages such as Saved. appear on its right.

What the editor can do

The editor is based on CodeMirror:

  • Syntax highlighting for about 140 languages, chosen by the file name. kaiport also recognizes files without a telling extension: shell startup files such as .bashrc, .zshrc or .profile, Dockerfile and Containerfile, configuration and systemd files such as .conf, .ini or .service, environment files like .env or .env.local, JSON variants and files like README or CHANGELOG as Markdown.
  • Line numbers, a highlighted current line and code folding with the arrows next to the line numbers.
  • Bracket matching, and brackets and quotes close automatically.
  • Multiple cursors and rectangular selection.
  • Other occurrences of the selected text are highlighted.
  • Search and replace with options for upper and lower case, regular expressions and whole words.
  • Undo and redo.

The editor uses the font and font size of the terminal from Settings → Terminal. Tab characters are four columns wide.

Keys

ActionKeys
Save⌘SCtrlS
Find and replace⌘FCtrlF
Next or previous match⌘GCtrlG or ⌘⇧GCtrlShiftG
Go to line⌘⌥GCtrlAltG
Select the next occurrence⌘DCtrlD
Select all occurrences⌘⇧LCtrlShiftL
Add a cursor⌘Ctrl-click
Rectangular selection⌥Alt-drag
Indent or outdentTab or ShiftTab
Fold or unfold the block⌘⌥[CtrlShift[ or ⌘⌥]CtrlShift]
Undo or redo⌘ZCtrlZ or ⌘⇧ZCtrlY
Close the window⌘WCtrlW

Indentation, line endings and encoding

  • Indentation: kaiport looks at how the lines of the file are indented – tabs or spaces, and how many – and uses the same for new lines and for Tab. If the file gives no hint, it uses the convention of the language: tabs for Go, four spaces for Python, Rust, C, C++, C#, Java, Kotlin, PHP, Swift, Shell, Lua, Perl, PowerShell and Objective-C, two spaces for everything else.
  • Line endings: LF or CRLF, whichever the file mostly uses. Saving keeps them.
  • Encoding: the editor reads and writes files as UTF-8.

Colors

The editor takes its colors from your terminal color scheme – keywords, strings, comments and so on get the scheme's colors. In dark mode, it uses your scheme if it's a dark one and kaiport Dark otherwise; in light mode, your scheme if it's a light one and GitHub Light otherwise. See Appearance.

Save

Press ⌘SCtrlS or click Save. kaiport writes the file back through the connection it came from: SFTP for SSH connections, FTP or FTPS, S3, WebDAV, Azure, or your own disk. The status bar confirms with Saved.; if saving fails, it shows Saving failed: with the reason, and your changes stay in the editor.

Unsaved changes

While a file has unsaved changes, its name shows a dot, and the window title does too; on macOS, the close button of the window shows it as well. If you close the window then, kaiport asks Discard changes?:

  • Cancel keeps the window open.
  • Discard closes the window without saving.
  • Save and close saves the file and closes the window. If saving fails, the window stays open.

AI Pilot in the editor

AI Pilot is part of kaiport Pro. AI Pilot in the toolbar opens an assistant next to the text. It explains the file or a selection, changes it on your instruction or generates new content. Its results are a preview: they only go into the editor when you click Apply, and into the file when you save. See AI Pilot in the editor.

Use an external editor

To open files in another application, go to Settings → Editor and set Editor to External. Then choose the Application:

OptionWhat opens your files
System default applicationThe program your system uses for this kind of file.
One of the listed editorsAn editor kaiport found on your computer, see Editors kaiport finds.
Custom command …The command line you enter in Command, see Custom command.

Editors kaiport finds

SystemEditors kaiport looks for
macOSVisual Studio Code, Visual Studio Code – Insiders, Cursor, Zed, Sublime Text, Atom, TextMate, BBEdit, Nova, CotEditor, TextEdit
WindowsVisual Studio Code, Visual Studio Code – Insiders, Cursor, Zed, Sublime Text, Notepad++, Notepad
LinuxVisual Studio Code, Visual Studio Code – Insiders, Cursor, Zed, Sublime Text, gedit, GNOME Text Editor, Kate, Mousepad, Xed, Pluma, Geany

The list shows only the editors that are installed. On macOS, kaiport looks in the Applications folders, on Windows in the usual installation folders, and on Linux for the programs on the PATH. If the chosen editor is no longer installed, kaiport uses the system default application.

Custom command

Enter a command line in Command, for example:

text
code --wait "{file}"

{file} is replaced by the path of the file; without {file}, kaiport appends the path at the end. Quotes work as in a shell, but the command doesn't run in a shell, so pipes or variables aren't available. If the program isn't found, enter its full path.

How files are synced

  1. kaiport downloads the remote file into a temporary folder (kaiport-edit in the temporary directory of your system).
  2. It opens the copy in the chosen application.
  3. Every time you save there, kaiport uploads the copy again, right after the file has settled. A system notification confirms it: Uploaded – name was saved and uploaded. – or reports Upload failed with the reason.

Files on your own computer – on the left side of the transfer view – open directly, without a copy.

Uploads only happen while the connection of the tab is open. When you close the tab, kaiport stops watching the copy. If the connection is gone when you save, kaiport stops watching as well; open the file again after reconnecting, and save it once more.