From 4217f3f6bc6e1c0015da6dae0014fe1ee3ec2314 Mon Sep 17 00:00:00 2001 From: Liam Malone Date: Thu, 12 Dec 2024 14:32:13 +0100 Subject: [PATCH] setup dap for lldb/zig, change lualine theme, edit ts config --- .../non-nix_configs/nvim/after/plugin/dap.lua | 38 +++++++++- .../non-nix_configs/nvim/after/plugin/lsp.lua | 74 ++++--------------- .../nvim/after/plugin/lualine.lua | 33 ++------- .../nvim/after/plugin/treesitter.lua | 5 +- .../nvim/after/plugin/ts-context.lua | 5 +- .../non-nix_configs/nvim/lua/liamm/remap.lua | 10 --- 6 files changed, 61 insertions(+), 104 deletions(-) diff --git a/modules/non-nix_configs/nvim/after/plugin/dap.lua b/modules/non-nix_configs/nvim/after/plugin/dap.lua index ec53baa..a6f981b 100644 --- a/modules/non-nix_configs/nvim/after/plugin/dap.lua +++ b/modules/non-nix_configs/nvim/after/plugin/dap.lua @@ -23,6 +23,12 @@ dap.adapters.gdb = { args = { "--interpreter=dap", "--eval-command", "set print pretty on" } } +dap.adapters.lldb = { + type = 'executable', + command = 'lldb-dap', + name = 'lldb' +} + dap.configurations.c = { { name = "Launch", @@ -32,8 +38,7 @@ dap.configurations.c = { return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = "${workspaceFolder}", - stopOnEntry = true, - -- stopAtBeginningOfMainSubprogram = false, + stopOnEntry = false, }, { name = "Select and attach to process", @@ -69,3 +74,32 @@ dap.configurations.c = { }, } +dap.configurations.zig = { + { + name = "Debug Zig Executable", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/zig-out/bin/', 'file') + end, + cwd = "${workspaceFolder}", + args = {}, + stopOnEntry = false, + }, + { + name = 'Attach to Zig Process', + type = 'lldb', + request = 'attach', + pid = require('dap.ui.widgets').hover, + args = {}, + } +} + +-- DAP Keybinds +vim.keymap.set('n', '', function() dap.continue() end) +vim.keymap.set('n', '', function() dap.step_over() end) +vim.keymap.set('n', '', function() dap.step_into() end) +vim.keymap.set('n', '', function() dap.step_out() end) +vim.keymap.set('n', 'bp', function() dap.toggle_breakpoint() end) +vim.keymap.set('n', 'dr', function() dap.repl.open() end) + diff --git a/modules/non-nix_configs/nvim/after/plugin/lsp.lua b/modules/non-nix_configs/nvim/after/plugin/lsp.lua index b96ce73..c114ab6 100644 --- a/modules/non-nix_configs/nvim/after/plugin/lsp.lua +++ b/modules/non-nix_configs/nvim/after/plugin/lsp.lua @@ -45,21 +45,21 @@ require('mason-lspconfig').setup({ -- noop is an empty function that doesn't do anything clangd = function() - lspconfig.clangd.setup({ - cmd = { - 'clangd', - '--background-index', - '--clang-tidy', - '--log=verbose', - '--header-interpolation=false', -- clangd doesn't find the files, annoying and unnecessary noise as a result - }, - init_options = { - fallbackFlags = { - '-std=c23', - '-std=c++20' - }, - }, - }) + -- lspconfig.clangd.setup({ + -- cmd = { + -- 'clangd', + -- '--background-index', + -- '--clang-tidy', + -- '--log=verbose', + -- '--header-interpolation=false', -- clangd doesn't find the files, annoying and unnecessary noise as a result + -- }, + -- init_options = { + -- fallbackFlags = { + -- '-std=c23', + -- '-std=c++20' + -- }, + -- }, + -- }) end, jdtls = function() lspconfig.jdtls.setup{} @@ -133,47 +133,3 @@ cmp.setup({ }), formatting = lsp_zero.cmp_format(), }) - --- lsp_zero.set_preferences({ --- sign_icons = { } --- }) --- --- lsp_zero.setup_nvim_cmp({ --- mapping = cmp_mappings --- }) - - --- require('lspconfig').lua_ls.setup({ --- on_init = function(client) --- if client.workspace_folders then --- local path = client.workspace_folders[1].name --- if vim.uv.fs_stat(path..'/.luarc.json') or vim.uv.fs_stat(path..'/.luarc.jsonc') then --- return --- end --- end --- --- client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { --- -- runtime = { --- -- Tell the language server which version of Lua you're using --- -- (most likely LuaJIT in the case of Neovim) --- -- version = 'LuaJIT' --- -- }, --- -- Make the server aware of Neovim runtime files --- workspace = { --- checkThirdParty = false, --- library = { --- vim.env.VIMRUNTIME --- } --- } --- }) --- end, --- settings = { --- Lua = { --- diagnostics = { --- globals = { 'turtle' }, --- }, --- }, --- }, --- }) - --- lsp_zero.setup() diff --git a/modules/non-nix_configs/nvim/after/plugin/lualine.lua b/modules/non-nix_configs/nvim/after/plugin/lualine.lua index 3d9b96b..6052f2b 100644 --- a/modules/non-nix_configs/nvim/after/plugin/lualine.lua +++ b/modules/non-nix_configs/nvim/after/plugin/lualine.lua @@ -1,7 +1,7 @@ require('lualine').setup { options = { icons_enabled = true, - theme = 'rose-pine', + theme = 'auto', component_separators = { left = '|', right = '|'}, section_separators = { left = '', right = ''}, disabled_filetypes = { @@ -12,13 +12,13 @@ require('lualine').setup { always_divide_middle = true, globalstatus = false, refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, + statusline = 75, + tabline = 10000, + winbar = 10000, } }, sections = { - lualine_a = {'mode'}, + lualine_a = { 'mode' }, lualine_b = { 'branch', 'diff', @@ -42,29 +42,6 @@ require('lualine').setup { always_visible = false, -- Show diagnostics even if there are none. }, }, - lualine_c = { - 'filename', - { - -- Lsp server name . - function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - icon = ' LSP:', - color = { fg = '#ffffff', gui = 'bold' }, - } - }, lualine_x = {'encoding', 'filetype'}, lualine_y = {'progress'}, lualine_z = {'location'} diff --git a/modules/non-nix_configs/nvim/after/plugin/treesitter.lua b/modules/non-nix_configs/nvim/after/plugin/treesitter.lua index b162746..c5cf014 100644 --- a/modules/non-nix_configs/nvim/after/plugin/treesitter.lua +++ b/modules/non-nix_configs/nvim/after/plugin/treesitter.lua @@ -7,11 +7,10 @@ require'nvim-treesitter.configs'.setup { -- Automatically install missing parsers when entering buffer -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + auto_install = false, - highlight = { + highlight = { enable = true, - additional_vim_regex_highlighting = false, }, } diff --git a/modules/non-nix_configs/nvim/after/plugin/ts-context.lua b/modules/non-nix_configs/nvim/after/plugin/ts-context.lua index 737bef0..127aa7f 100644 --- a/modules/non-nix_configs/nvim/after/plugin/ts-context.lua +++ b/modules/non-nix_configs/nvim/after/plugin/ts-context.lua @@ -1,9 +1,10 @@ require'treesitter-context'.setup{ enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) - max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + multiwindow = false, + max_lines = 4, -- How many lines the window should span. Values <= 0 mean no limit. min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. line_numbers = true, - multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line + multiline_threshold = 10, -- Maximum number of lines to collapse for a single context line trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' -- Separator between context and content. Should be a single character string, like '-'. diff --git a/modules/non-nix_configs/nvim/lua/liamm/remap.lua b/modules/non-nix_configs/nvim/lua/liamm/remap.lua index 5e92208..dd35963 100644 --- a/modules/non-nix_configs/nvim/lua/liamm/remap.lua +++ b/modules/non-nix_configs/nvim/lua/liamm/remap.lua @@ -24,16 +24,6 @@ vim.keymap.set("n", "x", "!chmod +x %", {silent = true}) -- put to background vim.keymap.set("n", "bg", "") --- DAP debugger -local dap = require('dap') - -vim.keymap.set('n', '', function() dap.continue() end) -vim.keymap.set('n', '', function() dap.step_over() end) -vim.keymap.set('n', '', function() dap.step_into() end) -vim.keymap.set('n', '', function() dap.step_out() end) -vim.keymap.set('n', 'bp', function() dap.toggle_breakpoint() end) -vim.keymap.set('n', 'dr', function() dap.repl.open() end) - -- BUILD SCRIPT INVOKATIONS -- generic build function local function set(list)