xC: expand behaviour.editor_command examples

This commit is contained in:
Přemysl Eric Janouch 2022-08-14 20:26:38 +02:00
parent 49d9980662
commit 0750096827
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 9 additions and 1 deletions

10
xC.c
View File

@ -2443,7 +2443,8 @@ static struct config_schema g_config_behaviour[] =
.default_ = "on",
.on_change = on_config_word_wrapping_change },
{ .name = "editor_command",
.comment = "VIM: \"vim +%Bgo %F\", Emacs: \"emacs -nw +%L:%C %F\"",
.comment = "VIM: \"vim +%Bgo %F\", Emacs: \"emacs -nw +%L:%C %F\", "
"nano/micro/kakoune: \"nano/micro/kak +%L:%C %F\"",
.type = CONFIG_ITEM_STRING },
{ .name = "process_pasted_text",
.comment = "Normalize newlines and quote the command prefix in pastes",
@ -13214,6 +13215,13 @@ build_editor_command (struct app_context *ctx, const char *filename)
&& !(command = getenv ("EDITOR")))
command = "vi";
// Although most visual editors support a "+LINE" argument (every
// editor mentioned in the default value of behaviour.editor_command,
// plus vi, mcedit, vis, ...), it isn't particularly useful by itself.
// We need to be able to specify the column number.
//
// Seeing as less popular software may try to process this as a filename
// and fail, do not bother with this "undocumented standard feature".
strv_append (&argv, command);
strv_append (&argv, filename);
return argv;