Windows Neovim garbled external command results

Asked 1 years ago, Updated 1 years ago, 437 views

Running Neovim (nvim-qt.exe) in Windows 10 and reading tutorials in :Tutor.
The version is 0.8.1.

:!ls was instructed to run, so I ran it, and the result was garbled as follows:

'ls'<82>A<93>... (continued)

Perhaps when you run ls on a command prompt,

 'ls' is an internal or external command.
Not recognized as an operational program or batch file.

I expect the to be displayed with a character code that is not shift-jis.
(:!dir did not change the parts that would have been in Japanese.)

I have two questions.

That's it.

windows vim neovim

2022-12-07 06:15

2 Answers

The following methods were introduced to call PowerShell instead of cmd as an external command, although we did not actually try a partial answer:

To invoke pwsh.exe (PowerShell Core), replace it with set shell=pwsh.

How do I make neovim use Powershell for external commands?

You can paste these lines to your vimrc (vim:C:\Users\<username>\_vimrc, neovim:C:\Users\<username>\AppData\local\nvim\init.vim) to make the change to apply.

set shell=powershell
set shellcmdflag=-command
set shellquote=\"
set shellxquote=


2022-12-07 07:03

: Is there a way to ensure that ! runs commands on pwsh instead of cmd?
That's it.

I tried to set the powerhell or powerhell pathname for the neovim variable shell, but I couldn't change the shell to powerhell.
この I don't mean to say that this method.It's just that I tried it and it didn't work.

If you really want to run the powerhell command,

: !powershell pwd

You may want to specify the commands to run with powershell as shown in .

[src=

]


2022-12-07 07:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.