Update!
From now on consider only this first paragraph, once neovim developers implemented the environment variable called:
NVIM_APPNAME
you can use it this way:
alias lv="export NVIM_APPNAME=lv; export MYVIMRC=~/.config/lv/init.lua;nvim"
In my case I have created a special name called "lv". If I clone anyone nvim config file to the lv folder and run via terminal the lv command, this version of my config will be used.
I also have a more complex alias:
# https://gitlab.com/linuxdabbler/dotfiles/.config/nvim
# ln -sfvn ~/.dotfiles/vinone ~/.config
if [[ -d "$HOME/.config/vinone" ]]; then
[[ ! `readlink "$HOME/.config/vinone"` =~ '.*dotfiles.vinone$' ]] && ln -sfvn ~/.dotfiles/vinone ~/.config
alias vinone='(){(export NVIM_APPNAME=vinone;export MYVIMRC=~/.config/vinone/init.lua;nvim $@)}'
else
alias vinone="nvim -u NONE -U NONE -N -i NONE -c 'set mouse=a| syntax on| set nu'"
fi
Adding snippets to your custom neovim setup
In my custom setup I have a folder called "snippets". So inside the cmp.lua
conf file I had to make this:
local nvimAppname = vim.env.NVIM_APPNAME
require("luasnip/loaders/from_snipmate").lazy_load({ paths = {"~/.config/".. nvimAppname .."/snippets"}})
So if I start using this config file related to another NVIM_APPNAME it will not break the code.
Getting variables inside neovim
:lua print(vim.env.NVIM_APPNAME)
Top comments (4)
I have an easier way. I use LunarVim which creates it's own configuration with the command line name of 'lvim'. Then I have a normal Funnel powered config in the normal nvim config folder. Two different configs by accessing two different commandline names. The same can be done with others since you can give a new config location on the command line and alias it.
Two problems: Lunarvim has a very tricky configuration and I want to use any nvim config, not just lunarvim.
But, you can do it like they do by making an alias (script in their case) that specifies a different config directory. Then you just have a different alias for each config of neovim you have. The Lunarvim command is:
Then make use of the environment variables in the config. It's a little more work on the config, but it does get the end result you need.