diff options
author | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-04-26 03:33:49 +0300 |
---|---|---|
committer | Daniil Rozanov <daniilrozzanov@gmail.com> | 2024-04-26 03:33:49 +0300 |
commit | 0660a9446d4515c9755573152ce944ebf2f019fc (patch) | |
tree | b587c6de58d6475feadade022fa918d15a3eba74 /lua/cmake/init.lua | |
parent | a21a7207041754efdc811493ea131b6dd2d0f944 (diff) |
fix: better autocmds
Correctly process case when neovim opened witn nvim CMakeLists.txt command. At the moment of first setup CMakeLists.txt does not exists, so we need to setup project on BufEnter if it was not inisialized before
Diffstat (limited to 'lua/cmake/init.lua')
-rw-r--r-- | lua/cmake/init.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lua/cmake/init.lua b/lua/cmake/init.lua index febf307..adfa84e 100644 --- a/lua/cmake/init.lua +++ b/lua/cmake/init.lua @@ -12,15 +12,14 @@ function M.setup(opts) opts = opts or {} config.setup(opts) if vim.fn.executable(config.cmake.cmake_path) then + autocmds.setup() utils.file_exists(vim.fs.joinpath(uv.cwd(), constants.cmakelists), function(cmake_lists_exists) if cmake_lists_exists then - require("cmake.capabilities").setup(function() - vim.schedule(function() - autocmds.setup() - commands.register_commands() - end) - require("cmake.project").setup() + vim.schedule(function() + autocmds.set_on_variants() + commands.register_commands() end) + require("cmake.project").setup({ first_time_only = true }) else end end) |