Skip to content

enhancement: add option for using Powershell as shell #1788

Open

Description

@eamonburns

In neovim/neovim#36881, documentation was added to show how to use powershell.exe (or pwsh.exe) as the shell. I have ported the VimScript to Lua:

if vim.fn.has("win32") == 1 then
  vim.o.shelltemp = false
  local shellcmdflag = "-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command "
  shellcmdflag = shellcmdflag .. "[Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();"
  shellcmdflag = shellcmdflag .. "$PSDefaultParameterValues['Out-File:Encoding']='utf8';"
  vim.o.shellpipe = "> %s 2>&1"
  vim.o.shellquote = ""
  vim.o.shellxquote = ""

  if vim.fn.executable("pwsh.exe") == 1 then
    vim.o.shell = "pwsh.exe"
    shellcmdflag = shellcmdflag .. "$PSStyle.OutputRendering = 'PlainText';"
    vim.env.__SuppressAnsiEscapeSequences = "1"
  else
    vim.o.shell = "powershell.exe"
  end
  vim.o.shellcmdflag = shellcmdflag
end

Activity

  1. oriori1703 commented on Mar 10, 2026

    @oriori1703
    Collaborator

    I suspect this might be too niche, because I don't think there are a lot of windows neovim users.
    Despite that I will leave this issue open for now and if there is enough support I will reconsider :)

  2. nevillio commented on Apr 8, 2026

    @nevillio

    I'd certainly appreciate this

  3. added a commit that references this issue on Apr 10, 2026
  4. added a commit that references this issue on Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions