Skip to content

os.editAtLineAndWait doesn't handle quotes correctly #5560

@ahmetsait

Description

@ahmetsait

Describe the bug

editAtLine: '"C:\Program Files\Notepad++\notepad++.exe" -n{{line}} {{filename}}'

works, but

editAtLineAndWait: '"C:\Program Files\Notepad++\notepad++.exe" -multiInst -nosession -noPlugin -n{{line}} {{filename}}'

fails with 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

To Reproduce

Steps to reproduce the behavior:

  1. Use the following editor commands:
    # %LOCALAPPDATA%\lazygit\config.yml
    os:
      edit: '"C:\Program Files\Notepad++\notepad++.exe" {{filename}}'
      editAtLine: '"C:\Program Files\Notepad++\notepad++.exe" -n{{line}} {{filename}}'
      editAtLineAndWait: '"C:\Program Files\Notepad++\notepad++.exe" -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
  2. Try to trigger "edit" by pressing e on a file.
  3. Try to trigger "editAtLine" by pressing e inside patch panel.
  4. Observe that both of these work without issues.
  5. Try to trigger "editAtLineAndWait" by pressing upper-case E (edit hunk) inside patch panel.
  6. Observe the failure to launch the editor.

Expected behavior

editAtLineAndWait should work the same way as editAtLine and properly launch Notepad++.

Version info:

commit=d167063b4f45d044524f3fba97f850d1eec3f95c, build date=2026-04-13T20:06:40Z, build source=binaryRelease, version=0.61.1, os=windows, arch=amd64, git version=2.54.0.windows.1

Terminal info:

Windows Terminal, Version: 1.24.10921.0

Additional context

What I've tried to make it work so far:

editAtLineAndWait: 'C:\\Program\ Files\\Notepad++\\notepad++.exe -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
editAtLineAndWait: 'C:\Program^ Files\Notepad++\notepad++.exe -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
editAtLineAndWait: 'C:\Program" "Files\Notepad++\notepad++.exe -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
editAtLineAndWait: '\"C:\\Program Files\\Notepad++\\notepad++.exe\" -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
editAtLineAndWait: '\"C:\\Program\ Files\\Notepad++\\notepad++.exe\" -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
editAtLineAndWait: '\"C:\Program Files\Notepad++\notepad++.exe\" -multiInst -nosession -noPlugin -n{{line}} {{filename}}'
editAtLineAndWait: '''C:\Program Files\Notepad++\notepad++.exe'' -multiInst -nosession -noPlugin -n{{line}} {{filename}}'

All failing the exact same way.



I believe a better way to implement command configs is to make them arrays instead. This would allow lazygit to handle quotes correctly for all platforms/shells and remove any guess-work for the user.

editAtLineAndWait: ['C:\Program Files\Notepad++\notepad++.exe', '-multiInst', '-nosession', '-noPlugin', '-n{{line}}', '{{filename}}']

I don't know how easy it is to allow both arrays and strings for the same key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions