在linux中我使用了类似的东西
autocmd FileType cpp nmap <buffer> <F5> :w<bar>!g++ -o %:r % && ./%:r<CR>
但由于 Windows 使用反斜杠,我想我应该尝试类似
autocmd FileType cpp nmap <buffer> <F5> :w<bar>!g++ -o %:r % && .\\%:r<CR>
或者
autocmd FileType cpp nmap <buffer> <F5> :w<bar>!g++ -o %:r % && ./\%:r<CR>
但他们似乎都没有给出预期的结果。了解 vim 脚本的人可以更好地帮助我解决这个问题。我也尝试过其他组合,但似乎没有任何效果。而不是赌博我可能会问的更多想法