diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-05-13 15:52:07 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-05-13 15:52:07 +0200 |
| commit | b1c5565924725f7c94e0cd8677ea8914aa0aba45 (patch) | |
| tree | cee78973c5eabacb9ac6a49386ace3902cd85282 /.config/nvim/lua/plugins | |
| parent | 0af6d5533bc0fbcd8038ce134d1bc7b68a9cfbd5 (diff) | |
| parent | 11a87e76c1cc11e9f7cb1be98a789463e57e827c (diff) | |
| download | dotfiles-b1c5565924725f7c94e0cd8677ea8914aa0aba45.tar.gz dotfiles-b1c5565924725f7c94e0cd8677ea8914aa0aba45.zip | |
Merge commit '7de320718f2b5ee487de4b9fe04661a55674cf37'
Diffstat (limited to '.config/nvim/lua/plugins')
| -rw-r--r-- | .config/nvim/lua/plugins/dap.lua | 324 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/fidget.lua | 37 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/heirline.lua | 339 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 22 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp_lines.lua | 21 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/navic.lua | 86 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/neodev.lua | 29 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/neotest.lua | 11 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/telescope.lua | 3 |
9 files changed, 461 insertions, 411 deletions
diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua index a3e40df..3189f4f 100644 --- a/.config/nvim/lua/plugins/dap.lua +++ b/.config/nvim/lua/plugins/dap.lua @@ -1,48 +1,28 @@ local dap = require('dap') ---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}" }, --- } ---} + +-- options +dap.defaults.fallback.switchbuf = 'uselast' +dap.defaults.fallback.focus_terminal = true +dap.defaults.fallback.external_terminal = { + command = '/usr/bin/wezterm', + args = { '-e' }, +} + +-- Autocmds +vim.api.nvim_create_autocmd("FileType", { + pattern = { "dap-float" }, + callback = function(event) + vim.keymap.set("n", "<Tab>", "", { buffer = event.buf, silent = true }) + vim.keymap.set("n", "<S-Tab>", "", { buffer = event.buf, silent = true }) + end, +}) + dap.adapters.cppdbg = { id = '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 = { @@ -54,7 +34,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, } @@ -66,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() @@ -117,73 +94,13 @@ dap.configurations.cpp = { -- ignoreFailures = false -- } --}, -}, + }, } --- 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', @@ -205,28 +122,28 @@ 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') -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, { @@ -237,86 +154,70 @@ 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" +-- Load dapui configuration only if it hasn't been loaded before +if not vim.g.loaded_dapui then + require("dapui").setup({ mappings = { - close = { "q", "<Esc>" }, - }, - }, -}) - --- setup dapui -dapui.setup({ - mappings = { expand = "<CR>", open = "o", remove = "D", edit = "e", repl = "r", toggle = "t", - }, - controls = { - enabled = false, - }, - layouts = { - { - elements = { - { id = "scopes", size = 0.5 }, - { id = "watches", size = 0.5 }, + }, + 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", + }, + { + elements = { + { id = "console", size = 0.6 }, + { id = "repl", size = 0.4 }, + }, + size = 0.3, + position = "bottom", }, - size = 40, - position = "left", }, - { - elements = { "console", "repl" }, - position = "bottom", - size = 15, + render = { + max_value_lines = 3, }, - }, - 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", "<Esc>" }, + 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", "<Esc>" }, + }, }, - }, - --icons = { expanded = "-", collapsed = "$" }, - icons = { - expanded = "", - collapsed = "", - current_frame = "", - }, -}) + --icons = { expanded = "-", collapsed = "$" }, + icons = { + expanded = "", + collapsed = "", + current_frame = "", + }, + }) + 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 = "" }) -- +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' }) @@ -337,34 +238,17 @@ 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() - -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 = "<module", -- filter references (not definitions) pattern when all_references is activated (Lua gmatch pattern, default filters out Python modules) - -- experimental features: - virt_text_pos = "eol", -- position of virtual text, see `:h nvim_buf_set_extmark()` - all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine. - virt_lines = false, -- show virtual lines instead of virtual text (will flicker!) - virt_text_win_col = nil -- position the virtual text at a fixed window column (starting from the first text column) , - -- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()` -}) - -vim.cmd([[ - autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('<abuf>') | endif -]]) --- options ---dap.set_exception_breakpoints("default") -dap.defaults.fallback.focus_terminal = false -dap.defaults.fallback.terminal_win_cmd = '10split new' +require("nvim-dap-virtual-text").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 = "<module", + virt_text_pos = "eol", + all_frames = false, + virt_text_win_col = nil +} diff --git a/.config/nvim/lua/plugins/fidget.lua b/.config/nvim/lua/plugins/fidget.lua index 0f56a6b..d401c5f 100644 --- a/.config/nvim/lua/plugins/fidget.lua +++ b/.config/nvim/lua/plugins/fidget.lua @@ -1,33 +1,34 @@ require("fidget").setup({ + --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 }, }) diff --git a/.config/nvim/lua/plugins/heirline.lua b/.config/nvim/lua/plugins/heirline.lua index dc415d5..5c3eb44 100644 --- a/.config/nvim/lua/plugins/heirline.lua +++ b/.config/nvim/lua/plugins/heirline.lua @@ -43,47 +43,47 @@ 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 = { - n = "NORMAL ", - no = "N·OPERATOR PENDING ", - nov = "N?", - noV = "N?", - ["no\22"] = "N? ", - niI = "Ni", - niR = "Nr", - niV = "Nv", - nt = "Nt", - v = "VISUAL ", - vs = "Vs", - V = "V·LINE ", + 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 ", ["\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", + Rvc = " Rv ", + Rvx = " Rv ", c = "COMMAND ", - cv = "VIM EX ", - ce = "EX ", - r = "PROMPT ", - rm = "MORE ", + cv = " VIM EX ", + ce = " EX ", + r = " PROMPT ", + rm = " MORE ", ["r?"] = "CONFIRM ", - ["!"] = "SHELL ", - t = "TERMINAL ", + ["!"] = " SHELL ", + t = "TERMINAL", }, }, provider = function(self) @@ -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, @@ -337,26 +336,69 @@ local Git = { -- Debugger -- Display informations from nvim-dap! -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! -} +-- 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: ﰇ +--} -- Tests -- This requires the great ultest. @@ -535,7 +577,7 @@ local Spell = { hl = { bold = true, fg = colors.yellow }, } -local help_file_name = { +local HelpFileName = { condition = function() return vim.bo.filetype == "help" end, @@ -546,9 +588,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( @@ -635,8 +719,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 = { @@ -679,30 +763,51 @@ 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 } }, - { 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 = { - { 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 } }, } local sections = { left, middle, right } local DefaultStatusline = { sections } +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 } }, +} + +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 InactiveStatusline = { condition = conditions.is_not_active, - { FileNameBlock, hl = { bg = colors.nobg, force = true } }, - { Align, hl = { bg = colors.nobg, force = true } }, + --{ FileNameBlock, hl = { bg = colors.nobg, force = true } }, + --{ Align, hl = { bg = colors.nobg, force = true } }, + specialsections } local SpecialStatusline = { @@ -712,44 +817,68 @@ local SpecialStatusline = { 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 } }, - { RightSpace, hl = { bg = colors.nobg, force = true } }, - { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, + specialsections } +--local InactiveStatusline = SpecialStatusline + 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 } }, - { RightSpace, hl = { bg = colors.nobg, force = true } }, - { Ruler, hl = { fg = utils.get_highlight("statusline").bg, force = true } }, + specialsections } 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, }, @@ -780,6 +909,7 @@ local WinbarFileNameBlock = { end, hl = { bg = colors.bg }, } + local WinbarFileName = { provider = function(self) -- first, trim the pattern relative to the current directory. For other @@ -804,8 +934,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", { @@ -860,11 +990,11 @@ 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 = { "nofile", "prompt", "help", "quickfix" }, - filetype = { "^git.*", "fugitive", "dashboard", }, + buftype = { "terminal", "nofile", "prompt", "help", "quickfix" }, + filetype = { "dap-ui", "NvimTree", "^git.*", "fugitive", "dashboard", }, }) end, init = function() @@ -872,7 +1002,7 @@ local Center = { end, }, { - -- A special winbar for terminals + -- A special winbar for terminals condition = function() return conditions.buffer_matches({ buftype = { "terminal" } }) end, @@ -881,7 +1011,7 @@ local Center = { --TerminalName, }, { - -- An inactive winbar for regular files + -- An inactive winbar for regular files condition = function() return not conditions.is_active() end, @@ -1097,29 +1227,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("", "<A-" .. key .. ">", function() - goto_buf(index) - end, { noremap = true, silent = true }) + vim.keymap.set("", "<A-" .. key .. ">", 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) diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 44f1999..c9ccc55 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/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, diff --git a/.config/nvim/lua/plugins/lsp_lines.lua b/.config/nvim/lua/plugins/lsp_lines.lua deleted file mode 100644 index 5adcb8e..0000000 --- a/.config/nvim/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 -}) diff --git a/.config/nvim/lua/plugins/navic.lua b/.config/nvim/lua/plugins/navic.lua index a58240a..a95485d 100644 --- a/.config/nvim/lua/plugins/navic.lua +++ b/.config/nvim/lua/plugins/navic.lua @@ -1,46 +1,50 @@ 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 = { - 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 = " ", - }, - 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 } diff --git a/.config/nvim/lua/plugins/neodev.lua b/.config/nvim/lua/plugins/neodev.lua new file mode 100644 index 0000000..f820422 --- /dev/null +++ b/.config/nvim/lua/plugins/neodev.lua @@ -0,0 +1,29 @@ +require("neodev").setup({ + --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, +}) diff --git a/.config/nvim/lua/plugins/neotest.lua b/.config/nvim/lua/plugins/neotest.lua new file mode 100644 index 0000000..aa73899 --- /dev/null +++ b/.config/nvim/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" }, + }), + }, +}) diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 1299b2f..9c72dcf 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/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", @@ -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 { |
