NvChad / starter

Starter config for NvChad
The Unlicense
113 stars 396 forks source link

System-wide nvchad for 2.5 #24

Closed aleixq closed 4 months ago

aleixq commented 4 months ago

In previous 2.0 I could install nvchad systemwide. to benefit of shared initial configs, mappings... for many users. But I am having troubles with 2.5. Maybe I am lazy, but do you have any idea about how can I get it working again.

I get:

Error detected while processing /etc/xdg/nvim/sysinit.vim[2]../etc/xdg/nvim/NvChad_starter/init.lua:
Failed to run `config` for NvChad

/etc/xdg/nvim/NvChad_starter/init.lua:24: module 'options' not found:
^Ino field package.preload['options']
cache_loader: module options not found
cache_loader_lib: module options not found
^Ino file './options.lua'
^Ino file '/usr/share/luajit-2.1.0-beta3/options.lua'
^Ino file '/usr/local/share/lua/5.1/options.lua'
^Ino file '/usr/local/share/lua/5.1/options/init.lua'
^Ino file '/usr/share/lua/5.1/options.lua'
^Ino file '/usr/share/lua/5.1/options/init.lua'
^Ino file './options.so'
^Ino file '/usr/local/lib/lua/5.1/options.so'
^Ino file '/usr/lib/x86_64-linux-gnu/lua/5.1/options.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'

the tree of /etc/xdg/nvim is:

.
├── NvChad_starter
│   ├── LICENSE
│   ├── init.lua
│   └── lua
│       ├── README.md
│       ├── chadrc.lua
│       ├── configs
│       │   ├── conform.lua
│       │   ├── lazy.lua
│       │   ├── lspconfig.lua
│       │   ├── null-ls.lua
│       │   └── overrides.lua
│       ├── highlights.lua
│       ├── mappings.lua
│       ├── myinit.lua
│       ├── options.lua
│       └── plugins
│           ├── init.lua
│           └── myplugins.lua
├── README.md
└── sysinit.vim

sysinit.vim is:

set runtimepath+=/etc/xdg/nvim/NvChad_starter
source /etc/xdg/nvim/NvChad_starter/init.lua
aleixq commented 4 months ago

Adding in lua/configs/lazy.lua:

  performance = {
    rtp = {
+      reset = false,
      disabled_plugins = {

is a workaround, but I see

Re-sourcing your config is not supported with lazy.nvim
Error detected while processing /etc/xdg/nvim/sysinit.vim[2]../etc/xdg/nvim/NvChad_starter/init.lua:
Invalid spec module: `plugins`
Expected a `table` of specs, but a `boolean` was returned instead

But it seems it works

siduck commented 4 months ago

no idea about this, do other nvim configs work?

aleixq commented 4 months ago

Yes, By now everything works but some part(s?) of the theme, e.g. the toggle:

Error detected while processing function TbToggle_theme:                                                                                                                   
line    1:                                                                                                                                                                        
E5108: Error executing lua cannot open /root/.config/nvim/lua/chadrc.lua: No such file or directory                                                                               
stack traceback:                                                                                                                                                                  
        [C]: in function 'dofile'                                                                                                                                                 
        /root/.local/share/nvim/lazy/base46/lua/base46/init.lua:184: in function 'toggle_theme'                                                                                   
        [string ":lua"]:1: in main chunk                                                                                                                                          
Press ENTER or type command to continue
siduck commented 4 months ago

chadrc is a must for using nvchad

aleixq commented 4 months ago

Yes,yes, I know it, and in fact is used /etc/xdg/nvim/NvChad_starter/lua/chadrc.lua , but it seems that settings are only read just the first time, as it lets me set the theme for example. But afterward, /etc/xdg/nvim/NvChad_starter/lua/chadrc.lua is not used anymore. So I cannot change the theme, or use theme_toggle.

aleixq commented 4 months ago

Just to note, that adding /root/.config/nvim/lua/chadrc.lua makes it working as it should. But it will be great to let define it system-wide and read the settings from /etc/xdg/nvim/NvChad_starter/lua/chadrc.lua . Maybe too adapted to my use case...

siduck commented 4 months ago

/etc/xdg/nvim/lua/chadrc.lua

that should be the real path, the starter repo is basically ~/.config/nvim i.e a nvim config

aleixq commented 4 months ago

/etc/xdg/nvim/lua/chadrc.lua

that should be the real path, the starter repo is basically ~/.config/nvim i.e a nvim config

Despite this in /etc/xdg/nvim/sysinit.vim ? :

set runtimepath+=/etc/xdg/nvim/NvChad_starter
source /etc/xdg/nvim/NvChad_starter/init.lua
siduck commented 4 months ago

i honestly have no idea about this xdg stuff, you should ask in our discord server, someone might help!

aleixq commented 4 months ago

It seems that some other people are having issues with lazy and global config:https://github.com/folke/lazy.nvim/issues/636 . My last major issue was the python provider (I need this for plugin vdebug) that only runs ok the first time. So I think that the issue comes from lazy, and so is not in your field.

Anyway I've switched to nvim-dap and everything runs fine.

Thank's !

siduck commented 4 months ago

for python provider check https://github.com/NvChad/NvChad/issues/1417

aleixq commented 4 months ago

for python provider check NvChad/NvChad#1417

These lines are there, and checkhealth shows everything fine. In fact, as said before, it works fine the first time that nvim is run (when no ~/.config/nvim ~/.cache/nvim or ~/.local/share/nvim exists yet).