1

bug

This is what I get upon sending ls to powershell in Neovim. I have put vim.opt.shell="powershell.exe" in my init.lua file.

PS: it also happens when running the command w !clip.

4
  • 1
    I can reproduce the problem. Feb 20, 2023 at 15:53
  • also the w !clip problem? Feb 20, 2023 at 16:47
  • 1
    I only tried the first. Feb 20, 2023 at 17:00
  • 1
    With the w !clip and the settings bellow I have a different error message (Missing closing '}' in statement block or type definition) Feb 20, 2023 at 18:21

2 Answers 2

1

You can do (from this answer):

set shell=powershell.exe
set shellxquote=
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command '
let &shellquote   = ''
let &shellpipe    = '| Out-File -Encoding UTF8 %s'
let &shellredir   = '| Out-File -Encoding UTF8 %s'
4
  • is this proper lua? Feb 20, 2023 at 19:14
  • I assume I have to wrap this in a vim.cmd function, right? Feb 20, 2023 at 19:17
  • 1
    That this worth a try :-) Feb 20, 2023 at 19:21
  • 1
    The settings are pure VimScript. You have to convert to Lua. Feb 20, 2023 at 19:22
0

-- Set up the shell to be powershell

vim.o.shell = 'powershell.exe'
vim.o.shellxquote = ''
vim.o.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command '
vim.o.shellquote = ''
vim.o.shellpipe = '| Out-File -Encoding UTF8 %s'
vim.o.shellredir = '| Out-File -Encoding UTF8 %s'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.