Last active
October 3, 2023 11:36
-
-
Save VonHeikemen/1e82e8add1a5b9b2bdc767871af69514 to your computer and use it in GitHub Desktop.
Separate astronvim's configuration from Neovim's default.
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
| --- For details of usage and explanation see: | |
| --- https://dev.to/vonheikemen/how-to-install-astronvim-without-overriding-your-existing-neovim-configuration-1nke | |
| 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]], 'astronvim', '') | |
| end | |
| local data_path = getpath('data') | |
| local astro_config = join(data_path, 'core') | |
| local user_path = getpath('config') | |
| vim.env.XDG_DATA_HOME = data_path | |
| vim.env.XDG_CACHE_HOME = join(data_path, 'cache') | |
| vim.env.XDG_STATE_HOME = join(data_path, 'state') | |
| vim.opt.runtimepath = { | |
| user_path, | |
| astro_config, | |
| vim.env.VIMRUNTIME, | |
| join(astro_config, 'after'), | |
| join(user_path, 'after'), | |
| } | |
| vim.opt.packpath = { | |
| join(data_path, 'nvim', 'site'), | |
| user_path, | |
| vim.env.VIMRUNTIME | |
| } | |
| astronvim_installation = {home = astro_config} | |
| local execute = loadfile(join(astro_config, 'init.lua')) | |
| if not execute then | |
| vim.api.nvim_err_writeln("Could not load AstroNvim's init.lua") | |
| return | |
| end | |
| execute() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Assuming you are using linux:
astro_configgives you.git clone https://github.com/AstroNvim/AstroNvim ~/.local/share/astronvim/coreuser_pathgives you.mkdir -p ~/.config/astronvimTo customize AstroNvim in this new setup create a lua module called
userin the configuration folder.mkdir -p ~/.config/astronvim/lua/userInside that new folder you create a file called
init.lua. Check out this example configuration to know what you can do.