marta-file-manager / marta-issues

An issue tracker for Marta File Manager.
https://marta.yanex.org/
366 stars 0 forks source link

Support for configuring absolute paths and execution parameters for external text editors #775

Open page-down opened 3 years ago

page-down commented 3 years ago

Currently the external text editor can only set the application name, which has many problems.

For example, when set to Sublime Text, it cannot be opened with a new Tab on an already open window.

If you can specify a custom external text editor command, you can set any parameters you like, such as a new Tab in one of the Terminal's Windows to start a command line text editor for editing.

yanex commented 3 years ago

Thanks! Can you please provide some use-cases so I can test if they're working properly after the change?

page-down commented 3 years ago

The following is an example of how to open a file for text editing in tmux using an editor.

(1) Prepare a background tmux session.

# create tmux session without attach
tmux new-session -d -s editor-session
# list sessions
tmux list-session

(2) Attach on the Terminal of your choice. For example, the built-in Terminal.

tmux attach -t editor-session

(3) Use the following custom action.

gadgets [
    {
        id "gadget.action.tmux-edit"
        name "Edit in tmux Editor Session"
        type "executable"
        executable "/usr/local/bin/tmux"
        args [ "new-window" "-t" "editor-session" "-n" "${current.file.name}" "vi" "${current.file.path}" ]
    }
]
keyBindings {
    "F4" "gadget.action.tmux-edit"
}

The custom Action will execute the tmux New Window command, create a window in the specified session, and open the file using vi command.

After improving the external editor configuration, you can try it out.


However, I think limiting the external editor to text editing is too restrictive.

(1) Why can't I edit pictures or anything else? The custom Action I use determines the file type and when the file is an image, it is opened using an external image editor.

(2) Why can I open only one external editor at a time? For example, the custom Action I'm using opens two programs when open a Markdown file. In addition to the text editor, it also opens a Markdown renderer that previews the file in real time. (Only if the opened file is in some of my project folders.)

Since there is no user community yet, I don't have a good way to share and learn.


Quick question:

Do you think it's a good idea to be able to put the built-in Terminal on the left and right pane? The height is now a bit insufficient if placed below, and the width is too wide for text editing.

Can be used for quick text file preview or edit with the very simple example above.

If you think this would work, I can submit a separate issue.