fix esp32

This commit is contained in:
Franchioping 2025-12-08 20:44:13 +00:00
parent bd4d79f7f3
commit a882fc5d24
3 changed files with 95 additions and 17 deletions

View File

@ -87,6 +87,10 @@ P.S. You can delete this when you're done too. It's your config now! :)
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
--
-- autocomplete
vim.o.pumheight = 20
vim.g.mapleader = ' '
vim.g.maplocalleader = ','
@ -478,8 +482,29 @@ require('lazy').setup({
})
vim.lsp.enable 'clangd'
if os.getenv 'NVIM_ESP32_ENV' then
local esp32 = require 'esp32'
vim.lsp.config('clangd', esp32.lsp_config())
local query_driver = os.getenv 'CLANGD_QUERY_DRIVER'
vim.lsp.config('clangd', {
cmd = {
'clangd',
'--compile-commands-dir=' .. 'build',
'--background-index',
'--clang-tidy',
'--header-insertion=iwyu',
'--completion-style=detailed',
'--function-arg-placeholders',
'--fallback-style=llvm',
'--query-driver=' .. query_driver,
},
root_markers = { 'sdkconfig', 'CMakeLists.txt', '.git' },
capabilities = {
offsetEncoding = { 'utf-16' },
},
init_options = {
usePlaceholders = true,
completeUnimported = true,
clangdFileStatus = true,
},
})
end
-- Brief aside: **What is LSP?**
--
@ -717,7 +742,7 @@ require('lazy').setup({
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true, tex = true }
local disable_filetypes = { c = false, cpp = false, tex = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
@ -733,6 +758,8 @@ require('lazy').setup({
lua = { 'stylua' },
markdown = { 'markdownlint' },
json = { 'fixjson', 'jq' },
c = { 'clang-format' },
cpp = { 'clang-format' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
@ -790,6 +817,53 @@ require('lazy').setup({
luasnip.config.setup { enable_autosnippets = true }
cmp.setup {
formatting = {
fields = { 'abbr', 'menu', 'kind' },
format = function(entry, item)
-- Define menu shorthand for different completion sources.
local menu_icon = {
nvim_lsp = 'NLSP',
nvim_lua = 'NLUA',
luasnip = 'LSNP',
buffer = 'BUFF',
path = 'PATH',
}
-- Set the menu "icon" to the shorthand for each completion source.
item.menu = menu_icon[entry.source.name]
-- Set the fixed width of the completion menu to 60 characters.
fixed_width = 20
-- Set 'fixed_width' to false if not provided.
FixedWidth = FixedWidth or false
-- Get the completion entry text shown in the completion window.
local content = item.abbr
-- Set the fixed completion window width.
if FixedWidth then
vim.o.pumwidth = FixedWidth
end
-- Get the width of the current window.
local win_width = vim.api.nvim_win_get_width(0)
-- Set the max content width based on either: 'fixed_width'
-- or a percentage of the window width, in this case 20%.
-- We subtract 10 from 'fixed_width' to leave room for 'kind' fields.
local max_content_width = FixedWidth and FixedWidth - 10 or math.floor(win_width * 0.2)
-- Truncate the completion entry text if it's longer than the
-- max content width. We subtract 3 from the max content width
-- to account for the "..." that will be appended to it.
if #content > max_content_width then
item.abbr = vim.fn.strcharpart(content, 0, max_content_width - 3) .. '...'
else
item.abbr = content .. (' '):rep(max_content_width - #content)
end
return item
end,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)

View File

@ -1,27 +1,27 @@
{
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" },
"conform.nvim": { "branch": "master", "commit": "ffe26e8df8115c9665d24231f8a49fadb2d611ce" },
"esp32.nvim": { "branch": "main", "commit": "7b929bd908ba7358b073d1923832cd8d2e682503" },
"fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" },
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"lazy.nvim": { "branch": "main", "commit": "e6a8824858757ca9cd4f5ae1a72d845fa5c46a39" },
"lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"leetcode.nvim": { "branch": "master", "commit": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a" },
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "57e4330f967da6ac64bf9b05b06ecb3c4a120ec3" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mini.nvim": { "branch": "main", "commit": "7d6fcfd879fe520aba187fe2bd25078fa2367d03" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0b9bb925c000ae649ff7e7149c8cd00031f4b539" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"mini.nvim": { "branch": "main", "commit": "e27fcecf6cbffd8ed391bdf0eb746fdb5b9bfa44" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
"nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" },
"nvim-lint": { "branch": "master", "commit": "8c694e1a1ee2ac14df931679cd54e6b8d402c2c2" },
"nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" },
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
"nvim-lint": { "branch": "master", "commit": "ebe535956106c60405b02220246e135910f6853d" },
"nvim-lspconfig": { "branch": "master", "commit": "9c923997123ff9071198ea3b594d4c1931fab169" },
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
@ -31,8 +31,8 @@
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope-undo.nvim": { "branch": "main", "commit": "928d0c2dc9606e01e2cc547196f48d2eaecf58e5" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "411503d3bedeff88484de572f2509c248e499b38" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"vimtex": { "branch": "master", "commit": "be9deac3a23eeb145ccf11dd09080795838496ce" },
"vimtex": { "branch": "master", "commit": "32bcb3922c20588e00de68f73c86312eda2141ad" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@ -50,4 +50,8 @@ return {
build_dir = 'build',
},
},
{
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
},
}