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 | |
| parent | 0af6d5533bc0fbcd8038ce134d1bc7b68a9cfbd5 (diff) | |
| parent | 11a87e76c1cc11e9f7cb1be98a789463e57e827c (diff) | |
| download | dotfiles-b1c5565924725f7c94e0cd8677ea8914aa0aba45.tar.gz dotfiles-b1c5565924725f7c94e0cd8677ea8914aa0aba45.zip | |
Merge commit '7de320718f2b5ee487de4b9fe04661a55674cf37'
Diffstat (limited to '.config')
| -rw-r--r-- | .config/nvim/.gitignore | 1 | ||||
| -rw-r--r-- | .config/nvim/autoload/utils.vim | 14 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 58 | ||||
| -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 | ||||
| -rw-r--r-- | .config/nvim/lua/user/keys.lua | 42 | ||||
| -rw-r--r-- | .config/nvim/lua/user/opts.lua | 185 | ||||
| -rw-r--r-- | .config/nvim/lua/user/pack.lua | 40 |
15 files changed, 653 insertions, 559 deletions
diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore index e890cff..f6f2fa2 100644 --- a/.config/nvim/.gitignore +++ b/.config/nvim/.gitignore @@ -1,3 +1,4 @@ plugin/packer_compiled.lua startup.log tmp +*.log diff --git a/.config/nvim/autoload/utils.vim b/.config/nvim/autoload/utils.vim index b4356ba..03fdb07 100644 --- a/.config/nvim/autoload/utils.vim +++ b/.config/nvim/autoload/utils.vim @@ -116,3 +116,17 @@ 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 + + +"------------------------------------------------- diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 4a5f5eb..b9c54c0 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/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,6 +68,7 @@ local modules = { --"user.scripts", "plugins.colorscheme", "plugins.treesitter", + "plugins.neodev", "plugins.telescope", "plugins.nvim-tree", "plugins.quickfix", @@ -80,9 +79,7 @@ local modules = { --"plugins.git", "plugins.gitsigns", "plugins.neoscroll", - --"plugins.null-ls", "plugins.lsp", - "plugins.lsp_lines", "plugins.statuscol", "plugins.goto-preview", "plugins.autopairs", @@ -91,12 +88,11 @@ local modules = { "plugins.fidget", "plugins.web-devicons", "plugins.heirline", + "plugins.neotest", "plugins.toggleterm", "plugins.trouble", "plugins.dashboard", "plugins.dap", - --"plugins.modify-blend", - --"plugins.floatterm", } @@ -113,9 +109,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 @@ -127,24 +123,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", @@ -152,7 +148,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 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 { diff --git a/.config/nvim/lua/user/keys.lua b/.config/nvim/lua/user/keys.lua index 8e16d03..b969839 100644 --- a/.config/nvim/lua/user/keys.lua +++ b/.config/nvim/lua/user/keys.lua @@ -157,6 +157,8 @@ map("v", "<leader>sr", 'y:%s/<C-r><C-r>"//g<Left><Left>c') -- Toggle Diff map("n", "<leader>td", "<Cmd>call utils#ToggleDiff()<CR>") +map("n", "<leader>tv", "<Cmd>call utils#ToggleVerbose()<CR>") + -- Map delete to Ctrl+l map("i", "<C-l>", "<Del>") @@ -364,31 +366,47 @@ map("n", "<leader>ds", function() end) -- Set breakpoints, get variable values, step into/out of functions, etc. -map("n", "<leader>dl", require("dap.ui.widgets").hover) -map("n", "<leader>dc", dap.continue) -map("n", "<leader>dC", dap.close) -map("n", "<leader>dt", dap.terminate) -map("n", "<leader>db", dap.toggle_breakpoint) +map("n", "<leader>dC", dap.continue) +--map("n", "<leader>dC", dap.close) +--map("n", "<leader>dt", dap.terminate) +map("n", "<leader>dt", ui.toggle) +map("n", "<leader>dd", function() dap.disconnect({ terminateDebuggee = true }) end) map("n", "<leader>dn", dap.step_over) map("n", "<leader>di", dap.step_into) map("n", "<leader>do", dap.step_out) +map("n", "<leader>db", dap.toggle_breakpoint) map("n", "<leader>dB", function() dap.clear_breakpoints() require("notify")("Breakpoints cleared", "warn") end) +map("n", "<leader>dl", require("dap.ui.widgets").hover) +map("n", "<leader>de", function() require("dapui").float_element() end, + { desc = "Open Element" }) +map("n", "<leader>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" }) +map("n", "<leader>dc", function() + require("telescope").extensions.dap.commands() +end, { desc = "DAP-Telescope: Commands" }) --vim.keymap.set("n", "<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>") --vim.keymap.set("v", "<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>") --vim.keymap.set("n", "<leader>lp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>") --vim.keymap.set("n", "<leader>dr", ":lua require'dap'.repl.open()<CR>") -- Close debugger and clear breakpoints -map("n", "<leader>de", function() - dap.clear_breakpoints() - ui.toggle({}) - dap.terminate() - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-w>=", false, true, true), "n", false) - require("notify")("Debugger session ended", "warn") -end) +--map("n", "<leader>de", function() +-- dap.clear_breakpoints() +-- ui.toggle({}) +-- dap.terminate() +-- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-w>=", false, true, true), "n", false) +-- require("notify")("Debugger session ended", "warn") +--end) -- Dashboard map("n", "<leader><Space>", "<CMD>Dashboard<CR>") diff --git a/.config/nvim/lua/user/opts.lua b/.config/nvim/lua/user/opts.lua index aa4d0c2..6375350 100644 --- a/.config/nvim/lua/user/opts.lua +++ b/.config/nvim/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 diff --git a/.config/nvim/lua/user/pack.lua b/.config/nvim/lua/user/pack.lua index f71e114..c45517d 100644 --- a/.config/nvim/lua/user/pack.lua +++ b/.config/nvim/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') @@ -140,9 +139,11 @@ 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 + use("folke/neodev.nvim") use({ 'numToStr/Navigator.nvim', -- Navigate between Tmux and Nvim config = function() @@ -194,6 +195,21 @@ return packer.startup(function(use) -- require("plugins.ultest") -- 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") |
