diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2024-08-23 09:40:05 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2024-08-23 09:40:05 -0300 |
| commit | 969aa6d3444f857c383b0e271febe087cd224349 (patch) | |
| tree | 626929d795c5e4c262afb00570a87f3df0212fc3 /lua/pi | |
| parent | 59ab00e081d92db8760d65f3146f4156a962d5e4 (diff) | |
| download | nvim-conf-969aa6d3444f857c383b0e271febe087cd224349.tar.gz nvim-conf-969aa6d3444f857c383b0e271febe087cd224349.zip | |
Feat: update
Diffstat (limited to 'lua/pi')
| -rw-r--r-- | lua/pi/animations.lua | 2 | ||||
| -rw-r--r-- | lua/pi/dap/configs/cpp.lua | 33 | ||||
| -rw-r--r-- | lua/pi/lsp/default.lua | 5 | ||||
| -rw-r--r-- | lua/pi/lsp/init.lua | 2 | ||||
| -rw-r--r-- | lua/pi/lsp/null-ls.lua | 1 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/clangd.lua | 21 | ||||
| -rw-r--r-- | lua/pi/lsp/servers/smarty_ls.lua (renamed from lua/pi/lsp/servers/vscode_smarty_langserver.lua) | 0 |
7 files changed, 62 insertions, 2 deletions
diff --git a/lua/pi/animations.lua b/lua/pi/animations.lua index c0b7a6c..3ff711f 100644 --- a/lua/pi/animations.lua +++ b/lua/pi/animations.lua @@ -1,6 +1,6 @@ local redraw_buffer = function() local Animation = require "animation" - local fps = 45 -- frames per second + local fps = 15 -- frames per second local easing = require "animation.easing" local buffer = 0 diff --git a/lua/pi/dap/configs/cpp.lua b/lua/pi/dap/configs/cpp.lua new file mode 100644 index 0000000..d51d6bd --- /dev/null +++ b/lua/pi/dap/configs/cpp.lua @@ -0,0 +1,33 @@ +local dap = require("dap") + +dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + command = '~/.local/share/nvim/mason/packages/cpptools/extension/debugAdapters/bin/OpenDebugAD7', +} + +dap.configurations.cpp = { + { + name = "Launch file", + type = "cppdbg", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopAtEntry = true, + }, + { + name = 'Attach to gdbserver :1234', + type = 'cppdbg', + request = 'launch', + MIMode = 'gdb', + miDebuggerServerAddress = 'localhost:1234', + miDebuggerPath = '/usr/bin/gdb', + cwd = '${workspaceFolder}', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + }, +} +dap.configurations.c = dap.configurations.cpp diff --git a/lua/pi/lsp/default.lua b/lua/pi/lsp/default.lua index e2517f0..8a47cbf 100644 --- a/lua/pi/lsp/default.lua +++ b/lua/pi/lsp/default.lua @@ -28,6 +28,11 @@ return { filetypes = {"smarty"}, root_dir = require("lspconfig.util").root_pattern("composer.json", ".git"), }, + clangd = { + enable = true, + filetypes = {"c", "cpp", "objc", "objcpp", "cuda", "proto" }, + root_dir = require("lspconfig.util").root_pattern("compile_commands.json", ".git"), + }, }, default_options = function (options) return vim.tbl_deep_extend("force", { diff --git a/lua/pi/lsp/init.lua b/lua/pi/lsp/init.lua index 17d73a1..64d09b7 100644 --- a/lua/pi/lsp/init.lua +++ b/lua/pi/lsp/init.lua @@ -3,7 +3,7 @@ return { ops = vim.tbl_deep_extend("force", require "pi.lsp.default", ops) local lspconfig = require "lspconfig" - + require('lspconfig.ui.windows').default_options.border = 'single' local mason_servers = {} for server, options in pairs(ops.servers) do if options.enable == true then diff --git a/lua/pi/lsp/null-ls.lua b/lua/pi/lsp/null-ls.lua index b105018..70693d9 100644 --- a/lua/pi/lsp/null-ls.lua +++ b/lua/pi/lsp/null-ls.lua @@ -38,6 +38,7 @@ null_ls.setup { end, }, null_ls.builtins.formatting.pint, + null_ls.builtins.formatting.clang_format, }, } diff --git a/lua/pi/lsp/servers/clangd.lua b/lua/pi/lsp/servers/clangd.lua new file mode 100644 index 0000000..87633cd --- /dev/null +++ b/lua/pi/lsp/servers/clangd.lua @@ -0,0 +1,21 @@ +local lsp_attach = require "pi.lsp.attach" +local lsp_flags = require "pi.lsp.flags" + +return function(ops) + local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) + local config = { + on_attach = lsp_attach, + flags = lsp_flags, + capabilities = vim.tbl_deep_extend("force", capabilities, { + offsetEncoding = { "utf-16" }, + general = { + positionEncodings = { "utf-16" }, + }, + }), + } + if vim.fn.executable "clangd" == 1 then + config.cmd = { "clangd" } + end + + return vim.tbl_extend("force", config, ops) +end diff --git a/lua/pi/lsp/servers/vscode_smarty_langserver.lua b/lua/pi/lsp/servers/smarty_ls.lua index bf29082..bf29082 100644 --- a/lua/pi/lsp/servers/vscode_smarty_langserver.lua +++ b/lua/pi/lsp/servers/smarty_ls.lua |