From 5cde868042c9121f0c8f095a89da556a080d036d Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 7 May 2023 21:24:02 +0200 Subject: Changed icons of signs for dap --- lua/plugins/dap.lua | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index a3e40df..6236b84 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -237,31 +237,31 @@ end -- } --}) -dapui.setup({ - layouts = { - { - elements = { - "watches", - }, - size = 0.2, - position = "left", - }, - }, - controls = { - enabled = false, - }, - render = { - max_value_lines = 3, - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { "q", "" }, - }, - }, -}) +--dapui.setup({ +-- layouts = { +-- { +-- elements = { +-- "watches", +-- }, +-- size = 0.2, +-- position = "left", +-- }, +-- }, +-- controls = { +-- enabled = false, +-- }, +-- render = { +-- max_value_lines = 3, +-- }, +-- floating = { +-- max_height = nil, -- These can be integers or a float between 0 and 1. +-- max_width = nil, -- Floats will be treated as percentage of your screen. +-- border = "single", -- Border style. Can be "single", "double" or "rounded" +-- mappings = { +-- close = { "q", "" }, +-- }, +-- }, +--}) -- setup dapui dapui.setup({ @@ -366,5 +366,6 @@ vim.cmd([[ ]]) -- options --dap.set_exception_breakpoints("default") +dap.defaults.fallback.switchbuf = 'uselast' dap.defaults.fallback.focus_terminal = false dap.defaults.fallback.terminal_win_cmd = '10split new' -- cgit v1.2.3 From abfc8fb889cf4bb9890ae4d9d63901c48c9b9661 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 7 May 2023 21:25:01 +0200 Subject: Add a key to disconnect dap including it's terminal --- lua/user/keys.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 8e16d03..b128a60 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -364,18 +364,19 @@ map("n", "ds", function() end) -- Set breakpoints, get variable values, step into/out of functions, etc. -map("n", "dl", require("dap.ui.widgets").hover) map("n", "dc", dap.continue) map("n", "dC", dap.close) map("n", "dt", dap.terminate) -map("n", "db", dap.toggle_breakpoint) +map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) map("n", "dn", dap.step_over) map("n", "di", dap.step_into) map("n", "do", dap.step_out) +map("n", "db", dap.toggle_breakpoint) map("n", "dB", function() dap.clear_breakpoints() require("notify")("Breakpoints cleared", "warn") end) +map("n", "dl", require("dap.ui.widgets").hover) --vim.keymap.set("n", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("v", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("n", "lp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") -- cgit v1.2.3 From ca98c5069a92081c2176ecd6d1e0687dfdb06a38 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 7 May 2023 21:33:13 +0200 Subject: Add autocommand for dap-float --- lua/plugins/dap.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 6236b84..4414cef 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,4 +1,13 @@ local dap = require('dap') + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "dap-float" }, + callback = function(event) + vim.keymap.set("n", "", "", { buffer = event.buf, silent = true }) + vim.keymap.set("n", "", "", { buffer = event.buf, silent = true }) + end, +}) + --dap.defaults.fallback.external_terminal = { -- command = '/usr/bin/wezterm'; -- args = {'-e'}; @@ -43,6 +52,7 @@ dap.adapters.cppdbg = { type = 'executable', --command = vim.fn.stdpath('data') .. '/mason/bin/OpenDebugAD7', command = os.getenv("HOME") .. '/apps/cpptools/extension/debugAdapters/bin/OpenDebugAD7', + --command = cpptools:get_install_path() .. '/extension/debugAdapters/bin/OpenDebugAD7' } dap.adapters.codelldb = { -- cgit v1.2.3 From 60407d5725924008dd5c66165ecd8388b744be6d Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 7 May 2023 21:38:23 +0200 Subject: Changed layout of elements for dap-ui --- lua/plugins/dap.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 4414cef..52b8714 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -289,16 +289,21 @@ dapui.setup({ layouts = { { elements = { - { id = "scopes", size = 0.5 }, - { id = "watches", size = 0.5 }, + -- Elements can be strings or table with id and size keys. + { id = "scopes", size = 0.4 }, + "breakpoints", + "stacks", + "watches", }, - size = 40, + size = 50, -- 40 columns position = "left", }, { - elements = { "console", "repl" }, + elements = { + "console", + }, + size = 0.3, position = "bottom", - size = 15, }, }, render = { @@ -318,15 +323,16 @@ dapui.setup({ collapsed = "", current_frame = "", }, + { "theHamsta/nvim-dap-virtual-text", config = true }, }) -- signs local sign = vim.fn.sign_define sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" }) +sign("DapBreakpointCondition", { text = "◆", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) +sign("DapBreakpointRejected", { text = 'R', texthl = 'DiagnosticError', numhl = 'DiagnosticError' }) +sign("DapLogPoint", { text = "L", texthl = "DapLogPoint", linehl = "", numhl = "" }) sign('DapStopped', { text = '', texthl = 'DiagnosticSignHint', numbhl = '', linehl = '' }) -sign("DapBreakpointRejected", { text = '!>', texthl = 'DiagnosticError', numhl = 'DiagnosticError' }) -sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) -sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = "" }) --sign('DapBreakpoint', { text = '', texthl = 'DiagnosticSignError', numbhl = '', linehl = '' }) --sign("DapLogPoint", { text = '.>', texthl = 'DiagnosticInfo', numhl = 'DiagnosticInfo' }) -- cgit v1.2.3 From e95ccbdf4fc8ca373a137940d7b9049b8a256e7b Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 7 May 2023 22:19:53 +0200 Subject: Experimenting with new keys for dap.terminate, etc... --- lua/user/keys.lua | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index b128a60..7acea19 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -366,7 +366,7 @@ end) -- Set breakpoints, get variable values, step into/out of functions, etc. map("n", "dc", dap.continue) map("n", "dC", dap.close) -map("n", "dt", dap.terminate) +--map("n", "dt", dap.terminate) map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) map("n", "dn", dap.step_over) map("n", "di", dap.step_into) @@ -377,19 +377,31 @@ map("n", "dB", function() require("notify")("Breakpoints cleared", "warn") end) map("n", "dl", require("dap.ui.widgets").hover) +map("n", "de", function() require("dapui").float_element() end, + { desc = "Open Element" }) +map("n", "dt", function() + require("dapui").close() + require("dap").repl.close() + local session = require("dap").session() + if session then + require("dap").terminate() + end + require("nvim-dap-virtual-text").refresh() + end, { desc = "Terminate Debug" }) + --vim.keymap.set("n", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("v", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("n", "lp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") --vim.keymap.set("n", "dr", ":lua require'dap'.repl.open()") -- Close debugger and clear breakpoints -map("n", "de", function() - dap.clear_breakpoints() - ui.toggle({}) - dap.terminate() - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("=", false, true, true), "n", false) - require("notify")("Debugger session ended", "warn") -end) +--map("n", "de", function() +-- dap.clear_breakpoints() +-- ui.toggle({}) +-- dap.terminate() +-- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("=", false, true, true), "n", false) +-- require("notify")("Debugger session ended", "warn") +--end) -- Dashboard map("n", "", "Dashboard") -- cgit v1.2.3 From 139346e53864e059bacf65052b90004b6aaafd4d Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 7 May 2023 22:27:58 +0200 Subject: Enabled controls for dap-ui --- lua/plugins/dap.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 52b8714..2a967f0 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -284,7 +284,7 @@ dapui.setup({ toggle = "t", }, controls = { - enabled = false, + enabled = true, }, layouts = { { @@ -298,6 +298,13 @@ dapui.setup({ size = 50, -- 40 columns position = "left", }, + --{ + -- elements = { + -- "repl", + -- }, + -- size = 50, + -- position = "center", + --}, { elements = { "console", @@ -329,7 +336,7 @@ dapui.setup({ -- signs local sign = vim.fn.sign_define sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" }) -sign("DapBreakpointCondition", { text = "◆", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) +sign("DapBreakpointCondition", { text = "◆", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) -- sign("DapBreakpointRejected", { text = 'R', texthl = 'DiagnosticError', numhl = 'DiagnosticError' }) sign("DapLogPoint", { text = "L", texthl = "DapLogPoint", linehl = "", numhl = "" }) sign('DapStopped', { text = '', texthl = 'DiagnosticSignHint', numbhl = '', linehl = '' }) -- cgit v1.2.3 From 2692127313d02fa8dc1e6caa40993fb2367c8b48 Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 20:25:49 +0200 Subject: Changed layout of dap-ui --- lua/plugins/dap.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 2a967f0..738145b 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -290,10 +290,11 @@ dapui.setup({ { elements = { -- Elements can be strings or table with id and size keys. - { id = "scopes", size = 0.4 }, + --{ id = "scopes", size = 0.4 }, + "watches", + "scopes", "breakpoints", "stacks", - "watches", }, size = 50, -- 40 columns position = "left", @@ -307,7 +308,9 @@ dapui.setup({ --}, { elements = { - "console", + --"console", + { id = "console", size = 0.6 }, + "repl", }, size = 0.3, position = "bottom", @@ -390,5 +393,5 @@ vim.cmd([[ -- options --dap.set_exception_breakpoints("default") dap.defaults.fallback.switchbuf = 'uselast' -dap.defaults.fallback.focus_terminal = false -dap.defaults.fallback.terminal_win_cmd = '10split new' +dap.defaults.fallback.focus_terminal = true +--dap.defaults.fallback.terminal_win_cmd = '10split new' -- cgit v1.2.3 From 6e4884ba0cfb8b348ffa6d3f185cdd34cb16e0fe Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 20:29:44 +0200 Subject: Add neodev to plugins --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 4a5f5eb..0f87c90 100644 --- a/init.lua +++ b/init.lua @@ -71,6 +71,7 @@ local modules = { "plugins.colorscheme", "plugins.treesitter", "plugins.telescope", + "plugins.neodev", "plugins.nvim-tree", "plugins.quickfix", "plugins.cmp", -- cgit v1.2.3 From 7eca86494e75b6229913bed4fad3d4f31f044575 Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 20:29:53 +0200 Subject: Add neodev to plugins --- lua/plugins/neodev.lua | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lua/plugins/neodev.lua diff --git a/lua/plugins/neodev.lua b/lua/plugins/neodev.lua new file mode 100644 index 0000000..ae73e65 --- /dev/null +++ b/lua/plugins/neodev.lua @@ -0,0 +1,3 @@ +require("neodev").setup({ + library = { plugins = { "nvim-dap-ui" }, types = true }, +}) -- cgit v1.2.3 From 831a9724c7c6da487fb44eed76cb0949e3e4d0c7 Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 20:30:08 +0200 Subject: Add DAPMessages --- lua/plugins/heirline.lua | 118 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 98 insertions(+), 20 deletions(-) diff --git a/lua/plugins/heirline.lua b/lua/plugins/heirline.lua index dc415d5..a23b5bb 100644 --- a/lua/plugins/heirline.lua +++ b/lua/plugins/heirline.lua @@ -337,26 +337,100 @@ local Git = { -- Debugger -- Display informations from nvim-dap! +-- Note that we add spaces separately, so that only the icon characters will be clickable local DAPMessages = { - -- display the dap messages only on the debugged file - condition = function() - local session = require("dap").session() - if session then - local filename = vim.api.nvim_buf_get_name(0) - if session.config then - local progname = session.config.program - return filename == progname - end - end - return false - end, - provider = function() - return " " .. require("dap").status() - end, - hl = { fg = utils.get_highlight("Debug").fg }, - -- Debugger on_click: step-over, step-into, next, previous, stop buttons - -- coming soon! + condition = function() + local session = require("dap").session() + return session ~= nil + end, + provider = function() + return " " .. require("dap").status() .. " " + end, + hl = "Debug", + { + provider = "", + on_click = { + callback = function() + require("dap").step_into() + end, + name = "heirline_dap_step_into", + }, + }, + { provider = " " }, + { + provider = "", + on_click = { + callback = function() + require("dap").step_out() + end, + name = "heirline_dap_step_out", + }, + }, + { provider = " " }, + { + provider = " ", + on_click = { + callback = function() + require("dap").step_over() + end, + name = "heirline_dap_step_over", + }, + }, + { provider = " " }, + { + provider = "ﰇ", + on_click = { + callback = function() + require("dap").run_last() + end, + name = "heirline_dap_run_last", + }, + }, + { provider = " " }, + { + provider = "", + on_click = { + callback = function() + require("dap").terminate() + require("dapui").close({}) + end, + name = "heirline_dap_close", + }, + }, + { provider = " " }, + -- icons:       ﰇ   } +--local DAPMessages = { +-- -- display the dap messages only on the debugged file +-- condition = function() +-- local session = require("dap").session() +-- if session then +-- local filename = vim.api.nvim_buf_get_name(0) +-- if session.config then +-- local progname = session.config.program +-- return filename == progname +-- end +-- end +-- return false +-- end, +-- provider = function() +-- return " " .. require("dap").status() +-- end, +-- hl = { fg = utils.get_highlight("Debug").fg }, +-- -- Debugger on_click: step-over, step-into, next, previous, stop buttons +-- -- coming soon! +--} +--local DAPMessages = { +-- condition = function() +-- local session = require("dap").session() +-- return session ~= nil +-- end, +-- provider = function() +-- return " " .. require("dap").status() +-- end, +-- hl = "Debug" +-- -- see Click-it! section for clickable actions +--} -- Tests -- This requires the great ultest. @@ -716,6 +790,8 @@ local SpecialStatusline = { { LeftSpace, hl = { bg = colors.nobg, force = true } }, { Space, hl = { bg = colors.nobg, force = true } }, { Align, hl = { bg = colors.nobg, force = true } }, + { DAPMessages, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, { RightSpace, hl = { bg = colors.nobg, force = true } }, { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, } @@ -732,6 +808,8 @@ local TerminalStatusline = { { FileNameBlock, hl = { bg = colors.nobg, force = true } }, { Space, hl = { bg = colors.nobg, force = true } }, { Align, hl = { bg = colors.nobg, force = true } }, + { DAPMessages, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, { RightSpace, hl = { bg = colors.nobg, force = true } }, { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, } @@ -863,8 +941,8 @@ local Center = { -- Hide the winbar for special buffers condition = function() return conditions.buffer_matches({ - buftype = { "nofile", "prompt", "help", "quickfix" }, - filetype = { "^git.*", "fugitive", "dashboard", }, + buftype = { "terminal", "nofile", "prompt", "help", "quickfix" }, + filetype = { "dap-ui", "NvimTree", "^git.*", "fugitive", "dashboard", }, }) end, init = function() -- cgit v1.2.3 From 3b194b8c8191038dd6730a6270dcf3209d200e73 Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 20:30:31 +0200 Subject: Changed size of console and repl --- lua/plugins/dap.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 738145b..982a525 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -310,7 +310,8 @@ dapui.setup({ elements = { --"console", { id = "console", size = 0.6 }, - "repl", + --"repl", + { id = "repl", size = 0.4 }, }, size = 0.3, position = "bottom", -- cgit v1.2.3 From 4cda03e7274e56234af81e7f0202ba1f2c7e421f Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 20:53:13 +0200 Subject: Add specialsections for special/terminal statusline --- lua/plugins/heirline.lua | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/lua/plugins/heirline.lua b/lua/plugins/heirline.lua index a23b5bb..93b3e32 100644 --- a/lua/plugins/heirline.lua +++ b/lua/plugins/heirline.lua @@ -779,40 +779,34 @@ local InactiveStatusline = { { Align, hl = { bg = colors.nobg, force = true } }, } +local specialleft = { + { ViMode, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, + { LeftSpace, hl = { bg = colors.nobg, force = true } }, + { Space, hl = { bg = colors.nobg, force = true } }, + } +local specialmiddle = { + { Align, hl = { bg = colors.nobg, force = true } }, + { DAPMessages, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, + } +local specialright = { + { RightSpace, hl = { bg = colors.nobg, force = true } }, + { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, + } +local specialsections = { specialleft, specialmiddle, specialright } + local SpecialStatusline = { condition = function() return conditions.buffer_matches({ buftype = { "nofile", "prompt", "help", "quickfix" }, filetype = { "^git.*", "fugitive", "dashboard", }, }) - end, - { ViMode, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, - { LeftSpace, hl = { bg = colors.nobg, force = true } }, - { Space, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, - { DAPMessages, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, - { RightSpace, hl = { bg = colors.nobg, force = true } }, - { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, -} + end, specialsections } local TerminalStatusline = { condition = function() return conditions.buffer_matches({ buftype = { "terminal" } }) - end, - - -- Quickly add a condition to the ViMode to only show it when buffer is active! - --{ condition = conditions.is_active, ViMode, Space }, - { ViMode, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, - { LeftSpace, hl = { bg = colors.nobg, force = true } }, - { FileNameBlock, hl = { bg = colors.nobg, force = true } }, - { Space, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, - { DAPMessages, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, - { RightSpace, hl = { bg = colors.nobg, force = true } }, - { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, -} + end, specialsections } local StatusLine = { static = { -- cgit v1.2.3 From ab7aba315818712e3289b615617a44bb59c760a5 Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 21:00:50 +0200 Subject: Changed nt (normal terminal) to just TERMINAL --- lua/plugins/heirline.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/plugins/heirline.lua b/lua/plugins/heirline.lua index 93b3e32..4a09478 100644 --- a/lua/plugins/heirline.lua +++ b/lua/plugins/heirline.lua @@ -58,7 +58,7 @@ local ViMode = { niI = "Ni", niR = "Nr", niV = "Nv", - nt = "Nt", + nt = "TERMINAL", v = "VISUAL ", vs = "Vs", V = "V·LINE ", @@ -76,14 +76,14 @@ local ViMode = { Rv = "V·REPLACE ", Rvc = "Rv", Rvx = "Rv", - c = "COMMAND ", + c = "COMMAND", cv = "VIM EX ", ce = "EX ", r = "PROMPT ", rm = "MORE ", ["r?"] = "CONFIRM ", ["!"] = "SHELL ", - t = "TERMINAL ", + t = "TERMINAL", }, }, provider = function(self) -- cgit v1.2.3 From 66174911fcac1a16740f04951ee0d049357ee72e Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 8 May 2023 21:02:36 +0200 Subject: Changed some of dap keybindings --- lua/user/keys.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 7acea19..7bc0061 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -367,7 +367,8 @@ end) map("n", "dc", dap.continue) map("n", "dC", dap.close) --map("n", "dt", dap.terminate) -map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) +map("n", "dt", ui.toggle) +--map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) map("n", "dn", dap.step_over) map("n", "di", dap.step_into) map("n", "do", dap.step_out) @@ -379,7 +380,7 @@ end) map("n", "dl", require("dap.ui.widgets").hover) map("n", "de", function() require("dapui").float_element() end, { desc = "Open Element" }) -map("n", "dt", function() +map("n", "dd", function() require("dapui").close() require("dap").repl.close() local session = require("dap").session() -- cgit v1.2.3 From 913a178e8bb7dc9f9134d807e7b63b784362e59f Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 02:26:28 +0200 Subject: Add optional commented out icons for repl controls --- lua/plugins/dap.lua | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 982a525..f7fd41b 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -284,33 +284,36 @@ dapui.setup({ toggle = "t", }, controls = { + element = "repl", enabled = true, + --icons = { + -- disconnect = "", + -- pause = "", + -- play = "", + -- run_last = "", + -- step_back = "", + -- step_into = "", + -- step_out = "", + -- step_over = "", + -- terminate = "", + --}, }, layouts = { { elements = { -- Elements can be strings or table with id and size keys. --{ id = "scopes", size = 0.4 }, - "watches", - "scopes", - "breakpoints", - "stacks", + { id = "watches", size = 0.25 }, + { id = "scopes", size = 0.25 }, + { id = "breakpoints", size = 0.25 }, + { id = "stacks", size = 0.25 }, }, size = 50, -- 40 columns position = "left", }, - --{ - -- elements = { - -- "repl", - -- }, - -- size = 50, - -- position = "center", - --}, { elements = { - --"console", { id = "console", size = 0.6 }, - --"repl", { id = "repl", size = 0.4 }, }, size = 0.3, -- cgit v1.2.3 From 10b507af78961e5e3e78504112a93bf1602f4bab Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 02:33:07 +0200 Subject: Add rcarriga/neotest --- lua/user/pack.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index f71e114..3109d9b 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -194,6 +194,12 @@ return packer.startup(function(use) -- require("plugins.ultest") -- end, --}) + use({"rcarriga/neotest", + config = function() + require("neotest").setup() + end, + }) + -- Colorschemes use("bluz71/vim-nightfly-guicolors") -- cgit v1.2.3 From f118326d459573a2045019f6d711f8c17c573509 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 02:36:34 +0200 Subject: Load extension dap --- lua/plugins/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 1299b2f..c2867ff 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -262,6 +262,7 @@ require('telescope').load_extension('changed_files') require('telescope').load_extension('media_files') --require('telescope').extensions.notify.notify() require('telescope').load_extension('notify') +require('telescope').load_extension('dap') function M.find_configs() require("telescope.builtin").find_files { -- cgit v1.2.3 From 83f709a5ab4a0d40d214c5cd9e54235bea772a64 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 02:36:56 +0200 Subject: Add telescope extension dap --- lua/user/pack.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 3109d9b..8f86f1b 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -140,6 +140,7 @@ return packer.startup(function(use) use("nvim-telescope/telescope-media-files.nvim") -- use("nvim-telescope/telescope-file-browser.nvim") -- use({ "nvim-telescope/telescope-symbols.nvim", after = "telescope.nvim" }) -- Search emoji(s) and other symbols + use("nvim-telescope/telescope-dap.nvim") use("axkirillov/telescope-changed-files") -- -- UX -- cgit v1.2.3 From 793d018259b41edc2eae18ceb24ba0293eb60c62 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 02:38:29 +0200 Subject: Add telescope dap keybinding --- lua/user/keys.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 7bc0061..8c6bb52 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -364,11 +364,11 @@ map("n", "ds", function() end) -- Set breakpoints, get variable values, step into/out of functions, etc. -map("n", "dc", dap.continue) -map("n", "dC", dap.close) +map("n", "dC", dap.continue) +--map("n", "dC", dap.close) --map("n", "dt", dap.terminate) map("n", "dt", ui.toggle) ---map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) +map("n", "dd", function() dap.disconnect({ terminateDebuggee = true }) end) map("n", "dn", dap.step_over) map("n", "di", dap.step_into) map("n", "do", dap.step_out) @@ -380,16 +380,18 @@ end) map("n", "dl", require("dap.ui.widgets").hover) map("n", "de", function() require("dapui").float_element() end, { desc = "Open Element" }) -map("n", "dd", function() +map("n", "dq", function() require("dapui").close() require("dap").repl.close() local session = require("dap").session() if session then require("dap").terminate() end - require("nvim-dap-virtual-text").refresh() - end, { desc = "Terminate Debug" }) - + require("nvim-dap-virtual-text").refresh() +end, { desc = "Terminate Debug" }) +map("n", "dc", function() + require("telescope").extensions.dap.commands() +end, { desc = "DAP-Telescope: Commands" }) --vim.keymap.set("n", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("v", "B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") --vim.keymap.set("n", "lp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") -- cgit v1.2.3 From 3e60db4200b62035a733702426fa3d81d0c002e3 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 16:07:13 +0200 Subject: Changed some of the mode names appearances --- lua/plugins/heirline.lua | 297 +++++++++++++++++++++++++++-------------------- 1 file changed, 174 insertions(+), 123 deletions(-) diff --git a/lua/plugins/heirline.lua b/lua/plugins/heirline.lua index 4a09478..d047c1a 100644 --- a/lua/plugins/heirline.lua +++ b/lua/plugins/heirline.lua @@ -50,39 +50,39 @@ local ViMode = { end, static = { mode_names = { - n = "NORMAL ", - no = "N·OPERATOR PENDING ", - nov = "N?", - noV = "N?", - ["no\22"] = "N? ", - niI = "Ni", - niR = "Nr", - niV = "Nv", + n = " NORMAL ", + no = "PENDING ", + nov = " N? ", + noV = " N? ", + ["no\22"] = " N? ", + niI = " Ni ", + niR = " Nr ", + niV = " Nv ", nt = "TERMINAL", - v = "VISUAL ", - vs = "Vs", - V = "V·LINE ", + v = " VISUAL ", + vs = " Vs ", + V = " V·LINE ", ["\22"] = "V·BLOCK ", ["\22s"] = "V·BLOCK ", - s = "SELECT ", - S = "S·LINE ", + s = " SELECT ", + S = " S·LINE ", ["\19"] = "S·BLOCK ", - i = "INSERT ", - ix = "insert x ", - ic = "insert c ", + i = " INSERT ", + ix = "insert x", + ic = "insert c", R = "REPLACE ", - Rc = "Rc", - Rx = "Rx", + Rc = " Rc ", + Rx = " Rx ", Rv = "V·REPLACE ", - Rvc = "Rv", - Rvx = "Rv", - c = "COMMAND", - cv = "VIM EX ", - ce = "EX ", - r = "PROMPT ", - rm = "MORE ", + Rvc = " Rv ", + Rvx = " Rv ", + c = "COMMAND ", + cv = " VIM EX ", + ce = " EX ", + r = " PROMPT ", + rm = " MORE ", ["r?"] = "CONFIRM ", - ["!"] = "SHELL ", + ["!"] = " SHELL ", t = "TERMINAL", }, }, @@ -113,9 +113,8 @@ local LSPActive = { end, hl = { fg = colors.lightgray, bold = false }, } - local Navic = { - condition = require("nvim-navic").is_available, + condition = function() return require("nvim-navic").is_available() end, static = { -- create a type highlight map type_hl = { @@ -204,7 +203,7 @@ local Navic = { provider = function(self) return self.child:eval() end, - hl = { fg = colors.white }, + hl = { fg = "gray" }, update = 'CursorMoved' } @@ -270,7 +269,7 @@ local Git = { --hl = { fg = "orange" }, hl = { fg = colors.orange, bg = colors.bg }, { - -- git branch name + -- git branch name provider = function(self) return " " .. self.status_dict.head end, @@ -339,66 +338,66 @@ local Git = { -- Display informations from nvim-dap! -- Note that we add spaces separately, so that only the icon characters will be clickable local DAPMessages = { - condition = function() - local session = require("dap").session() - return session ~= nil - end, - provider = function() - return " " .. require("dap").status() .. " " - end, - hl = "Debug", - { - provider = "", - on_click = { - callback = function() - require("dap").step_into() - end, - name = "heirline_dap_step_into", - }, + condition = function() + local session = require("dap").session() + return session ~= nil + end, + provider = function() + return " " .. require("dap").status() .. " " + end, + hl = "Debug", + { + provider = "", + on_click = { + callback = function() + require("dap").step_into() + end, + name = "heirline_dap_step_into", }, - { provider = " " }, - { - provider = "", - on_click = { - callback = function() - require("dap").step_out() - end, - name = "heirline_dap_step_out", - }, + }, + { provider = " " }, + { + provider = "", + on_click = { + callback = function() + require("dap").step_out() + end, + name = "heirline_dap_step_out", }, - { provider = " " }, - { - provider = " ", - on_click = { - callback = function() - require("dap").step_over() - end, - name = "heirline_dap_step_over", - }, + }, + { provider = " " }, + { + provider = " ", + on_click = { + callback = function() + require("dap").step_over() + end, + name = "heirline_dap_step_over", }, - { provider = " " }, - { - provider = "ﰇ", - on_click = { - callback = function() - require("dap").run_last() - end, - name = "heirline_dap_run_last", - }, + }, + { provider = " " }, + { + provider = "ﰇ", + on_click = { + callback = function() + require("dap").run_last() + end, + name = "heirline_dap_run_last", }, - { provider = " " }, - { - provider = "", - on_click = { - callback = function() - require("dap").terminate() - require("dapui").close({}) - end, - name = "heirline_dap_close", - }, + }, + { provider = " " }, + { + provider = "", + on_click = { + callback = function() + require("dap").terminate() + require("dapui").close({}) + end, + name = "heirline_dap_close", }, - { provider = " " }, - -- icons:       ﰇ   + }, + { provider = " " }, + -- icons:       ﰇ   } --local DAPMessages = { -- -- display the dap messages only on the debugged file @@ -609,7 +608,7 @@ local Spell = { hl = { bold = true, fg = colors.yellow }, } -local help_file_name = { +local HelpFileName = { condition = function() return vim.bo.filetype == "help" end, @@ -620,9 +619,51 @@ local help_file_name = { hl = { fg = colors.blue }, } +local SearchCount = { + condition = function() + return vim.v.hlsearch ~= 0 and vim.o.cmdheight == 0 + end, + init = function(self) + local ok, search = pcall(vim.fn.searchcount) + if ok and search.total then + self.search = search + end + end, + provider = function(self) + local search = self.search + return string.format("[%d/%d]", search.current, math.min(search.total, search.maxcount)) + end, +} + +local MacroRec = { + condition = function() + return vim.fn.reg_recording() ~= "" and vim.o.cmdheight == 0 + end, + provider = " ", + hl = { fg = "orange", bold = true }, + utils.surround({ "[", "]" }, nil, { + provider = function() + return vim.fn.reg_recording() + end, + hl = { fg = "green", bold = true }, + }), + update = { + "RecordingEnter", + "RecordingLeave", + } +} + +local ShowCmd = { + condition = function() + return vim.o.cmdheight == 0 + end, + provider = ":%3.5(%S%)", +} + local cursor_location = { - { provider = " %1(%4l:%-3(%c%) %)%*", hl = { fg = colors.black, bold = true } }, + { provider = " %1(%4l:%-3(%c%) %)%*", hl = { fg = colors.black, bold = true } }, } + local Ruler = { cursor_location } --utils.make_flexible_component( @@ -709,8 +750,8 @@ FileNameBlock = utils.insert( FileNameBlock, FileIcon, utils.insert(FileNameModifier, FileName), -- a new table where FileName is a child of FileNameModifier - unpack(FileFlags), -- A small optimisation, since their parent does nothing - { provider = "%<" } -- this means that the statusline is cut here when there's not enough space + unpack(FileFlags), -- A small optimisation, since their parent does nothing + { provider = "%<" } -- this means that the statusline is cut here when there's not enough space ) local FileInfoBlock = { @@ -753,20 +794,22 @@ local left = { { Space, hl = { bg = colors.nobg, force = true } }, { Git, hl = { bg = colors.nobg, force = true } }, } + local middle = { { Align, hl = { bg = colors.nobg, force = true } }, - --{ Navic, hl = { bg = utils.get_highlight("statusline").bg, force = true } }, + { Navic, hl = { bg = colors.nobg, force = true } }, { DAPMessages, hl = { bg = colors.nobg, force = true } }, { Align, hl = { bg = colors.nobg, force = true } }, } + local right = { - { Space, hl = { bg = colors.nobg, force = true } }, + --{ Space, hl = { bg = colors.nobg, force = true } }, { Diagnostics, hl = { bg = colors.nobg, force = true } }, { Space, hl = { bg = colors.nobg, force = true } }, { LSPActive, hl = { bg = colors.nobg, force = true } }, { Space, hl = { bg = colors.nobg, force = true } }, { FileInfoBlock, hl = { bg = colors.nobg, force = true } }, - { RightSpace, hl = { bg = colors.nobg, force = true } }, + { RightSpace, hl = { bg = colors.nobg, force = true } }, { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, } @@ -776,23 +819,25 @@ local DefaultStatusline = { sections } local InactiveStatusline = { condition = conditions.is_not_active, { FileNameBlock, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, } local specialleft = { - { ViMode, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, - { LeftSpace, hl = { bg = colors.nobg, force = true } }, - { Space, hl = { bg = colors.nobg, force = true } }, - } + { ViMode, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, + { LeftSpace, hl = { bg = colors.nobg, force = true } }, +} + local specialmiddle = { - { Align, hl = { bg = colors.nobg, force = true } }, - { DAPMessages, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, - } + { Align, hl = { bg = colors.nobg, force = true } }, + { DAPMessages, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, +} + local specialright = { - { RightSpace, hl = { bg = colors.nobg, force = true } }, - { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, - } + { RightSpace, hl = { bg = colors.nobg, force = true } }, + { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, +} + local specialsections = { specialleft, specialmiddle, specialright } local SpecialStatusline = { @@ -801,12 +846,16 @@ local SpecialStatusline = { buftype = { "nofile", "prompt", "help", "quickfix" }, filetype = { "^git.*", "fugitive", "dashboard", }, }) - end, specialsections } + end, + specialsections +} local TerminalStatusline = { condition = function() return conditions.buffer_matches({ buftype = { "terminal" } }) - end, specialsections } + end, + specialsections +} local StatusLine = { static = { @@ -852,6 +901,7 @@ local WinbarFileNameBlock = { end, hl = { bg = colors.bg }, } + local WinbarFileName = { provider = function(self) -- first, trim the pattern relative to the current directory. For other @@ -876,8 +926,8 @@ WinbarFileNameBlock = utils.insert( WinbarFileNameBlock, FileIcon, utils.insert(WinbarFileName), -- a new table where FileName is a child of FileNameModifier - unpack(FileFlags), -- A small optimisation, since their parent does nothing - { provider = "%<" } -- this means that the statusline is cut here when there's not enough space + unpack(FileFlags), -- A small optimisation, since their parent does nothing + { provider = "%<" } -- this means that the statusline is cut here when there's not enough space ) vim.api.nvim_create_autocmd("User", { @@ -932,7 +982,7 @@ local CloseButton = { local Center = { fallthrough = false, { - -- Hide the winbar for special buffers + -- Hide the winbar for special buffers condition = function() return conditions.buffer_matches({ buftype = { "terminal", "nofile", "prompt", "help", "quickfix" }, @@ -944,7 +994,7 @@ local Center = { end, }, { - -- A special winbar for terminals + -- A special winbar for terminals condition = function() return conditions.buffer_matches({ buftype = { "terminal" } }) end, @@ -953,7 +1003,7 @@ local Center = { --TerminalName, }, { - -- An inactive winbar for regular files + -- An inactive winbar for regular files condition = function() return not conditions.is_active() end, @@ -1169,29 +1219,30 @@ require("heirline").setup({ }) -- Yep, with heirline we're driving manual! +vim.o.showtabline = 2 vim.cmd([[au FileType * if index(['wipe', 'delete', 'unload'], &bufhidden) >= 0 | set nobuflisted | endif]]) local function get_bufs() - return vim.tbl_filter(function(bufnr) - return vim.api.nvim_buf_is_loaded(bufnr) and vim.bo[bufnr].buflisted - end, vim.api.nvim_list_bufs()) + return vim.tbl_filter(function(bufnr) + return vim.api.nvim_buf_is_loaded(bufnr) and vim.bo[bufnr].buflisted + end, vim.api.nvim_list_bufs()) end local function goto_buf(index) - local bufs = get_bufs() - if index > #bufs then - index = #bufs - end - vim.api.nvim_win_set_buf(0, bufs[index]) + local bufs = get_bufs() + if index > #bufs then + index = #bufs + end + vim.api.nvim_win_set_buf(0, bufs[index]) end local function addKey(key, index) - vim.keymap.set("", "", function() - goto_buf(index) - end, { noremap = true, silent = true }) + vim.keymap.set("", "", function() + goto_buf(index) + end, { noremap = true, silent = true }) end for i = 1, 9 do - addKey(i, i) + addKey(i, i) end addKey("0", 10) -- cgit v1.2.3 From ebae5d4582f7b94cb47342491dfd51bf0c9867d1 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 16:07:31 +0200 Subject: Add lsp_lines configuration --- lua/plugins/lsp.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 44f1999..c9ccc55 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -2,6 +2,7 @@ require('mason').setup() local lspconfig = require 'lspconfig' local mason_lspconfig = require 'mason-lspconfig' local null_ls = require 'null-ls' +--local lsp_lines = require 'lsp_lines' local keymap = vim.keymap local cmd = vim.cmd @@ -24,11 +25,24 @@ for type, icon in pairs(signs) do vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end +--lsp_lines.setup() + +--vim.keymap.set("n", "g?", function() +-- local lines_enabled = not vim.diagnostic.config().virtual_lines +-- vim.diagnostic.config( +-- { +-- virtual_lines = lines_enabled, +-- virtual_text = not lines_enabled +-- } +-- ) +--end, { noremap = true, silent = true }) + vim.diagnostic.config({ underline = false, signs = true, - virtual_text = false, - virtual_lines = { only_current_line = true }, + virtual_text = true, + --virtual_lines = { only_current_line = true }, + virtual_lines = false, float = { show_header = true, source = 'if_many', @@ -279,7 +293,6 @@ null_ls.setup { builtins.diagnostics.phpcs, -- null_ls.builtins.diagnostics.write_good.with { filetypes = { 'markdown', 'tex' } }, - -- Formatting builtins.formatting.shfmt.with({ filetypes = { "bash", "zsh", "sh" }, @@ -290,7 +303,6 @@ null_ls.setup { builtins.formatting.clang_format, builtins.formatting.rustfmt, builtins.formatting.sql_formatter, - -- null_ls.builtins.formatting.cmake_format, builtins.formatting.isort, builtins.formatting.htmlbeautifier, @@ -307,7 +319,6 @@ null_ls.setup { builtins.formatting.yapf, -- null_ls.builtins.formatting.black - -- Code Actions builtins.code_actions.shellcheck, -- shell script code actions --builtins.code_actions.eslint_d.with(eslint_opts), @@ -315,7 +326,6 @@ null_ls.setup { builtins.code_actions.gitsigns, builtins.code_actions.gitrebase, - -- Hover builtins.hover.dictionary, builtins.hover.printenv, -- cgit v1.2.3 From 88c0475529da7ae55958281f295b208f424cd206 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 16:07:52 +0200 Subject: Moved lsp_lines configurations to lsp.lua --- lua/plugins/lsp_lines.lua | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 lua/plugins/lsp_lines.lua diff --git a/lua/plugins/lsp_lines.lua b/lua/plugins/lsp_lines.lua deleted file mode 100644 index 5adcb8e..0000000 --- a/lua/plugins/lsp_lines.lua +++ /dev/null @@ -1,21 +0,0 @@ -local status_ok, lsp_lines = pcall(require, "lsp_lines") -if not status_ok then - return -end - -lsp_lines.setup() - -vim.keymap.set("n", "g?", function() - local lines_enabled = not vim.diagnostic.config().virtual_lines - vim.diagnostic.config( - { - virtual_lines = lines_enabled, - virtual_text = not lines_enabled - } - ) -end, { noremap = true, silent = true }) - -vim.diagnostic.config({ - virtual_text = true, - virtual_lines = false -}) -- cgit v1.2.3 From 5ec610f9e61bb83f260b257bf161ef9dc4bc45c2 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 16:08:31 +0200 Subject: Add neotest extensions --- lua/user/pack.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 8f86f1b..05d92f6 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -195,13 +195,22 @@ return packer.startup(function(use) -- require("plugins.ultest") -- end, --}) - use({"rcarriga/neotest", - config = function() - require("neotest").setup() - end, + --use({"rcarriga/neotest", + -- config = function() + -- require("neotest").setup() + --end, + --}) + use({ + "nvim-neotest/neotest", + requires = { + { + "nvim-neotest/neotest-python", + "nvim-neotest/neotest-plenary", + "nvim-neotest/neotest-vim-test", + }, + } }) - -- Colorschemes use("bluz71/vim-nightfly-guicolors") use("ayu-theme/ayu-vim") -- cgit v1.2.3 From 27a3614c10bd6df05153e4d794afc5ec6790392b Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 16:09:08 +0200 Subject: Removed lsp_lines --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 0f87c90..04597f4 100644 --- a/init.lua +++ b/init.lua @@ -71,7 +71,7 @@ local modules = { "plugins.colorscheme", "plugins.treesitter", "plugins.telescope", - "plugins.neodev", + --"plugins.neodev", "plugins.nvim-tree", "plugins.quickfix", "plugins.cmp", @@ -83,7 +83,6 @@ local modules = { "plugins.neoscroll", --"plugins.null-ls", "plugins.lsp", - "plugins.lsp_lines", "plugins.statuscol", "plugins.goto-preview", "plugins.autopairs", @@ -92,6 +91,7 @@ local modules = { "plugins.fidget", "plugins.web-devicons", "plugins.heirline", + "plugins.neotest", "plugins.toggleterm", "plugins.trouble", "plugins.dashboard", -- cgit v1.2.3 From 5547d363694c16a5f75554ae444db5ceb145558a Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 9 May 2023 16:09:38 +0200 Subject: Add event LspAttach --- lua/plugins/fidget.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/fidget.lua b/lua/plugins/fidget.lua index 0f56a6b..bf1c9d0 100644 --- a/lua/plugins/fidget.lua +++ b/lua/plugins/fidget.lua @@ -1,4 +1,5 @@ require("fidget").setup({ + event = "LspAttach", text = { --spinner = "pipe", -- (Default) animation shown when tasks are ongoing --spinner = "hamburger", -- animation shown when tasks are ongoing -- cgit v1.2.3 From 81908ca54068d4b1447303da935ff13005a877b7 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 10 May 2023 17:40:13 +0200 Subject: Add more plugins to use with neodev --- lua/plugins/neodev.lua | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/lua/plugins/neodev.lua b/lua/plugins/neodev.lua index ae73e65..f820422 100644 --- a/lua/plugins/neodev.lua +++ b/lua/plugins/neodev.lua @@ -1,3 +1,29 @@ require("neodev").setup({ - library = { plugins = { "nvim-dap-ui" }, types = true }, + --library = { plugins = { "nvim-dap-ui" }, types = true }, + --library = { plugins = { "neotest" }, types = true }, + library = { + enabled = true, -- when not enabled, neodev will not change any settings to the LSP server + -- these settings will be used for your Neovim config directory + runtime = true, -- runtime path + types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others + --plugins = { "neotest" }, + --{ "nvim-dap-ui" }, + --plugins = true, -- installed opt or start plugins in packpath + -- you can also specify the list of plugins to make available as a workspace library + -- plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" }, + plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim", "neotest", "nvim-dap-ui" }, + }, + setup_jsonls = true, -- configures jsonls to provide completion for project specific .luarc.json files + -- for your Neovim config directory, the config.library settings will be used as is + -- for plugin directories (root_dirs having a /lua directory), config.library.plugins will be disabled + -- for any other directory, config.library.enabled will be set to false + override = function(root_dir, options) + end, + -- With lspconfig, Neodev will automatically setup your lua-language-server + -- If you disable this, then you have to set {before_init=require("neodev.lsp").before_init} + -- in your lsp start options + lspconfig = true, + -- much faster, but needs a recent built of lua-language-server + -- needs lua-language-server >= 3.6.0 + pathStrict = true, }) -- cgit v1.2.3 From 439bb48189f03344896ebd8547b8a032c73931d8 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 10 May 2023 17:40:40 +0200 Subject: Automatically attach navic --- lua/plugins/navic.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lua/plugins/navic.lua b/lua/plugins/navic.lua index a58240a..c27d76a 100644 --- a/lua/plugins/navic.lua +++ b/lua/plugins/navic.lua @@ -1,13 +1,13 @@ local navic = require("nvim-navic") -local on_attach = function(client, bufnr) - if client.server_capabilities.documentSymbolProvider then - navic.attach(client, bufnr) - end -end +--local on_attach = function(client, bufnr) +-- if client.server_capabilities.documentSymbolProvider then +-- navic.attach(client, bufnr) +-- end +--end -require("lspconfig").clangd.setup { - on_attach = on_attach -} +--require("lspconfig").clangd.setup { +-- on_attach = on_attach +--} navic.setup { icons = { @@ -38,6 +38,10 @@ navic.setup { Operator = " ", TypeParameter = " ", }, + lsp = { + auto_attach = true, + --preference = nil, + }, highlight = false, separator = " > ", depth_limit = 0, -- cgit v1.2.3 From 826e5208e2f856bed068588aab7d07a9216aabd0 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 10 May 2023 17:40:55 +0200 Subject: Enabled neodev --- init.lua | 54 ++++++++++++++++++++++++++---------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/init.lua b/init.lua index 04597f4..c14ae16 100644 --- a/init.lua +++ b/init.lua @@ -11,9 +11,7 @@ Url: https://github.com/srdusr/nvim.git ------------------------------------------------ " --]] - --[[init.]] - -- ========================================================================== -- -- == DEPENDENCIES == -- -- ========================================================================== -- @@ -48,15 +46,15 @@ -- Load impatient (Faster loading times) local impatient_ok, impatient = pcall(require, "impatient") if impatient_ok then - impatient.enable_profile() + impatient.enable_profile() end -- Schedule reading shadafile to improve the startup time vim.opt.shadafile = "NONE" vim.schedule(function() - vim.opt.shadafile = "" - vim.cmd("silent! rsh") + vim.opt.shadafile = "" + vim.cmd("silent! rsh") end) @@ -70,8 +68,8 @@ local modules = { --"user.scripts", "plugins.colorscheme", "plugins.treesitter", + "plugins.neodev", "plugins.telescope", - --"plugins.neodev", "plugins.nvim-tree", "plugins.quickfix", "plugins.cmp", @@ -114,9 +112,9 @@ local expected_ver = "0.9.0" local nvim_ver = mods.get_nvim_version() if nvim_ver ~= expected_ver then - local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver) -vim.api.nvim_err_writeln(msg) - return + local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver) + vim.api.nvim_err_writeln(msg) + return end @@ -128,24 +126,24 @@ vim.notify = require("notify") -- Requires plugin "rcarriga/nvim-notify" -- Improve speed by disabling some default plugins/modules local builtins = { - "gzip", - "zip", - "zipPlugin", - "tar", - "tarPlugin", - "getscript", - "getscriptPlugin", - "vimball", - "vimballPlugin", - "2html_plugin", - --"matchit", - --"matchparen", - "logiPat", - "rrhelper", - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", + "gzip", + "zip", + "zipPlugin", + "tar", + "tarPlugin", + "getscript", + "getscriptPlugin", + "vimball", + "vimballPlugin", + "2html_plugin", + --"matchit", + --"matchparen", + "logiPat", + "rrhelper", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", "tutor_mode_plugin", "fzf", "spellfile_plugin", @@ -153,7 +151,7 @@ local builtins = { } for _, plugin in ipairs(builtins) do - vim.g["loaded_" .. plugin] = 1 + vim.g["loaded_" .. plugin] = 1 end vim.g.do_filetype_lua = 1 vim.g.did_load_filetypes = 0 -- cgit v1.2.3 From a8e7778c7357e3043f340a34efbb15a5e884dc86 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 10 May 2023 18:17:07 +0200 Subject: Add neotest.lua --- lua/plugins/neotest.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lua/plugins/neotest.lua diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua new file mode 100644 index 0000000..aa73899 --- /dev/null +++ b/lua/plugins/neotest.lua @@ -0,0 +1,11 @@ +require("neotest").setup({ + adapters = { + require("neotest-python")({ + dap = { justMyCode = false }, + }), + require("neotest-plenary"), + require("neotest-vim-test")({ + ignore_file_types = { "python", "vim", "lua" }, + }), + }, +}) -- cgit v1.2.3 From 979f1ba93cffd678a13ece46a898384582f93284 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 10 May 2023 18:17:55 +0200 Subject: Fixed a syntax error in dap_virtual_text --- lua/plugins/dap.lua | 130 +++++++++++++++++++++------------------------------- 1 file changed, 52 insertions(+), 78 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index f7fd41b..a0ec4f4 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,5 +1,15 @@ local dap = require('dap') +-- options +--dap.set_exception_breakpoints("default") +dap.defaults.fallback.switchbuf = 'uselast' +dap.defaults.fallback.focus_terminal = true +dap.defaults.fallback.terminal_win_cmd = '10split new' + +--vim.cmd([[ +-- autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('') | endif +--]]) + vim.api.nvim_create_autocmd("FileType", { pattern = { "dap-float" }, callback = function(event) @@ -64,7 +74,7 @@ dap.adapters.codelldb = { executable = { --command = os.getenv("HOME") .. '/apps/codelldb/extension/adapter/codelldb', command = os.getenv("HOME") .. "/.vscode-oss/extensions/vadimcn.vscode-lldb-1.9.0-universal/adapter/codelldb", - args = {'--port', '${port}'}, + args = { '--port', '${port}' }, }, --detached = true, } @@ -127,7 +137,7 @@ dap.configurations.cpp = { -- ignoreFailures = false -- } --}, -}, + }, } -- dap.adapters.cppdbg = { -- name = 'cppdbg', @@ -215,21 +225,21 @@ dap.configurations.rust = dap.configurations.cpp --} dap.adapters.python = { - type = 'executable'; - command = vim.trim(vim.fn.system('which python')); - args = { '-m', 'debugpy.adapter' }; + type = 'executable', + command = vim.trim(vim.fn.system('which python')), + args = { '-m', 'debugpy.adapter' }, } dap.configurations.python = { - { - -- The first three options are required by nvim-dap - type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` - request = 'launch'; - name = "Launch file"; - -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options - program = "${file}"; -- This configuration will launch the current file if used. - stopOnEntry = true, - }, + { + -- The first three options are required by nvim-dap + type = 'python', -- the type here established the link to the adapter definition: `dap.adapters.python` + request = 'launch', + name = "Launch file", + -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options + program = "${file}", -- This configuration will launch the current file if used. + stopOnEntry = true, + }, } --local dapui = require('dapui') @@ -247,41 +257,15 @@ end -- } --}) ---dapui.setup({ --- layouts = { --- { --- elements = { --- "watches", --- }, --- size = 0.2, --- position = "left", --- }, --- }, --- controls = { --- enabled = false, --- }, --- render = { --- max_value_lines = 3, --- }, --- floating = { --- max_height = nil, -- These can be integers or a float between 0 and 1. --- max_width = nil, -- Floats will be treated as percentage of your screen. --- border = "single", -- Border style. Can be "single", "double" or "rounded" --- mappings = { --- close = { "q", "" }, --- }, --- }, ---}) - -- setup dapui dapui.setup({ mappings = { - expand = "", - open = "o", - remove = "D", - edit = "e", - repl = "r", - toggle = "t", + expand = "", + open = "o", + remove = "D", + edit = "e", + repl = "r", + toggle = "t", }, controls = { element = "repl", @@ -303,10 +287,10 @@ dapui.setup({ elements = { -- Elements can be strings or table with id and size keys. --{ id = "scopes", size = 0.4 }, - { id = "watches", size = 0.25 }, - { id = "scopes", size = 0.25 }, + { id = "watches", size = 0.25 }, + { id = "scopes", size = 0.25 }, { id = "breakpoints", size = 0.25 }, - { id = "stacks", size = 0.25 }, + { id = "stacks", size = 0.25 }, }, size = 50, -- 40 columns position = "left", @@ -314,7 +298,7 @@ dapui.setup({ { elements = { { id = "console", size = 0.6 }, - { id = "repl", size = 0.4 }, + { id = "repl", size = 0.4 }, }, size = 0.3, position = "bottom", @@ -324,8 +308,8 @@ dapui.setup({ max_value_lines = 3, }, floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. border = "single", -- Border style. Can be "single", "double" or "rounded" mappings = { close = { "q", "" }, @@ -373,29 +357,19 @@ if not dap_virtual_text_status_ok then end --require("nvim-dap-virtual-text").setup() -dap_virtual_text_status.setup({ - enabled = true, -- enable this plugin (the default) - enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) - highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText - highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) - show_stop_reason = true, -- show stop reason when stopped for exceptions - commented = true, -- prefix virtual text with comment string - only_first_definition = true, -- only show virtual text at first definition (if there are multiple) - all_references = false, -- show virtual text on all all references of the variable (not only definitions) - filter_references_pattern = "') | endif -]]) --- options ---dap.set_exception_breakpoints("default") -dap.defaults.fallback.switchbuf = 'uselast' -dap.defaults.fallback.focus_terminal = true ---dap.defaults.fallback.terminal_win_cmd = '10split new' +--local dap_virtual_text_status = require('nvim-dap-virtual-text') +--require("nvim-dap-virtual-text").setup { +dap_virtual_text_status.setup { + enabled = true, + enabled_commands = true, + highlight_changed_variables = true, + highlight_new_as_changed = false, + show_stop_reason = true, + commented = true, + only_first_definition = true, + all_references = false, + filter_references_pattern = " Date: Wed, 10 May 2023 18:18:14 +0200 Subject: Removed whitespace --- lua/plugins/fidget.lua | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lua/plugins/fidget.lua b/lua/plugins/fidget.lua index bf1c9d0..d401c5f 100644 --- a/lua/plugins/fidget.lua +++ b/lua/plugins/fidget.lua @@ -1,34 +1,34 @@ require("fidget").setup({ - event = "LspAttach", + --event = "LspAttach", text = { --spinner = "pipe", -- (Default) animation shown when tasks are ongoing --spinner = "hamburger", -- animation shown when tasks are ongoing --spinner = "dots_pulse", -- animation shown when tasks are ongoing - spinner = "dots", -- animation shown when tasks are ongoing - done = "✔", -- character shown when all tasks are complete - commenced = "Started", -- message shown when task starts - completed = "Completed", -- message shown when task completes + spinner = "dots", -- animation shown when tasks are ongoing + done = "✔", -- character shown when all tasks are complete + commenced = "Started", -- message shown when task starts + completed = "Completed", -- message shown when task completes }, fmt = { task = function(task_name, message, percentage) - if task_name == "diagnostics" then - return false - end - return string.format( - "%s%s [%s]", - message, - percentage and string.format(" (%s%%)", percentage) or "", - task_name - ) + if task_name == "diagnostics" then + return false + end + return string.format( + "%s%s [%s]", + message, + percentage and string.format(" (%s%%)", percentage) or "", + task_name + ) end, }, --sources = { -- Sources to configure - --["null-ls"] = { -- Name of source - --ignore = true, -- Ignore notifications from this source - --}, + --["null-ls"] = { -- Name of source + --ignore = true, -- Ignore notifications from this source + --}, --}, debug = { - logging = false, -- whether to enable logging, for debugging - strict = false, -- whether to interpret LSP strictly + logging = false, -- whether to enable logging, for debugging + strict = false, -- whether to interpret LSP strictly }, }) -- cgit v1.2.3 From a71bdd06e58971a7dc36cda28e90e3c0e95244f0 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 10 May 2023 18:18:29 +0200 Subject: Removed whitespace --- lua/user/opts.lua | 185 +++++++++++++++++++++++++++--------------------------- 1 file changed, 92 insertions(+), 93 deletions(-) diff --git a/lua/user/opts.lua b/lua/user/opts.lua index aa4d0c2..6375350 100644 --- a/lua/user/opts.lua +++ b/lua/user/opts.lua @@ -1,5 +1,4 @@ --[[ opts.lua ]] - -- " Load indent files, to automatically do language-dependent indenting. --vim.cmd([[ -- "filetype plugin indent on @@ -36,12 +35,12 @@ vim.cmd [[ --vim.opt.shell = "zsh" -- vim.o.updatetime = 250 vim.o.shell = "/bin/zsh" -vim.scriptencoding = "utf-8" -- -vim.opt.encoding = "utf-8" -- -vim.opt.fileencoding = "utf-8" -- +vim.scriptencoding = "utf-8" -- +vim.opt.encoding = "utf-8" -- +vim.opt.fileencoding = "utf-8" -- vim.g.python3_host_prog = "/usr/bin/python3" -- -vim.g.loaded_python3_provider = 1 -- -vim.g.sh_noisk = 1 -- iskeyword word boundaries when editing a 'sh' file +vim.g.loaded_python3_provider = 1 -- +vim.g.sh_noisk = 1 -- iskeyword word boundaries when editing a 'sh' file vim.o.autochdir = true --vim.o.writeany= true @@ -49,62 +48,62 @@ vim.o.autochdir = true vim.opt.termguicolors = true -- Behaviour -vim.opt.clipboard:append({ "unnamedplus" }) -- Install xclip or this will slowdown startup +vim.opt.clipboard:append({ "unnamedplus" }) -- Install xclip or this will slowdown startup vim.opt.backspace = { "start", "eol", "indent" } -- Make backspace work as you would expect. -vim.opt.hidden = true -- Switch between buffers without having to save first. -vim.opt.splitbelow = true -- make split put the new buffer below the current buffer -vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer -vim.opt.scrolloff = 8 -- -vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar -vim.opt.autoread = true -- reload files if changed externally -vim.opt.display = "lastline" -- Show as much as possible of the last line. -vim.opt.inccommand = "split" -- -vim.opt.ttyfast = true -- Faster redrawing. ---vim.opt.lazyredraw = true -- Only redraw when necessary -vim.opt.keywordprg = ":help" -- :help options -vim.opt.ruler = true -- -vim.opt.errorbells = false -- -vim.opt.list = true -- Show non-printable characters. -vim.opt.showmatch = true -- -vim.opt.matchtime = 3 -- -vim.opt.showbreak = "↪ " -- -vim.opt.linebreak = true -- -vim.opt.exrc = true -- +vim.opt.hidden = true -- Switch between buffers without having to save first. +vim.opt.splitbelow = true -- make split put the new buffer below the current buffer +vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer +vim.opt.scrolloff = 8 -- +vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar +vim.opt.autoread = true -- reload files if changed externally +vim.opt.display = "lastline" -- Show as much as possible of the last line. +vim.opt.inccommand = "split" -- +vim.opt.ttyfast = true -- Faster redrawing. +vim.opt.lazyredraw = false -- Only redraw when necessary +vim.opt.keywordprg = ":help" -- :help options +vim.opt.ruler = true -- +vim.opt.errorbells = false -- +vim.opt.list = true -- Show non-printable characters. +vim.opt.showmatch = true -- +vim.opt.matchtime = 3 -- +vim.opt.showbreak = "↪ " -- +vim.opt.linebreak = true -- +vim.opt.exrc = true -- --vim.opt.autochdir = true -- or use this to use <:e> to create a file in current directory -vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking +vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking --vim.opt.notimeout = true -- Timeout on keycodes and not mappings -vim.opt.ttimeout = true -- Makes terminal vim work sanely -vim.opt.ttimeoutlen = 10 -- +vim.opt.ttimeout = true -- Makes terminal vim work sanely +vim.opt.ttimeoutlen = 10 -- --vim.opt.timeoutlen = 100 -- time to wait for a mapped sequence to complete (in milliseconds) --vim.cmd([[set diffopt = vertical = true]]) -- diffs are shown side-by-side not above/below -- Indent/tab vim.opt.breakindent = true -- -vim.opt.autoindent = true -- Indent according to previous line. -vim.opt.copyindent = true -- Copy indent from the previous line -vim.opt.smarttab = false -- -vim.opt.tabstop = 2 -- -vim.opt.expandtab = true -- Indent according to previous line. +vim.opt.autoindent = true -- Indent according to previous line. +vim.opt.copyindent = true -- Copy indent from the previous line +vim.opt.smarttab = false -- +vim.opt.tabstop = 2 -- +vim.opt.expandtab = true -- Indent according to previous line. --vim.opt.expandtab = true -- Use spaces instead of tabs. -vim.opt.softtabstop = 2 -- Tab key indents by 2 spaces. -vim.opt.shiftwidth = 2 -- >> indents by 2 spaces. -vim.opt.shiftround = true -- >> indents to next multiple of 'shiftwidth'. +vim.opt.softtabstop = 2 -- Tab key indents by 2 spaces. +vim.opt.shiftwidth = 2 -- >> indents by 2 spaces. +vim.opt.shiftround = true -- >> indents to next multiple of 'shiftwidth'. vim.opt.smartindent = true -- smart indent -- Column/statusline/Cl -vim.opt.number = true -- -vim.opt.title = true -- +vim.opt.number = true -- +vim.opt.title = true -- --vim.opt.colorcolumn = "+1" -- vim.opt.signcolumn = "yes:1" -- always show the sign column --vim.opt.signcolumn = "yes:" .. vim.o.numberwidth --vim.opt.signcolumn = "number" --vim.opt.signcolumn = "no" -- -vim.opt.laststatus = 3 -- " Always show statusline. +vim.opt.laststatus = 3 -- " Always show statusline. vim.opt.showmode = true -- Show current mode in command-line, example: -- INSERT -- mode -vim.opt.showcmd = true -- Show the command in the status bar -vim.opt.cmdheight = 1 -- +vim.opt.showcmd = true -- Show the command in the status bar +vim.opt.cmdheight = 1 -- --vim.opt.cmdheight = 0 -- -vim.opt.report = 0 -- Always report changed lines. +vim.opt.report = 0 -- Always report changed lines. --local autocmd = vim.api.nvim_create_autocmd --autocmd("bufenter", { -- pattern = "*", @@ -127,9 +126,9 @@ local prefix = vim.env.XDG_CONFIG_HOME or vim.fn.expand("~/.config") vim.opt.undodir = { prefix .. "/nvim/tmp/.undo//" } vim.opt.backupdir = { prefix .. "/nvim/tmp/.backup//" } vim.opt.directory = { prefix .. "/nvim/tmp/.swp//" } -vim.opt.backup = false -- -vim.opt.undofile = false -- -vim.opt.swapfile = true -- +vim.opt.backup = false -- +vim.opt.undofile = false -- +vim.opt.swapfile = true -- -- Add timestamp as extension for backup files vim.api.nvim_create_autocmd('BufWritePre', { group = vim.api.nvim_create_augroup('timestamp_backupext', { clear = true }), @@ -142,23 +141,23 @@ vim.api.nvim_create_autocmd('BufWritePre', { -- Format --vim.opt.textwidth = 80 -- -vim.cmd([[let &t_Cs = "\e[4:3m"]]) -- Undercurl -vim.cmd([[let &t_Ce = "\e[4:0m"]]) -- -vim.opt.path:append({ "**" }) -- Finding files - Search down into subfolder +vim.cmd([[let &t_Cs = "\e[4:3m"]]) -- Undercurl +vim.cmd([[let &t_Ce = "\e[4:0m"]]) -- +vim.opt.path:append({ "**" }) -- Finding files - Search down into subfolder vim.cmd("set whichwrap+=<,>,[,],h,l") -- -vim.cmd([[set iskeyword+=-]]) -- +vim.cmd([[set iskeyword+=-]]) -- --vim.cmd([[set formatoptions-=cro]]) -- TODO: this doesn't seem to work vim.opt.formatoptions = vim.opt.formatoptions - - "t" -- wrap with text width - + "c" -- wrap comments - + "r" -- insert comment after enter - - "o" -- insert comment after o/O - - "q" -- allow formatting of comments with gq - - "a" -- format paragraphs - + "n" -- recognized numbered lists - - "2" -- use indent of second line for paragraph - + "l" -- long lines are not broken - + "j" -- remove comment when joining lines + - "t" -- wrap with text width + + "c" -- wrap comments + + "r" -- insert comment after enter + - "o" -- insert comment after o/O + - "q" -- allow formatting of comments with gq + - "a" -- format paragraphs + + "n" -- recognized numbered lists + - "2" -- use indent of second line for paragraph + + "l" -- long lines are not broken + + "j" -- remove comment when joining lines vim.opt.wrapscan = true -- " Searches wrap around end-of-file. --vim.wo.number = true -- --vim.opt.wrap = false -- No Wrap lines @@ -172,68 +171,68 @@ vim.opt.shortmess:append("sI") --vim.opt.shortmess = "sI" --vim.o.shortmess = vim.o.shortmess:gsub('s', '') vim.opt.fillchars = { - horiz = "─", - horizup = "┴", - horizdown = "┬", - vert = "│", - vertleft = "┤", - vertright = "├", - verthoriz = "┼", + horiz = "─", + horizup = "┴", + horizdown = "┬", + vert = "│", + vertleft = "┤", + vertright = "├", + verthoriz = "┼", foldopen = "", foldsep = "│", foldclose = "", fold = "─", - eob = " ", - --diff = "┃", + eob = " ", + --diff = "┃", diff = "░", msgsep = "━", - --msgsep = "‾", + --msgsep = "‾", } vim.opt.listchars = { tab = "▸ ", trail = "·" } -- --vim.opt.fillchars:append({ eob = " " }) -- remove the ~ from end of buffer -vim.opt.modeline = true -- -vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) +vim.opt.modeline = true -- +vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) --vim.opt.modelineexpr = true --vim.opt.nofoldenable = true -- turn folding off --vim.opt.foldenable = false -- turn folding off vim.o.showtabline = 2 -- Highlights -vim.opt.incsearch = true -- Highlight while searching with / or ?. -vim.opt.hlsearch = true -- Keep matches highlighted. +vim.opt.incsearch = true -- Highlight while searching with / or ?. +vim.opt.hlsearch = true -- Keep matches highlighted. vim.opt.ignorecase = true -- ignore case in search patterns UNLESS /C or capital in search -vim.opt.smartcase = true -- smart case -vim.opt.synmaxcol = 200 -- Only highlight the first 200 columns. +vim.opt.smartcase = true -- smart case +vim.opt.synmaxcol = 200 -- Only highlight the first 200 columns. vim.opt.winblend = 30 --vim.opt.winblend = 5 vim.opt.wildoptions = "pum" -- --vim.opt.pumblend = 5 -- -vim.opt.pumblend = 12 -- +vim.opt.pumblend = 12 -- --vim.opt.pumblend=15 -vim.opt.pumheight = 10 -- pop up menu height +vim.opt.pumheight = 10 -- pop up menu height -- Better Completion vim.opt.complete = { ".", "w", "b", "u", "t" } -- --vim.opt.completeopt = { "longest,menuone,preview" } -- -vim.opt.completeopt = {'menu', 'menuone', 'noselect'} +vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } --vim.opt.completeopt = { "menuone", "noselect" } -- mostly just for cmp --vim.opt.completeopt = { "menu", "menuone", "noselect" } -- -- Wildmenu completion -- -vim.opt.wildmenu = true -- -vim.opt.wildmode = { "list:longest" } -- -vim.opt.wildignore:append({ ".hg", ".git", ".svn" }) -- Version control -vim.opt.wildignore:append({ "*.aux", "*.out", "*.toc" }) -- LaTeX intermediate files -vim.opt.wildignore:append({ "*.jpg", "*.bmp", "*.gif", "*.png", "*.jpeg" }) -- binary images +vim.opt.wildmenu = true -- +vim.opt.wildmode = { "list:longest" } -- +vim.opt.wildignore:append({ ".hg", ".git", ".svn" }) -- Version control +vim.opt.wildignore:append({ "*.aux", "*.out", "*.toc" }) -- LaTeX intermediate files +vim.opt.wildignore:append({ "*.jpg", "*.bmp", "*.gif", "*.png", "*.jpeg" }) -- binary images vim.opt.wildignore:append({ "*.o", "*.obj", "*.exe", "*.dll", "*.manifest" }) -- compiled object files -vim.opt.wildignore:append({ "*.spl" }) -- compiled spelling word lists -vim.opt.wildignore:append({ "*.sw?" }) -- Vim swap files -vim.opt.wildignore:append({ "*.DS_Store" }) -- OSX bullshit -vim.opt.wildignore:append({ "*.luac" }) -- Lua byte code -vim.opt.wildignore:append({ "migrations" }) -- Django migrations -vim.opt.wildignore:append({ "*.pyc" }) -- Python byte code -vim.opt.wildignore:append({ "*.orig" }) -- Merge resolution files -vim.opt.wildignore:append({ "*/node_modules/*" }) -- +vim.opt.wildignore:append({ "*.spl" }) -- compiled spelling word lists +vim.opt.wildignore:append({ "*.sw?" }) -- Vim swap files +vim.opt.wildignore:append({ "*.DS_Store" }) -- OSX bullshit +vim.opt.wildignore:append({ "*.luac" }) -- Lua byte code +vim.opt.wildignore:append({ "migrations" }) -- Django migrations +vim.opt.wildignore:append({ "*.pyc" }) -- Python byte code +vim.opt.wildignore:append({ "*.orig" }) -- Merge resolution files +vim.opt.wildignore:append({ "*/node_modules/*" }) -- -- Shada vim.opt.shada = "!,'1000,f1,<1000,s100,:1000,/1000,h" @@ -253,7 +252,7 @@ vim.cmd([[ " Only show cursorline in the au WinEnter,InsertLeave * set cursorline augroup END ]]) -vim.opt.cursorline = true -- +vim.opt.cursorline = true -- vim.opt.guicursor = "i:ver100,r:hor100" -- -- Trailing whitespace -- cgit v1.2.3 From 68700f3146a5265e5793c93ce1aaaa69c0f3fa10 Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 13:23:41 +0200 Subject: Clean config and allowed to only load dapui once --- lua/plugins/dap.lua | 253 ++++++++++++++-------------------------------------- 1 file changed, 66 insertions(+), 187 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index a0ec4f4..3189f4f 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,15 +1,14 @@ local dap = require('dap') -- options ---dap.set_exception_breakpoints("default") dap.defaults.fallback.switchbuf = 'uselast' dap.defaults.fallback.focus_terminal = true -dap.defaults.fallback.terminal_win_cmd = '10split new' - ---vim.cmd([[ --- autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('') | endif ---]]) +dap.defaults.fallback.external_terminal = { + command = '/usr/bin/wezterm', + args = { '-e' }, +} +-- Autocmds vim.api.nvim_create_autocmd("FileType", { pattern = { "dap-float" }, callback = function(event) @@ -18,45 +17,6 @@ vim.api.nvim_create_autocmd("FileType", { end, }) ---dap.defaults.fallback.external_terminal = { --- command = '/usr/bin/wezterm'; --- args = {'-e'}; ---} ---dap.adapters.lldb = { --- type = 'executable', --- --command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path --- --command = '/usr/bin/vscode-lldb', -- adjust as needed, must be absolute path --- command = 'codelldb', --- --command = 'lldb', --- --command = codelldb_root, --- --command = vim.fn.stdpath("data") .. '/mason/bin/codelldb', --- name = 'lldb', --- host = '127.0.0.1', --- port = 13000 ---} --- ---local lldb = { --- name = "Launch lldb", --- type = "lldb", -- matches the adapter --- request = "launch", -- could also attach to a currently running process --- program = function() --- return vim.fn.input( --- "Path to executable: ", --- vim.fn.getcwd() .. "/", --- "file" --- ) --- end, --- cwd = "${workspaceFolder}", --- stopOnEntry = false, --- args = {}, --- runInTerminal = false, --- --type = 'server', --- port = "${port}", --- executable = { --- --command = vim.fn.stdpath("data") .. '/mason/bin/codelldb', --- args = { "--port", "${port}" }, --- } ---} dap.adapters.cppdbg = { id = 'cppdbg', type = 'executable', @@ -86,19 +46,16 @@ dap.adapters.lldb = { } dap.configurations.cpp = { { - name = "Launch file", + name = "Debugger", --type = "lldb", --type = "cppdbg", type = "codelldb", request = "launch", - --request = "Attach", - --processId = function() - -- return tonumber(vim.fn.input({ prompt = "Pid: "})) - --end, cwd = '${workspaceFolder}', program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, + --program = '${file}', --program = function() -- -- First, check if exists CMakeLists.txt -- local cwd = vim.fn.getcwd() @@ -139,71 +96,11 @@ dap.configurations.cpp = { --}, }, } --- dap.adapters.cppdbg = { --- name = 'cppdbg', --- type = 'executable', --- command = vim.fn.stdpath('data') .. '/mason/bin/OpenDebugAD7', --- } --- dap.configurations.cpp = { --- { --- name = 'Launch', --- type = 'cppdbg', --- request = 'launch', --- --request = 'attach', --- MIMode = 'gdb', --- --cwd = '${workspaceFolder}', --- -- udb='live', --- -- miDebuggerPath = 'udb', --- setupCommands= { --- { --- description= "Enable pretty-printing for gdb", --- text= "-enable-pretty-printing", --- ignoreFailures= true, --- } --- }, --- program = '${file}', --- cwd = vim.fn.getcwd(), --- --attach = { --- -- pidProperty = "processId", --- -- pidSelect = "ask" --- --}, --- stopAtEntry = true, --- --program = 'main', --- --program = '${workspaceFolder}/main' --- --program = '${file}', --- --program = function() --- -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') --- --end, --- }, --- } - ---require('dap').configurations.c = { --- lldb -- different debuggers or more configurations can be used here ---} - --- cpp (c,c++,rust) ---dap.configurations.c = { --- { --- name = 'Launch', --- type = 'lldb', --- request = 'launch', --- --program = function() --- -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') --- --end, --- terminal = 'integrated', --- console = 'integratedTerminal', --- program = function() --- return vim.fn.input('program: ', vim.loop.cwd() .. '/', 'file') --- end, --- cwd = "${workspaceFolder}", --- stopOnEntry = false, --- args = {}, --- }, ---} -- If you want to use this for Rust and C, add something like this: dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp + -- javascript --dap.adapters.node2 = { -- type = 'executable', @@ -242,11 +139,11 @@ dap.configurations.python = { }, } ---local dapui = require('dapui') -local dap_ui_status_ok, dapui = pcall(require, "dapui") -if not dap_ui_status_ok then - return -end +local dapui = require('dapui') +--local dap_ui_status_ok, dapui = pcall(require, "dapui") +--if not dap_ui_status_ok then +-- return +--end -- setup repl --dap.repl.commands = vim.tbl_extend('force', dap.repl.commands, { @@ -257,74 +154,64 @@ end -- } --}) --- setup dapui -dapui.setup({ - mappings = { - expand = "", - open = "o", - remove = "D", - edit = "e", - repl = "r", - toggle = "t", - }, - controls = { - element = "repl", - enabled = true, - --icons = { - -- disconnect = "", - -- pause = "", - -- play = "", - -- run_last = "", - -- step_back = "", - -- step_into = "", - -- step_out = "", - -- step_over = "", - -- terminate = "", - --}, - }, - layouts = { - { - elements = { - -- Elements can be strings or table with id and size keys. - --{ id = "scopes", size = 0.4 }, - { id = "watches", size = 0.25 }, - { id = "scopes", size = 0.25 }, - { id = "breakpoints", size = 0.25 }, - { id = "stacks", size = 0.25 }, +-- Load dapui configuration only if it hasn't been loaded before +if not vim.g.loaded_dapui then + require("dapui").setup({ + mappings = { + expand = "", + open = "o", + remove = "D", + edit = "e", + repl = "r", + toggle = "t", + }, + controls = { + enabled = true, + }, + layouts = { + { + elements = { + -- Elements can be strings or table with id and size keys. + { id = "watches", size = 0.25 }, + { id = "scopes", size = 0.25 }, + { id = "breakpoints", size = 0.25 }, + { id = "stacks", size = 0.25 }, + }, + size = 50, -- 40 columns + position = "left", }, - size = 50, -- 40 columns - position = "left", + { + elements = { + { id = "console", size = 0.6 }, + { id = "repl", size = 0.4 }, + }, + size = 0.3, + position = "bottom", + }, + }, + render = { + max_value_lines = 3, }, - { - elements = { - { id = "console", size = 0.6 }, - { id = "repl", size = 0.4 }, + floating = { + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. + border = "single", -- Border style. Can be "single", "double" or "rounded" + mappings = { + close = { "q", "" }, }, - size = 0.3, - position = "bottom", }, - }, - render = { - max_value_lines = 3, - }, - floating = { - max_height = nil, -- These can be integers or a float between 0 and 1. - max_width = nil, -- Floats will be treated as percentage of your screen. - border = "single", -- Border style. Can be "single", "double" or "rounded" - mappings = { - close = { "q", "" }, + --icons = { expanded = "-", collapsed = "$" }, + icons = { + expanded = "", + collapsed = "", + current_frame = "", }, - }, - --icons = { expanded = "-", collapsed = "$" }, - icons = { - expanded = "", - collapsed = "", - current_frame = "", - }, - { "theHamsta/nvim-dap-virtual-text", config = true }, -}) + }) + vim.g.loaded_dapui = true +end + --- signs +-- Signs local sign = vim.fn.sign_define sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" }) sign("DapBreakpointCondition", { text = "◆", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) -- @@ -351,15 +238,7 @@ dap.listeners.before.disconnect["dapui_config"] = function() dapui.close() end -local dap_virtual_text_status_ok, dap_virtual_text_status = pcall(require, "nvim-dap-virtual-text") -if not dap_virtual_text_status_ok then - return -end ---require("nvim-dap-virtual-text").setup() - ---local dap_virtual_text_status = require('nvim-dap-virtual-text') ---require("nvim-dap-virtual-text").setup { -dap_virtual_text_status.setup { +require("nvim-dap-virtual-text").setup { enabled = true, enabled_commands = true, highlight_changed_variables = true, -- cgit v1.2.3 From 7d0a4c211319001e0a5ff7d11a794312c348133b Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 13:24:19 +0200 Subject: Don't ingnore .log files anymore --- lua/plugins/telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index c2867ff..9c72dcf 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -34,7 +34,7 @@ require('telescope').setup({ "%.DS_Store", "%.git/", "%.spl", - "%.log", + --"%.log", "%[No Name%]", -- new files / sometimes folders (netrw) "/$", -- ignore folders (netrw) "node_modules", -- cgit v1.2.3 From f38e114b751d365447f06075148b2423d3fc438a Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 13:24:58 +0200 Subject: Add utils#ToggleVerbose() mapping --- lua/user/keys.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index 8c6bb52..b969839 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -157,6 +157,8 @@ map("v", "sr", 'y:%s/"//gc') -- Toggle Diff map("n", "td", "call utils#ToggleDiff()") +map("n", "tv", "call utils#ToggleVerbose()") + -- Map delete to Ctrl+l map("i", "", "") -- cgit v1.2.3 From b5c8e244abfdcfd4220074d109462ba4c6a9edaf Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 14:01:25 +0200 Subject: Removed commented out plugins --- init.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/init.lua b/init.lua index c14ae16..b9c54c0 100644 --- a/init.lua +++ b/init.lua @@ -79,7 +79,6 @@ local modules = { --"plugins.git", "plugins.gitsigns", "plugins.neoscroll", - --"plugins.null-ls", "plugins.lsp", "plugins.statuscol", "plugins.goto-preview", @@ -94,8 +93,6 @@ local modules = { "plugins.trouble", "plugins.dashboard", "plugins.dap", - --"plugins.modify-blend", - --"plugins.floatterm", } -- cgit v1.2.3 From e431fa3d2bb227de952af19dc88842922f858fb2 Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 14:01:37 +0200 Subject: Clean config --- lua/user/pack.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 05d92f6..c45517d 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -73,23 +73,22 @@ return packer.startup(function(use) }) use("rmagatti/goto-preview") - -- neodev - use("folke/neodev.nvim") - -- Debugger use("mfussenegger/nvim-dap") -- Debug Adapter Protocol client implementation for Neovim use("rcarriga/nvim-dap-ui") -- UI for nvim-dap + --use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} } use("theHamsta/nvim-dap-virtual-text") use("gabrielpoca/replacer.nvim") - use({ - "jayp0521/mason-nvim-dap.nvim", - config = function() - require("mason-nvim-dap").setup({ - automatic_installation = true, - ensure_installed = { "python", "cppdbg", "codelldb" }, - }) - end, - }) + use("jayp0521/mason-nvim-dap.nvim") + --use({ + -- "jayp0521/mason-nvim-dap.nvim", + -- config = function() + -- require("mason-nvim-dap").setup({ + -- automatic_installation = true, + -- ensure_installed = { "python", "cppdbg", "codelldb" }, + -- }) + -- end, + --}) -- Linters/Formatters use('mhartington/formatter.nvim') @@ -144,6 +143,7 @@ return packer.startup(function(use) use("axkirillov/telescope-changed-files") -- -- UX + use("folke/neodev.nvim") use({ 'numToStr/Navigator.nvim', -- Navigate between Tmux and Nvim config = function() -- cgit v1.2.3 From 0b4b69077d811960a0cf613c7e25f82f34188411 Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 14:01:43 +0200 Subject: Clean config --- lua/plugins/navic.lua | 74 +++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/lua/plugins/navic.lua b/lua/plugins/navic.lua index c27d76a..a95485d 100644 --- a/lua/plugins/navic.lua +++ b/lua/plugins/navic.lua @@ -10,41 +10,41 @@ local navic = require("nvim-navic") --} navic.setup { - icons = { - File = " ", - Module = " ", - Namespace = " ", - Package = " ", - Class = " ", - Method = " ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = "練", - Interface = "練", - Function = " ", - Variable = " ", - Constant = " ", - String = " ", - Number = " ", - Boolean = "◩ ", - Array = " ", - Object = " ", - Key = " ", - Null = "ﳠ ", - EnumMember = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - }, - lsp = { - auto_attach = true, - --preference = nil, - }, - highlight = false, - separator = " > ", - depth_limit = 0, - depth_limit_indicator = "..", - safe_output = true + icons = { + File = " ", + Module = " ", + Namespace = " ", + Package = " ", + Class = " ", + Method = " ", + Property = " ", + Field = " ", + Constructor = " ", + Enum = "練", + Interface = "練", + Function = " ", + Variable = " ", + Constant = " ", + String = " ", + Number = " ", + Boolean = "◩ ", + Array = " ", + Object = " ", + Key = " ", + Null = "ﳠ ", + EnumMember = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + }, + lsp = { + auto_attach = true, + --preference = nil, + }, + highlight = false, + separator = " > ", + depth_limit = 0, + depth_limit_indicator = "..", + safe_output = true } -- cgit v1.2.3 From 796ac3e0f25417e198a1a70e4bf6b8894670df8d Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 12 May 2023 14:03:06 +0200 Subject: Commented out DAPMessages --- lua/plugins/heirline.lua | 218 ++++++++++++++++++++++++----------------------- 1 file changed, 113 insertions(+), 105 deletions(-) diff --git a/lua/plugins/heirline.lua b/lua/plugins/heirline.lua index d047c1a..5c3eb44 100644 --- a/lua/plugins/heirline.lua +++ b/lua/plugins/heirline.lua @@ -43,10 +43,10 @@ local RightSpace = { provider = "" } local ViMode = { init = function(self) self.mode = vim.fn.mode(1) - if not self.once then - vim.cmd("au ModeChanged *:*o redrawstatus") - end - self.once = true + --if not self.once then + -- vim.cmd("au ModeChanged *:*o redrawstatus") + --end + --self.once = true end, static = { mode_names = { @@ -337,98 +337,67 @@ local Git = { -- Debugger -- Display informations from nvim-dap! -- Note that we add spaces separately, so that only the icon characters will be clickable -local DAPMessages = { - condition = function() - local session = require("dap").session() - return session ~= nil - end, - provider = function() - return " " .. require("dap").status() .. " " - end, - hl = "Debug", - { - provider = "", - on_click = { - callback = function() - require("dap").step_into() - end, - name = "heirline_dap_step_into", - }, - }, - { provider = " " }, - { - provider = "", - on_click = { - callback = function() - require("dap").step_out() - end, - name = "heirline_dap_step_out", - }, - }, - { provider = " " }, - { - provider = " ", - on_click = { - callback = function() - require("dap").step_over() - end, - name = "heirline_dap_step_over", - }, - }, - { provider = " " }, - { - provider = "ﰇ", - on_click = { - callback = function() - require("dap").run_last() - end, - name = "heirline_dap_run_last", - }, - }, - { provider = " " }, - { - provider = "", - on_click = { - callback = function() - require("dap").terminate() - require("dapui").close({}) - end, - name = "heirline_dap_close", - }, - }, - { provider = " " }, - -- icons:       ﰇ   -} --local DAPMessages = { --- -- display the dap messages only on the debugged file -- condition = function() -- local session = require("dap").session() --- if session then --- local filename = vim.api.nvim_buf_get_name(0) --- if session.config then --- local progname = session.config.program --- return filename == progname --- end --- end --- return false +-- return session ~= nil -- end, -- provider = function() --- return " " .. require("dap").status() +-- return " " .. require("dap").status() .. " " -- end, --- hl = { fg = utils.get_highlight("Debug").fg }, --- -- Debugger on_click: step-over, step-into, next, previous, stop buttons --- -- coming soon! ---} ---local DAPMessages = { --- condition = function() --- local session = require("dap").session() --- return session ~= nil --- end, --- provider = function() --- return " " .. require("dap").status() --- end, --- hl = "Debug" --- -- see Click-it! section for clickable actions +-- hl = "Debug", +-- { +-- provider = "", +-- on_click = { +-- callback = function() +-- require("dap").step_into() +-- end, +-- name = "heirline_dap_step_into", +-- }, +-- }, +-- { provider = " " }, +-- { +-- provider = "", +-- on_click = { +-- callback = function() +-- require("dap").step_out() +-- end, +-- name = "heirline_dap_step_out", +-- }, +-- }, +-- { provider = " " }, +-- { +-- provider = " ", +-- on_click = { +-- callback = function() +-- require("dap").step_over() +-- end, +-- name = "heirline_dap_step_over", +-- }, +-- }, +-- { provider = " " }, +-- { +-- provider = "ﰇ", +-- on_click = { +-- callback = function() +-- require("dap").run_last() +-- end, +-- name = "heirline_dap_run_last", +-- }, +-- }, +-- { provider = " " }, +-- { +-- provider = "", +-- on_click = { +-- callback = function() +-- require("dap").terminate() +-- require("dapui").close({}) +-- end, +-- name = "heirline_dap_close", +-- }, +-- }, +-- { provider = " " }, +-- -- icons:       ﰇ   --} -- Tests @@ -796,10 +765,10 @@ local left = { } local middle = { - { Align, hl = { bg = colors.nobg, force = true } }, - { Navic, hl = { bg = colors.nobg, force = true } }, - { DAPMessages, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, + --{ Navic, hl = { bg = colors.nobg, force = true } }, + --{ DAPMessages, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, } local right = { @@ -816,21 +785,15 @@ local right = { local sections = { left, middle, right } local DefaultStatusline = { sections } -local InactiveStatusline = { - condition = conditions.is_not_active, - { FileNameBlock, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, -} - local specialleft = { { ViMode, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, { LeftSpace, hl = { bg = colors.nobg, force = true } }, } local specialmiddle = { - { Align, hl = { bg = colors.nobg, force = true } }, - { DAPMessages, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, + --{ DAPMessages, hl = { bg = colors.nobg, force = true } }, + { Align, hl = { bg = colors.nobg, force = true } }, } local specialright = { @@ -840,6 +803,13 @@ local specialright = { local specialsections = { specialleft, specialmiddle, specialright } +local InactiveStatusline = { + condition = conditions.is_not_active, + --{ FileNameBlock, hl = { bg = colors.nobg, force = true } }, + --{ Align, hl = { bg = colors.nobg, force = true } }, + specialsections +} + local SpecialStatusline = { condition = function() return conditions.buffer_matches({ @@ -850,6 +820,8 @@ local SpecialStatusline = { specialsections } +--local InactiveStatusline = SpecialStatusline + local TerminalStatusline = { condition = function() return conditions.buffer_matches({ buftype = { "terminal" } }) @@ -859,18 +831,54 @@ local TerminalStatusline = { local StatusLine = { static = { + --mode_colors = { + -- n = colors.blue, + -- i = colors.green, + -- v = colors.purple, + -- V = colors.purple, + -- ["\22"] = colors.purple, + -- c = colors.orange, + -- s = colors.purple, + -- S = colors.purple, + -- ["\19"] = colors.purple, + -- R = colors.red, + -- r = colors.red, + -- ["!"] = colors.orange, + -- t = colors.orange, + --}, mode_colors = { n = colors.blue, - i = colors.green, + no = colors.blue, + nov = colors.blue, + noV = colors.blue, + ["no\22"] = colors.blue, + niI = colors.blue, + niR = colors.blue, + niV = colors.blue, + nt = colors.blue, v = colors.purple, + vs = colors.purple, V = colors.purple, ["\22"] = colors.purple, - c = colors.orange, + ["\22s"] = colors.purple, s = colors.purple, S = colors.purple, ["\19"] = colors.purple, + i = colors.green, + ix = colors.green, + ic = colors.green, R = colors.red, + Rc = colors.red, + Rx = colors.red, + Rv = colors.red, + Rvc = colors.red, + Rvx = colors.red, + c = colors.orange, + cv = colors.orange, + ce = colors.orange, r = colors.red, + rm = colors.red, + ["r?"] = colors.red, ["!"] = colors.orange, t = colors.orange, }, -- cgit v1.2.3 From f7b897714b9fb198aa77201f9d6ae21301b340fa Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 13 May 2023 15:45:41 +0200 Subject: Toggle Verbose function added --- autoload/utils.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/autoload/utils.vim b/autoload/utils.vim index b4356ba..03fdb07 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -115,4 +115,18 @@ function! utils#ToggleDiff() endfunction +"------------------------------------------------- + +" Toggle Verbose +function! utils#ToggleVerbose() + if !&verbose + set verbosefile=~/.config/nvim/verbose.log + set verbose=15 + else + set verbose=0 + set verbosefile= + endif +endfunction + + "------------------------------------------------- -- cgit v1.2.3 From 11a87e76c1cc11e9f7cb1be98a789463e57e827c Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 13 May 2023 15:46:24 +0200 Subject: Ignore all .log files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e890cff..f6f2fa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ plugin/packer_compiled.lua startup.log tmp +*.log -- cgit v1.2.3