setup dap for lldb/zig, change lualine theme, edit ts config

This commit is contained in:
2024-12-12 14:32:13 +01:00
parent 5ec6ca4070
commit 4217f3f6bc
6 changed files with 61 additions and 104 deletions
@@ -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', '<F5>', function() dap.continue() end)
vim.keymap.set('n', '<F10>', function() dap.step_over() end)
vim.keymap.set('n', '<F11>', function() dap.step_into() end)
vim.keymap.set('n', '<F12>', function() dap.step_out() end)
vim.keymap.set('n', '<Leader>bp', function() dap.toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end)
@@ -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()
@@ -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'}
@@ -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 = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
@@ -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 '-'.
@@ -24,16 +24,6 @@ vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", {silent = true})
-- put to background
vim.keymap.set("n", "<leader>bg", "<C-z>")
-- DAP debugger
local dap = require('dap')
vim.keymap.set('n', '<F5>', function() dap.continue() end)
vim.keymap.set('n', '<F10>', function() dap.step_over() end)
vim.keymap.set('n', '<F11>', function() dap.step_into() end)
vim.keymap.set('n', '<F12>', function() dap.step_out() end)
vim.keymap.set('n', '<Leader>bp', function() dap.toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end)
-- BUILD SCRIPT INVOKATIONS
-- generic build function
local function set(list)