Lots of update
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "rust" },
|
||||
sync_install = false,
|
||||
auto_install = false,
|
||||
ignore_install = { "javascript" },
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(lang, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
--vim.api.nvim_create_autocmd("BufEnter", {
|
||||
-- pattern = "*",
|
||||
-- callback = function()
|
||||
-- vim.bo.tabstop = 8
|
||||
-- vim.bo.shiftwidth = 8
|
||||
-- vim.bo.expandtab = false
|
||||
-- end
|
||||
--})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "tex", "scilab" },
|
||||
callback = function()
|
||||
vim.bo.tabstop = 4
|
||||
vim.bo.shiftwidth = 4
|
||||
vim.bo.expandtab = false
|
||||
end
|
||||
})
|
||||
@@ -0,0 +1,82 @@
|
||||
-- Set up nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- vim.fn["UltiSnips#ExpandSnippet"]()
|
||||
vim.fn["UltiSnips#Anon"](args.body) -- previous one mostly works
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<tab>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'ultisnips' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false }
|
||||
})
|
||||
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lsp = require('lspconfig')
|
||||
|
||||
-- lsp.ccls.setup{
|
||||
-- capabilities = capabilities,
|
||||
-- init_options = {
|
||||
-- cache = {
|
||||
-- directory = vim.fn.expand("~/.cache/ccls") -- Store index globally
|
||||
-- },
|
||||
-- compilationDatabaseDirectory = "build", -- Uses 'build/compile_commands.json' if present
|
||||
-- highlight = { lsRanges = true }, -- Improves semantic highlighting
|
||||
-- index = {
|
||||
-- threads = 4, -- Adjust based on your CPU (more threads = faster indexing)
|
||||
-- initialBlacklist = { ".*_test.cpp", ".*_unittest.cpp" }
|
||||
-- -- initialBlacklist = { ".*_test.cpp", ".*_unittest.cpp", "/home/furtest/linux_bidouille/.*" } -- Avoid indexing test files
|
||||
-- },
|
||||
-- completion = {
|
||||
-- detailedLabel = true -- Better completion info
|
||||
-- },
|
||||
-- diagnostics = {
|
||||
-- onChange = 300 -- Delay diagnostics updates for better performance
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
|
||||
|
||||
-- clangd and ccls are both C and C++ language servers
|
||||
-- having them both active at the same time is useless
|
||||
lsp.clangd.setup {
|
||||
capabilities = capabilities,
|
||||
cmd = { "clangd", "--enable-config" },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user