Solution 1 - .vimrc as source
If in Vim everything works properly and if you have Neovim already installed, create the file init.vim
in Neovim directory with the command:
touch ~/.config/nvim/init.vim
Now open this file with any editor you like (I use Neovim for this example):
nvim ~/.config/nvim/init.vim
...and put following content into it:
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
Safe and close init.vim
with shift + ZZ
or :wq
.
If you now open a file with Neovim, the color scheme that is activated in Vim is activated in Neovim too.
Maybe this way can lead into trouble if you have already an init.lua
file in ~/.config/nvim/
directory.
If so, just rename init.lua
to foobarinit.lua
to see if your init.vim
works. Keep in mind, that everything of *.vim
is more important than *.lua
. So if you have, your Neovim plugins get disabled.
Solution 2 - init.lua as source
Like @Pixelbog said (tanks by the way), create a color directory in ~/.config/nvim/
directory:
mkdir -p ~/.config/nvim/colors
Copy your Vim color scheme into that directory:
cp ~/.vim/colors/myowncolorscheme.vim ~/.config/nvim/colors/myowncolorscheme.vim
Now open your init.lua
in ~/config/nvim/
with any editor you like (I use Neovim for this example):
nvim ~/.config/nvim/init.lua
...and put following content into it:
vim.opt.termguicolors = true
vim.cmd("colorscheme myowncolorscheme")
Safe and close init.vim
with shift + ZZ
or :wq
.
If you now open a file with Neovim, the color scheme is activated in Neovim.
The two vim.*
lines of init.lua
you can write in any *.lua
file in ~/.config/nvim/lua/*
directory, but then you have to require that file in init.lua
:
require("settings.core.options")
For this example the absolute path is ~/.config/nvim/lua/settings/core/options.lua
.
~/.config/nvim/colors/xy.vim
or something; usestdpath
or similar to find the appropriate place):help