Remove the idea about auto running cmake from file detection changes
This commit is contained in:
parent
ef90fd5cea
commit
3ba2c3f858
1 changed files with 3 additions and 30 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
local function setup_yank_highlight()
|
||||
-- Create a new highlight group which will be used for yank highlighting with the name "YankHighlight"
|
||||
vim.cmd("highlight YankHighlight guibg=#e0af68")
|
||||
|
|
@ -20,40 +19,14 @@ end
|
|||
-- Load keymaps before loading any plugins
|
||||
require("keymaps")
|
||||
|
||||
-- change and personalize native vim settings
|
||||
-- change and personalize native vim settings
|
||||
vim.opt = require("vim_opt")
|
||||
|
||||
-- Initialize Lazy package manager
|
||||
-- Initialize Lazy package manager
|
||||
require("lazy_init")
|
||||
|
||||
-- Initialize plugins, add a plugin by creating a new file in the plugins dir
|
||||
-- Initialize plugins, add a plugin by creating a new file in the plugins dir
|
||||
require("lazy").setup("plugs")
|
||||
|
||||
-- See ":help vim.highlight.on_yank()"
|
||||
setup_yank_highlight()
|
||||
|
||||
|
||||
-- Save this code snippet for later, it is used to automatically run cmake when saving a file in a project, this way we can have an up to date compile_commands.json file for clangd.
|
||||
-- TODO: Make sure to only run this when clangd is being used as the language server. Additionally, find a way to make this work on projects with multiple CMakeLists.txt files, or that arent using CMake at all.
|
||||
-- -- Define a function to find the main.cpp and CMakeLists.txt files using fzf
|
||||
-- function FindMainAndCMakeLists()
|
||||
-- local main_cpp = vim.fn.systemlist('fzf --preview "bat {}" --query main.cpp --select-1')[1]
|
||||
-- local cmake_lists = vim.fn.systemlist('fzf --preview "bat {}" --query CMakeLists.txt --select-1')[1]
|
||||
-- return main_cpp, cmake_lists
|
||||
-- end
|
||||
--
|
||||
-- -- Function to update the autocmd based on the found main.cpp and CMakeLists.txt files
|
||||
-- function UpdateAutocmd(main_cpp_path, cmake_lists_path)
|
||||
-- if main_cpp_path ~= '' and cmake_lists_path ~= '' then
|
||||
-- local main_cpp_directory = vim.fn.fnamemodify(main_cpp_path, ':h')
|
||||
-- vim.api.nvim_exec(string.format([[
|
||||
-- autocmd! BufWritePost %s/**/* :call system('cmake %s')
|
||||
-- ]], main_cpp_directory, cmake_lists_path), false)
|
||||
-- else
|
||||
-- print("main.cpp or CMakeLists.txt not found. Autocmd not updated.")
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- -- Automatically find main.cpp and CMakeLists.txt and set up the initial autocmd
|
||||
-- local main_cpp_path, cmake_lists_path = FindMainAndCMakeLists()
|
||||
-- UpdateAutocmd(main_cpp_path, cmake_lists_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue