From 0dc5795d5ba4d5ef053398ee18f78e4f9f285443 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 11 Oct 2026 03:16:44 +0100 Subject: Fix todo.vim shell handling in Vim 9 on Windows I always used Neovim where this seemed to work but recently switched to Vim where it doesn't seem to work. I've now tested it in both and it seems fine. All zero other users of this script can now rejoice! --- tools/todo.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/todo.vim b/tools/todo.vim index 04c704d..cb73b2f 100644 --- a/tools/todo.vim +++ b/tools/todo.vim @@ -4,14 +4,19 @@ function! Todo(...) if exists("a:1") && a:1 != "" copen " cex "" | cadde to avoid insta-jumping - if &shell == "cmd.exe" - cex "" | cadde system("git grep -nF TODO(".shellescape(a:1).")") + if &shell !~ "(.*[\\/])?cmd\.exe" + " for some reason vim ties quoting behaviour to whether or not the + " user prefers forward slashes in their file paths. + let oldssl=&ssl + set nossl + cex "" | cadde system("git grep -nF TODO^(".shellescape(a:1)."^)") + let &ssl=oldssl else cex "" | cadde system("git grep -nF \"TODO(\"".shellescape(a:1)."\\)") endif else " just displaying like this for now... - if &shell == "cmd.exe" + if &shell !~ "(.*[\\/])?cmd\.exe" " FIXME: write a Windows batch equivalent!? in the meantime, you " need a Unix shell to track issues :^) cex "" | cclose | !sh tools/todo -- cgit v1.2.3-54-g00ecf