Starting Neovim in a Separate Alacritty Window

Image for post
Image for post

I have been using Alacritty + Tmux as my default terminal for 2 years now and am very happy with it.

Vim is one of my go to editors. I use Neovim, a Vim fork with additional features. For any development activities I find it inconvenient to use Vim inside terminal as I will be using the terminal for various other things as well. I prefer a GUI. For Neovim there are a lot of GUIs available as mentioned in their wiki page. I have used VimR, Oni, gnvim and neovide. Among them I chose VimR as I find it very stable. However, none of these GUIs were as fast as Neovim running inside terminals like Alacritty.

Recently I came to know that, any number of Alacritty instances can be started using the alacritty commad. It has an option to start Alacritty with a different configuration. Also, we can pass a command the will be executed on startup. It even has a way to set a custom title in title bar. On looking at these options I got an idea of starting Neovim in a separate Alacritty window similar to a Neovim GUI.

> alacritty -h
alacritty 0.5.0 (a6681e3)
Christian Duerr <>
Joe Wilm <>
GPU-accelerated terminal emulator

alacritty [FLAGS] [OPTIONS]


-e, --command <command>... Command and args to execute (must be last argument)
--config-file <config-file>
Specify alternative configuration file [default: $HOME/.config/alacritty/alacritty.yml]
-t, --title <title> Defines the window title [default: Alacritty]
--working-directory <working-directory> Start the shell in the specified working directory

I started of with creating a new Alacritty configuration because my default configuration makes Alacritty enter a tmux session on startup. Also, I wanted to keep my Alacritty Terminal configuration and Alacritty Neovim configuration separate.

Then I was able to launch Neovim like this:

> alacritty --config-file ~/.config/alacritty/anvim.yml --title nvim  -e $SHELL -lc "nvim"
Image for post
Image for post

Nice. But this has few issues:

So, how do we solve these? I wrote a shell function called anvim. It starts the alacritty process in the background and will ignore any hungup signal. So it won't be killed even if we close the terminal/tmux pane. It is also capable of opening $PWD or a given directory or file.

# alacritty neovim
anvim() {
if [ -n "${1}" ]; then
local target=$(realpath $1)

nohup alacritty --config-file ~/.config/alacritty/anvim.yml -t "nvim - ${target}" -e $SHELL -lc "nvim ${target}" >/dev/null &
Image for post
Image for post

As you can see in the screenshot, I did anvim . within ~/dotfiles directory and it is opened in Neovim inside a new Alacritty window. The title is also set appropriately in the Alacritty window.

Alacritty Neovim configuration I use and the anvim function is available in my dotfiles repo as well:

Note: This is not a full-fledged Neovim GUI. All it does is separates the Neovim editor from the main Alacritty instance like how a Neovim GUI but without compromising performance benefits provided by Alacritty.

Originally published at

Open Source | DevOps | Infrastructure | Backend | Ployglot Programmer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store