How to automate opening NeoVim inside WSL of Alacritty Terminal?

263 views Asked by At

I'm on Windows 11, and trying to automate the following with a .bat script:

  1. Create a new instance of Alacritty terminal
  2. Enter WSL inside of the Alacritty terminal
  3. Open NeoVim after entering WSL

I have gotten as far as steps 1 and 2, but cannot seem to work out step 3. This is what my .bat file looks like right now:

@echo off
start "" "C:\Program Files\Alacritty\alacritty.exe" -e wsl
exit

I have tried adding -e nvim, but that just causes this error:

<3>WSL (398) ERROR: CreateProcessEntryCommon:577: execvpe nvim failed 2
<3>WSL (398) ERROR: CreateProcessEntryCommon:586: Create process not expected to return

In addition, replacing -e wsl with -e "wsl nvim" gives me command not found, even though I have confirmed that NeoVim is added to my $PATH in WSL.

1

There are 1 answers

2
FrackinFamous On

I recommend to have your .bashrc start Neovim when it is sourced upon Linux loading up.

Meaning add bash nvim to your .bashrc file on the WSL side to immediately start neovim once your script switching to WSL ends.