Created
September 24, 2022 23:58
-
-
Save VonHeikemen/921556b7870b6135799c3b0fb8085974 to your computer and use it in GitHub Desktop.
Separate NvChad's configuration from Neovim's default configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/' | |
local join = function(...) return table.concat({...}, path_sep) end | |
local getpath = function(arg) | |
local path = vim.fn.stdpath(arg) | |
return vim.fn.substitute(path, [[\(.*\)\zsnvim]], 'nvchad', '') | |
end | |
local user_path = getpath('config') | |
local data_path = getpath('data') | |
local chad_core = join(data_path, 'core', 'nvim') | |
vim.env.XDG_DATA_HOME = data_path | |
vim.env.XDG_CONFIG_HOME = join(data_path, 'core') | |
vim.env.XDG_CACHE_HOME = join(data_path, 'cache') | |
vim.env.XDG_STATE_HOME = join(data_path, 'state') | |
vim.opt.runtimepath = { | |
user_path, | |
chad_core, | |
vim.env.VIMRUNTIME, | |
join(chad_core, 'after'), | |
join(user_path, 'after'), | |
} | |
vim.opt.packpath = { | |
join(data_path, 'nvim', 'site'), | |
user_path, | |
vim.env.VIMRUNTIME | |
} | |
local execute = loadfile(join(chad_core, 'init.lua')) | |
if not execute then | |
vim.api.nvim_err_writeln("Could not load NvChad's init.lua") | |
return | |
end | |
execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Assuming you are using linux:
chad_core
variable gives you.git clone https://github.com/NvChad/NvChad ~/.local/share/nvchad/core/nvim
user_path
variable gives you.mkdir -p ~/.config/nvchad
To customize nvchad in this new setup create a lua module called
custom
in the configuration folder.mkdir -p ~/.config/nvchad/lua/custom
Inside that new folder you can put your
init.lua
and thechadrc.lua
.