English | 日本語
XeFM can hand files straight to your text editor. Put the cursor on a file —
or select several — and choose File → Open With ▸ Text Editor (edit_files): XeFM steps aside while the
editor runs and comes back automatically when you save and quit. Any editor
that takes filename arguments works.
edit_files). With a selection, every selected file is passed to the editor in
one launch (vim a.txt b.txt), so you get one session over all of them.Files on SSH and S3 panes can be edited too: XeFM edits a local copy and
uploads it each time you save — see Remote Editing.
Files inside archives are read-only and can’t be edited in place. Directories
(and the .. parent) can’t be edited, and a warning is shown if you try; in a
mixed selection they are simply skipped. edit_file edits only the file
under the cursor, whatever is selected; no preset binds it. The key of
edit_files depends on
your keymap preset — see Keymap Presets — and can be rebound in your
config’s KEY_BINDINGS.
When you run edit_files or edit_file, XeFM picks the editor like this:
edit entry in FILE_ASSOCIATIONS wins — so you can send,
say, images to an image editor and .md files to a Markdown app. If an
entry is set explicitly to None, that file type has no editor and XeFM
won’t fall back. See File Associations.TEXT_EDITOR setting is used.Set TEXT_EDITOR in ~/.xefm/config.py:
class Config:
TEXT_EDITOR = 'nano' # your preferred editor
If the editor needs arguments, write the setting as a list — each element is one argument, exactly as typed on a command line:
class Config:
TEXT_EDITOR = ['code', '--wait'] # terminal: wait for the tab to close
TEXT_EDITOR = ['wt', 'nt', 'vim'] # vim in a new Windows Terminal tab
TEXT_EDITOR = [r'C:\Program Files\Vim\vim.exe'] # a path with spaces
Use the list form on Windows whenever the command is a full path: a plain string is split the way a POSIX shell would, which eats the backslashes.
In terminal mode XeFM waits for the editor to exit. A launcher that opens the
editor elsewhere — wt, or a GUI editor without a wait flag — returns as soon
as it has handed the file over, so XeFM comes back immediately rather than when
you finish editing. What you save then shows up the way any outside change
does; see File Monitoring.
In the desktop app XeFM does not block on the editor: it opens in a window of
its own and XeFM’s window keeps responding, even with a wait flag such as
code --wait or subl -w. A terminal editor runs in XeFM’s own terminal
there, as a terminal session, once you mark it:
class Config:
TEXT_EDITOR = {'command': 'vim', 'terminal': True}
XeFM then knows when you are done, as in terminal mode: Edit Configuration
reloads when the editor exits. 'terminal': False does the opposite in
terminal mode: a GUI editor starts in the background instead of taking the
screen. See Terminal.
The shipped default depends on how you run XeFM: vim in a terminal, and VS Code
(code) in the desktop app. Common choices include vim, nano, emacs,
code (VS Code), subl (Sublime Text), and gedit. In terminal mode, prefer a
terminal editor (vim, nano, emacs) so it can take over the screen; in the
desktop app, a GUI editor works well.
If the configured editor can’t be found or exits with an error, XeFM reports it and restores the file view.
TEXT_DIFF sets the external merge / diff toolview_file)