Problem:
Neovim no longer ships with a tee binary on Windows, which breaks
functionality for the :grep and :make commands.
nvim --clean
:grep foo or :make
"tee is not recognized as an internal or external command"
Solution:
Include a simple, no-dependency tee.c source file in the src/ directory.
Update CMakeLists.txt to build a tee executable alongside neovim during
the build process, and ensure the tee.exe program appears alongside the
neovim executable in the bin/ directory so that it is accessible for
:grep and :make.
tee.c was obtained from the vim codebase:
https://github.com/vim/vim/blob/master/src/tee/tee.c
And we modified it to fix performance issues.
Testing:
nvim --clean
:grep foo or :make, after setting a file to the makeprg option.
Verify that :grep results and error output from a compiler appear in the message pane.
ref https://github.com/neovim/neovim/issues/32431
fix https://github.com/neovim/neovim/issues/32504
Other tee options:
- [tee-win32](https://github.com/dEajL3kA/tee-win32): MIT. However,
I couldn't get it to build on my machine even after updating its
makefile to call my install of MSVC. It's also super optimized and
uses some processor intrinsics for multithreading.
- [gnu coreutils tee](https://gnuwin32.sourceforge.net/packages/coreutils.htm):
(Windows coreutils contains a tee.c. Last updated 2005. Did not build
immediately on my machine; we'd have to determine which definitions
from elsewhere in coreutils tee.c needs and incorporate them somehow.
- [WinTee](https://github.com/mpderbec/WinTee): Has no license. Last
updated 11 years ago. Relies on Visual Studio to build.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>