NTBBloodbath / cheovim

Neovim configuration switcher written in Lua. Inspired by chemacs.
GNU General Public License v2.0
332 stars 14 forks source link

Run multiple instances with different configs #9

Closed fedoranvar closed 2 years ago

fedoranvar commented 2 years ago

Goo day to you!

I've ide-like-config, and minimal-config (withoud LSP and fancy interface things - just text editing) for firenvim and shell scripts.

Is it possible to hot load config (in other words, prechoose config) ?

something like:

nvim -c 'Cheovim load minimal-config'

Thank you!

fedoranvar commented 2 years ago

have tried something

putting some argument on load

nvim --cmd "lua load_profile='min'"

with profile

local profiles = {
    --[[
    Here's an example:

        <name_of_config> = { <path_to_config>, {
                plugins = "packer", -- Where to install plugins under site/pack
                preconfigure = "packer:opt" -- Whether or not to preconfigure a plugin manager for you
            }
        }

    More in-depth information can be found in cheovim's README on GitHub.
    --]]
    ide = { "~/.config/nvim/configs/ide", {
            plugins = "packer",
            preconfigure = "packer",
        }
    },
    min = { "~/.config/nvim/configs/min", {
            plugins = "packer",
            preconfigure = "packer",
        }
    },
}

local default_profile = 'ide'

-- return <name_of_config>, <list_of_profiles>
return load_profile and load_profile or default_profile, profiles

figured that problem is, that cheovim uses symlinks, so second config will erase first config.

I think for multiple instances at once, it shouldn't symlink plugin/ folder itself, inside of it...

If something will come up, i'll write here.

Thank you!

EDIT#1:

There is idea: To reset symlinks when Focusing on vim instance. something like,

autocmd FocusGained * <reset symink according to load_profile variable>

so:

1) Run first instance with load_profile = 'ide'

2) Run second instance with load_profile ='min'

3) Focus on first instance and reset symlink to first config

not elegant solution, but i think it can work out

fedoranvar commented 2 years ago

Solved config management by packer with its cond and config