echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.45k stars 171 forks source link

Potential Issue with Windows OS Paths on opening COMMIT_EDITMSG buffers - Mini.Git #1006

Open jayhowey opened 2 days ago

jayhowey commented 2 days ago

Contributing guidelines

Module(s)

mini.git

Description

On Windows 10, using Neovim 0.10 stable, the Mini.Git :Git commit command gives the following error which might be related to escaping backslashes ( \ ) in Windows paths:

ErrorMessage

My troubleshooting so far has shown that when no spaces are present in the path to the nvim executable, escaping the backslashes is enough to resolve the problem, allowing the _COMMITEDITMSG buffer to open:

Adding editor = string.gsub(editor, "\\","\\\\") at line 686 git.lua for example can work,

https://github.com/echasnovski/mini.nvim/blob/b8c1d3b2f4cd637760babb8a33ad12fd5afe2ee2/lua/mini/git.lua#L683-L686

However, this fix is incomplete where the path to the nvim executable is something like "C:\Program Files\neovim\bin\nvim.exe" etc. (where the path to nvim.exe contains a space character)

THANK YOU 1000x+ for MINI.NVIM - mini is excellent and has replaced all but 2 of the plugins I use (colorschemes). I'm happy to help here however I can. Thanks!

Neovim version

0.10

Steps to reproduce

  1. nvim file_to_edit
  2. :Git add %
  3. :Git commit
  4. :messages to see the error message again.

Expected behavior

Mini.Diff can reach the nvim executable, Mini.Diff then opens a new _COMMITEDITMSG and the (Windows) user edits the commit message as-usual. On a :wq the commit is made to the local repository:

CommitMessageTab

Actual behavior

Neovim :messages area shows an error message, _COMMITEDITMSG buffer fails to open:

ErrorMessage

echasnovski commented 1 day ago

Thanks for the issue!

Yeah, escaping special characters seems to be needed here. As I can not reproduce this on Linux, would you mind testing a solution (similar to yours) in the git-escape branch? If you could check it with both use case in this issue and the one with spaces (like "C:\Program Files\neovim\bin\nvim.exe" you describe), I'd be really grateful.

jayhowey commented 1 day ago

aa06718 Fixes this for me! This commit solves my issue.

Thank You So Much - I really appreciate your fast attention to this issue and the effort on preparing a fix. This has been a great and encouraging exchange with the benevolent maintainer of mini.nvim.

I confirm that aa06718 fixes #1006, based on the following quick check:

echasnovski commented 1 day ago

Thanks for the confirmation!

I'll reopen this until the fix is in the main branch (hopefully tomorrow).