1

I want to use ! with powershell. I use neovim natively on windows.

I tried these settings

set shell=powershell.exe
set shellcmdflag=-NoProfile\ -NoLogo\ -NonInteractive\ -Command
set shellpipe=|
set shellredir=>

as suggested here https://robindouglas.uk/powershell/vim/2018/04/05/PowerShell-with-Vim.html

They don't work (having nvim -u NONE from cmd or neovim-qt). They simply return the same command I typed.

I tried using this and additionally, set set shellquote=\" I get on !ls:

+ ""ls""
+   ~~~~
Unexpected token 'ls""' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

1

1 Answer 1

1

OK, I didn't notice it . There is actually in help shell-powershell

The settings are

        let &shell = has('win32') ? 'powershell' : 'pwsh'
        let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
        let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
        let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
        set shellquote= shellxquote=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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