setup dap for lldb/zig, change lualine theme, edit ts config
This commit is contained in:
@@ -23,6 +23,12 @@ dap.adapters.gdb = {
|
|||||||
args = { "--interpreter=dap", "--eval-command", "set print pretty on" }
|
args = { "--interpreter=dap", "--eval-command", "set print pretty on" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dap.adapters.lldb = {
|
||||||
|
type = 'executable',
|
||||||
|
command = 'lldb-dap',
|
||||||
|
name = 'lldb'
|
||||||
|
}
|
||||||
|
|
||||||
dap.configurations.c = {
|
dap.configurations.c = {
|
||||||
{
|
{
|
||||||
name = "Launch",
|
name = "Launch",
|
||||||
@@ -32,8 +38,7 @@ dap.configurations.c = {
|
|||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||||
end,
|
end,
|
||||||
cwd = "${workspaceFolder}",
|
cwd = "${workspaceFolder}",
|
||||||
stopOnEntry = true,
|
stopOnEntry = false,
|
||||||
-- stopAtBeginningOfMainSubprogram = false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "Select and attach to process",
|
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
|
-- noop is an empty function that doesn't do anything
|
||||||
clangd = function()
|
clangd = function()
|
||||||
lspconfig.clangd.setup({
|
-- lspconfig.clangd.setup({
|
||||||
cmd = {
|
-- cmd = {
|
||||||
'clangd',
|
-- 'clangd',
|
||||||
'--background-index',
|
-- '--background-index',
|
||||||
'--clang-tidy',
|
-- '--clang-tidy',
|
||||||
'--log=verbose',
|
-- '--log=verbose',
|
||||||
'--header-interpolation=false', -- clangd doesn't find the files, annoying and unnecessary noise as a result
|
-- '--header-interpolation=false', -- clangd doesn't find the files, annoying and unnecessary noise as a result
|
||||||
},
|
-- },
|
||||||
init_options = {
|
-- init_options = {
|
||||||
fallbackFlags = {
|
-- fallbackFlags = {
|
||||||
'-std=c23',
|
-- '-std=c23',
|
||||||
'-std=c++20'
|
-- '-std=c++20'
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
})
|
-- })
|
||||||
end,
|
end,
|
||||||
jdtls = function()
|
jdtls = function()
|
||||||
lspconfig.jdtls.setup{}
|
lspconfig.jdtls.setup{}
|
||||||
@@ -133,47 +133,3 @@ cmp.setup({
|
|||||||
}),
|
}),
|
||||||
formatting = lsp_zero.cmp_format(),
|
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 {
|
require('lualine').setup {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
theme = 'rose-pine',
|
theme = 'auto',
|
||||||
component_separators = { left = '|', right = '|'},
|
component_separators = { left = '|', right = '|'},
|
||||||
section_separators = { left = '', right = ''},
|
section_separators = { left = '', right = ''},
|
||||||
disabled_filetypes = {
|
disabled_filetypes = {
|
||||||
@@ -12,9 +12,9 @@ require('lualine').setup {
|
|||||||
always_divide_middle = true,
|
always_divide_middle = true,
|
||||||
globalstatus = false,
|
globalstatus = false,
|
||||||
refresh = {
|
refresh = {
|
||||||
statusline = 1000,
|
statusline = 75,
|
||||||
tabline = 1000,
|
tabline = 10000,
|
||||||
winbar = 1000,
|
winbar = 10000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
@@ -42,29 +42,6 @@ require('lualine').setup {
|
|||||||
always_visible = false, -- Show diagnostics even if there are none.
|
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_x = {'encoding', 'filetype'},
|
||||||
lualine_y = {'progress'},
|
lualine_y = {'progress'},
|
||||||
lualine_z = {'location'}
|
lualine_z = {'location'}
|
||||||
|
|||||||
@@ -7,11 +7,10 @@ require'nvim-treesitter.configs'.setup {
|
|||||||
|
|
||||||
-- Automatically install missing parsers when entering buffer
|
-- Automatically install missing parsers when entering buffer
|
||||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||||
auto_install = true,
|
auto_install = false,
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
require'treesitter-context'.setup{
|
require'treesitter-context'.setup{
|
||||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
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.
|
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||||
line_numbers = true,
|
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'
|
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'
|
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||||
-- Separator between context and content. Should be a single character string, like '-'.
|
-- 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
|
-- put to background
|
||||||
vim.keymap.set("n", "<leader>bg", "<C-z>")
|
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
|
-- BUILD SCRIPT INVOKATIONS
|
||||||
-- generic build function
|
-- generic build function
|
||||||
local function set(list)
|
local function set(list)
|
||||||
|
|||||||
Reference in New Issue
Block a user