Closed silverqx closed 2 years ago
target build-221
I have tested it, and now the generated command doesn't contain /C
, but when the file contains whitespace it fails, the generated command looks like this:
vim E:/some dir/file.txt
So it opens empty file, still doesn't work correctly, it has to be quoted when it contains dangerous characters. @adamyg
Further work required to quote args
Yesterday, before I had gone to the bed, I have little looked at source code on GitHub ( not in an ide, so it might not be accurate ) and it looks like the file paths are passed without quotations for win and also for UNIX systems, on UNIX it works without problems. ( I checked this on my Gentoo install, but I will not describe it here ).
The call chain I have find out is edit_cmd()
-> do_edit()
-> edit_file_at_line()
-> execute_external_editor_or_viewer()
... -> w32_shell()
, ..., the path what_vpath
which is obtained by fname = vfs_path_from_str (selection (current_panel)->fname);
here is unquoted.
This path should be quoted somewhere around execute_external_editor_or_viewer()
, I practically don't know anything about mc source code and it was 15min lookup to source code on github, so I can still be wrong. 🙂🤙 @adamyg
Build-222 pending
At least I was able to set Notepad3 as external editor with env variable EDITOR. It works as it should.
Maybe does one know how to let mc open multiple files with external editor? Now mc panels are blocked (black screen) when file is opened with editor. Something like "&" at the end of command...
Neither options are currently available; open an enhancement ticket and i'll consider
Hi,
I'm not able to setup up an external vim editor on windows. I'm using mc 4.8.24.
mc correctly picks up EDITOR env. variable, but the final command looks like this:
So vim tries to open two files:
The second problem is that file is not quoted, so when the command line looks like this:
Then it tries to open two folders and one file dir/file.txt.
I have also tried to add External parameters as is described in man pages:
But without success, it looks like mc ignores this section, in the manpages is written: "The option name should be equal to the name (full pathname) of external editor or viewer."
I have tried various combinations.
The problem is also described here: https://superuser.com/questions/1119591/defining-midnight-commanders-external-editor-on-windows I have also created an issue on mc's trac issue track and some good guy tell me that a dedicated project exists for windows support, ticket is here.
Anyway, it is not crucial whether
[External editor or viewer parameters]
works or not on windows, would be absolutely enough to correctly generate external editor command on windows.That means remove that
/C
parameter from the beginning or replace it with -C because startup parameters for vim have to start with a dash and quote filepaths.