From 0660a9446d4515c9755573152ce944ebf2f019fc Mon Sep 17 00:00:00 2001 From: Daniil Rozanov Date: Fri, 26 Apr 2024 03:33:49 +0300 Subject: 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 --- lua/cmake/init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lua/cmake/init.lua') 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) -- cgit v1.2.3