save
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
vim.bo.filetype = "c"
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
vim.opt.spell = true
|
|
||||||
vim.opt_local.tabstop = 2
|
|
||||||
vim.opt_local.shiftwidth = 2
|
|
||||||
vim.opt_local.expandtab = true
|
|
||||||
vim.opt_local.textwidth = 80
|
|
||||||
@@ -28,14 +28,21 @@ vim.keymap.set("n", "<leader><leader>", function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
local ext = vim.fn.expand("%:e")
|
local ext = vim.fn.expand("%:e")
|
||||||
local firstline = vim.fn.getline(1)
|
local firstline = vim.fn.getline(1)
|
||||||
if ext == "" and not firstline:match("^#!") then
|
if ext == "" and not firstline:match("^#!") then
|
||||||
vim.bo.filetype = "noext"
|
vim.bo.filetype = "noext"
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||||
|
pattern = "*.h",
|
||||||
|
callback = function()
|
||||||
|
vim.bo.filetype = "c"
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.pack.add {
|
vim.pack.add {
|
||||||
@@ -47,5 +54,19 @@ vim.pack.add {
|
|||||||
require("mini.pick").setup()
|
require("mini.pick").setup()
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
|
|
||||||
|
require 'lspconfig'.clangd.setup {
|
||||||
|
filetypes = { "c", "cpp" },
|
||||||
|
init_options = {
|
||||||
|
compilationDatabasePath = "build",
|
||||||
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if vim.bo.filetype == "c" and vim.fn.expand("%:e") == "h" then
|
||||||
|
client.config.flags = client.config.flags or {}
|
||||||
|
client.config.flags.allow_incremental_sync = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vim.lsp.enable { "lua_ls", "clangd", "beautysh" }
|
vim.lsp.enable { "lua_ls", "clangd", "beautysh" }
|
||||||
vim.diagnostic.config { virtual_text = true, underline = true, signs = false }
|
vim.diagnostic.config { virtual_text = true, underline = true, signs = false }
|
||||||
|
|||||||
Reference in New Issue
Block a user