brainfucksec / neovim-lua

Neovim KISS configuration with Lua
GNU General Public License v3.0
826 stars 116 forks source link

Unable to change default colorscheme #8

Closed ghost closed 2 years ago

ghost commented 2 years ago

I can change the colorscheme with :colorscheme monokai/rose-pine command while running Neovim, but I'm unable to set the default colorscheme editing files. So I have edited these lines:

colors.lua line 7 as require('monokai').setup { colors.lua line 11 as require('monokai').load() statusline.lua line 16 as local colors = require('core/colors').monokai

And this is the error: 1232321

ghost commented 2 years ago

I've downloaded and tried other neovim themes too but still no luck. This config somehow only accepts onedark as default colorscheme.

brainfucksec commented 2 years ago

Hi @xagrick, for monokai color scheme you don't need the load() instruction.

Add only this line in the ${HOME}/.config/nvim/lua/core/colors.lua

require('monokai').setup{}

Then in the ${HOME}/.config/nvim/lua/core/statusline.lua:

local colors = require('core/colors').monokai

See: Neovim Monokai: usage

ghost commented 2 years ago

Thank you, after some time of troubleshooting I did figure out that too, every color scheme has it's own way of activating.

ghost commented 2 years ago

@brainfucksec How can I add and configure new themes? For example right now I'm trying to make this color scheme default: https://github.com/Mofiqul/dracula.nvim

I've added this use 'Mofiqul/dracula.nvim' line in packer_init.lua file and ran :PackerSync command, how do I configure it as default?

brainfucksec commented 2 years ago

Always in the ${HOME}/.config/nvim/lua/core/colors.lua file, add:

vim.cmd[[colorscheme dracula]]

Generally the instruction above or the Lua instruction is used:

require.('color_scheme_name').setup{}

It depends on how the color scheme was written. As for the statusline (feline.nvim), I added the color schemes by writing the colors manually, You can add your own color scheme in the ${HOME}/.config/nvim/lua/core/colors.lua file, see: "Themes" in the feline.nvim README.

The version of dracula you want to use also allows you to import them. See: https://github.com/Mofiqul/dracula.nvim#-importing-colors-for-other-usage

The configuration of Neovim with Lua is not complex but requires some practice, I suggest you to start from the guides listed in the README of this project: https://github.com/brainfucksec/neovim-lua#guides-and-resources