12. Even better Neovim with Zellij terminal multiplexer
What I miss about Neovim is a way to call a terminal from it and open the terminal (the second terminal window below the Neovim window, see picture) the same way I'm working on.
To achieve this, I use Zellij , which is a terminal multiplexer.
The ## Zellij
Zellij configuration
allows you to create custom layouts that can be invoked at startup to better tailor them to the work you'll be doing.
The following is the configuration for working with the Neovi text editor. I saved this configuration under this path ~/.config/zellij/layouts/nvim.kdl
:
layout {
panel size=1 borderless=true {
plugin location="zellij:tab-bar
" }
panel {
command "nvim
" args ".
" }
panel split_direction="vertical" size="10%" {
}
panel size=2 borderless=true {
plugin location="zellij:status-bar
" }
}
The result is the following layout:
Nvim running in the top pane with the terminal console in another pane at the bottom, in the same path as the project I'm working with!!! and this is exactly the goal I wanted to achieve.
System Configuration
Now to run zellij with a custom layout and Nvim instance you need to run:
zellij --layout ~/.config/zellij/layouts/nvim.kdl
In the location (folder) in the terminal where you want to run Neovim.
Now to simplify this command, I created an alias znv
and saved it in my ~/.bashrc
file.
alias znv='zellij --layout $HOME/.config/zellij/layouts/nvim.kdl'
With this configuration, every time I need to create a new instance of Neovim, I just type znv in the directory I want to work with, and Zellij will call Neovim and automatically open the project.