Skip to content

Commit

Permalink
on contrôle la zone
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-Nicolas committed Feb 27, 2024
1 parent 41590ba commit 0d48265
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 3 deletions.
82 changes: 79 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,83 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
typos_lsp = {},
clangd = {},
gopls = {},
clangd = {
keys = {
{ '<leader>cR', '<cmd>ClangdSwitchSourceHeader<cr>', desc = 'Switch Source/Header (C/C++)' },
},
root_dir = function(fname)
return require('lspconfig.util').root_pattern(
'Makefile',
'configure.ac',
'configure.in',
'config.h.in',
'meson.build',
'meson_options.txt',
'build.ninja'
)(fname) or require('lspconfig.util').root_pattern('compile_commands.json', 'compile_flags.txt')(fname) or require('lspconfig.util').find_git_ancestor(
fname
)
end,
capabilities = {
offsetEncoding = { 'utf-16' },
},
cmd = {
'clangd',
'--background-index',
'--clang-tidy',
'--header-insertion=iwyu',
'--completion-style=detailed',
'--function-arg-placeholders',
'--fallback-style=llvm',
},
init_options = {
usePlaceholders = true,
completeUnimported = true,
clangdFileStatus = true,
},
},
gopls = {
keys = {
-- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12
{ '<leader>td', "<cmd>lua require('dap-go').debug_test()<CR>", desc = 'Debug Nearest (Go)' },
},
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' },
semanticTokens = true,
},
},
},
-- pylyzer = {},
rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
Expand Down Expand Up @@ -723,6 +798,7 @@ require('lazy').setup({
end,
},

{ 'catppuccin/nvim', name = 'catppuccin', priority = 1000 },
{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is
Expand All @@ -733,7 +809,7 @@ require('lazy').setup({
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
-- Load the colorscheme here
vim.cmd.colorscheme 'tokyonight-moon'
vim.cmd.colorscheme 'catppuccin-mocha'

-- You can configure highlights by doing something like
vim.cmd.hi 'Comment gui=none'
Expand Down
51 changes: 51 additions & 0 deletions lua/custom/plugins/dap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
return {
'mfussenegger/nvim-dap',
optional = true,
dependencies = {
-- Ensure C/C++ debugger is installed
'williamboman/mason.nvim',
optional = true,
opts = function(_, opts)
if type(opts.ensure_installed) == 'table' then
vim.list_extend(opts.ensure_installed, { 'codelldb' })
end
end,
},
opts = function()
local dap = require 'dap'
if not dap.adapters['codelldb'] then
require('dap').adapters['codelldb'] = {
type = 'server',
host = 'localhost',
port = '${port}',
executable = {
command = 'codelldb',
args = {
'--port',
'${port}',
},
},
}
end
for _, lang in ipairs { 'c', 'cpp' } do
dap.configurations[lang] = {
{
type = 'codelldb',
request = 'launch',
name = 'Launch file',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
},
{
type = 'codelldb',
request = 'attach',
name = 'Attach to process',
processId = require('dap.utils').pick_process,
cwd = '${workspaceFolder}',
},
}
end
end,
}

0 comments on commit 0d48265

Please sign in to comment.