Make settings editor launch robust
This commit is contained in:
10
wezterm.lua
10
wezterm.lua
@@ -155,7 +155,15 @@ local function open_config_section(window, pane, line)
|
||||
args = {
|
||||
"sh",
|
||||
"-lc",
|
||||
string.format('editor="${EDITOR:-vi}"; exec "$editor" +%d %q', line, config_file),
|
||||
string.format(
|
||||
'file=%q; line=%d; editor="${VISUAL:-${EDITOR:-}}"; '
|
||||
.. 'if [ -z "$editor" ]; then for candidate in nvim vim vi nano; do command -v "$candidate" >/dev/null 2>&1 && editor="$candidate" && break; done; fi; '
|
||||
.. 'if [ -z "$editor" ]; then echo "No terminal editor found. Set EDITOR or install vim/nano."; exec "${SHELL:-sh}"; fi; '
|
||||
.. '"$editor" +"$line" "$file"; status=$?; '
|
||||
.. 'if [ $status -ne 0 ]; then echo; echo "Editor exited with status $status. Press Enter to close, or type commands below."; exec "${SHELL:-sh}"; fi',
|
||||
config_file,
|
||||
line
|
||||
),
|
||||
},
|
||||
}),
|
||||
pane
|
||||
|
||||
Reference in New Issue
Block a user