I have tried adding this line to the init.lua but it doesn't work and I don't understand the syntax:

local g:terminal_emulator="powershell"

I get an error upon running the source command: it says unexpected symbol near :

2 Answers 2


In Lua the syntax is slightly different.

I would do:



vim.api.nvim_set_var('terminal_emulator', 'powershell')
  • Now good luck to me finding out what is the exacting thing I should write in place of 'powershell' :( Commented Feb 18, 2023 at 15:42
  • Is this for bang commands? Because it doesn't seem to work. I always get 'an unknonwn element was received' error Commented Feb 20, 2023 at 14:16
  • 1
    The shell option is used to create the terminal in which the :! command run. See the other answer. Commented Feb 20, 2023 at 14:39

If you want to configure the :terminal command you have to change the 'shell' setting instead.

In Lua you can do with

vim.opt.shell = 'powershell.exe'
  • Thanks. This is the answer I am looking for. Commented Jun 18 at 2:54
  • @khoinguyen Thanks for the feedback :-) Commented Jun 18 at 4:08

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.