如何使用命令行通过 Far Manager 编辑器打开文件,而无需启动新的 Far 实例?

如何使用命令行通过 Far Manager 编辑器打开文件,而无需启动新的 Far 实例?

语境

当我使用 Far Manager 时,我想打开 Far Manager 编辑器,而无需导航到文件(可能位于另一个驱动器、文件夹等)并按 F4。

相反,我想使用命令行打开文件:

c:>\<command in question> <full path to the file>

我知道该far /e <file name>命令,但我不想打开 Far Manager 的新实例

问题

我怎样才能完成这个任务?

答案1

您可以执行路径前面带有 的命令edit:。例如:

  • edit:C:\Windows\win.ini
  • edit:[10,] C:\Windows\win.ini(打开并编辑,光标位于第 10 行)
  • edit:[10,3] C:\Windows\win.ini(打开并编辑,光标位于第 10 行第 3 列)
  • view:C:\Windows\win.ini(查看)

带有方括号的文件名:

  If the filename contains square brackets (for example: "[1].txt"), then for the correct
opening of the file in the editor you must provide at least one delimiter (e.g. a space)
before the filename, or enclose it in quotation marks:

  edit: [1].txt
  edit:"[1].txt"

FAR Commands plugin该功能由(默认安装)提供。

  The FAR Commands plugin (FARCmds) provides a number of additional commands available in
command line via prefixes.

  In addition, the commands can be used in User Menu, in file associations, and in dialog
Apply Command (Ctrl-G)


 Command Line Syntax

  command:[options] object

  command - one of the following:
            view     - viewer
            edit     - editor
            goto     - jump to a file or folder
            clip     - put data in the clipboard
            whereis  - locate and jump to an object
            link     - create links
            run      - execute commands
            load     - load plugin
            unload   - unload plugin

  options - optional parameters, see corresponding commands descriptions.

  object  - one of the following:
            filename - name of the file to be viewed, edited or jumped to.
            path     - file or directory path to jump to.
            <command - intercept output of operation system command. Symbol < is obligatory.

我经常使用文件历史记录 ( Alt-F11) 重新打开文件。您可以轻松打开最近访问的文件之一(F3查看、F4编辑、Enter将其作为上次打开),或者使用 , 在历史记录中搜索特定名称Ctrl-Alt-Fwin.in

╔═══════════════════════════════ [win.in] ════════════════════════════╗
╟────────────────────────────── 19.03.2023 ───────────────────────────╢
║  Edit: C:\Windows\win.ini                                           ║
║                                                                     ║

相关内容