From 7b730d6b7b016d5cd602f280f879602ab44f59bd Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 18 Mar 2023 23:00:44 +0200 Subject: Add URL handling mapping with system awareness --- lua/user/keys.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index fe9e3af..e007260 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -177,6 +177,17 @@ map("n", "cd", ":cd %:p:h:pwd") -- Open the current file in the default program (on Mac this should just be just `open`) map('n', 'o', ':!xdg-open %') +-- URL handling +if vim.fn.has("mac") == 1 then + map("", "gx", 'call jobstart(["open", expand("")], {"detach": v:true})', {}) +elseif vim.fn.has("unix") == 1 then + map("", "gx", 'call jobstart(["xdg-open", expand("")], {"detach": v:true})', {}) +elseif vim.fn.has("wsl") == 1 then + map("", "gx", 'call jobstart(["wslview", expand("")], {"detach": v:true})', {}) +else + map[''].gx = {'lua print("Error: gx is not supported on this OS!")'} +end + -- Toggle completion map("n", "tc", ":lua require('user.mods').toggle_completion()") -- cgit v1.2.3 From b15a0fc79038399c9c61975372620330af67fb4d Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 18 Mar 2023 23:00:52 +0200 Subject: Clean config --- lua/plugins/dap.lua | 177 ---------------------------------------------------- 1 file changed, 177 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 2fb4333..5285ca1 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,180 +1,3 @@ ---local status, dap = pcall(require,"dap") ---if (not status) then return end ---local status2, dapui = pcall(require,"dapui") ---if (not status2) then return end ---local status3, daptext = pcall(require,"nvim-dap-virtual-text") ---if (not status3) then return end --- ---dapui.setup() ---daptext.setup({}) --- ---vim.fn.sign_define('DapBreakpoint', {text='🔴'}) ---vim.fn.sign_define('DapStopped', {text='🟢'}) --- ---dap.listeners.after.event_initialized["dapui_config"] = function () --- dapui.open() ---end ---dap.listeners.before.event_terminated["dapui_config"] = function () --- dapui.close() ---end ---dap.listeners.before.event_exited["dapui_config"] = function () --- dapui.close() ---end --- ----- --- Adapters --- -- --- ----- CPP Setup ---dap.adapters.cppdbg = { --- id = 'cppdbg', --- type = 'executable', --- command = os.getenv("USERPROFILE") .. '\\dap_adapters\\cpptools\\extension\\debugAdapters\\bin\\OpenDebugAD7.exe', --- options = { --- detached = false --- } ---} --- ---dap.adapters.codelldb = { --- type = 'server', --- port = "${port}", --- executable = { --- -- CHANGE THIS to your path! --- command = os.getenv("USERPROFILE") .. "\\dap_adapters\\codelldb\\extension\\adapter\\codelldb", --- args = {"--port", "${port}"}, --- --- -- On windows you may have to uncomment this: --- detached = false, --- } ---} --- ----- --- configurations --- -- --- ----- CPP Setup ---dap.configurations.cpp = { --- { --- name = "DBG Debug", --- type = "cppdbg", --- request = "launch", --- program = function() --- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') --- end, --- cwd = '${workspaceFolder}', --- stopAtEntry = true --- }, --- { --- name = "LLDB Debug", --- type = "codelldb", --- request = "launch", --- program = function() --- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') --- end, --- cwd = '${workspaceFolder}', --- stopOnEntry = false --- } ---} --- ---dap.configurations.c = dap.configurations.cpp ---dap DAP setup commands. --- --- ---Trevor Gray ---Covert this to lua (local dap (require :dap)) ---(local dapui (require :dapui)) ---(dapui.setup) --- ---(vim.api.nvim_set_hl 0 :DapBreakpoint {:ctermbg 0 :fg "#993939" :bg "#31353f"}) --- ---(vim.api.nvim_set_hl 0 :DapBreakpointLine {:bg "#251215"}) --- ---(vim.api.nvim_set_hl 0 :DapLogPoint {:ctermbg 0 :fg "#61afef" :bg "#31353f"}) --- ---(vim.api.nvim_set_hl 0 :DapLogPointLine {:bg "#252849"}) --- ---(vim.api.nvim_set_hl 0 :DapStopped {:ctermbg 0 :fg "#98c379" :bg "#31353f"}) ---(vim.api.nvim_set_hl 0 :DapStoppedLine {:bg "#15171B"}) --- ---(vim.fn.sign_define :DapBreakpoint --- {:text "" --- :texthl :DapBreakpoint --- :linehl :DapBreakpointLine --- :numhl :DapBreakpoint}) --- ---(vim.fn.sign_define :DapBreakpointCondition --- {:text "ﳁ" --- :texthl :DapBreakpoint --- :linehl :DapBreakpointLine --- :numhl :DapBreakpoint}) --- ---(vim.fn.sign_define :DapBreakpointRejected --- {:text "" --- :texthl :DapBreakpoint --- :linehl :DapBreakpointLine --- :numhl :DapBreakpoint}) --- ---(vim.fn.sign_define :DapLogPoint --- {:text "" --- :texthl :DapLogPoint --- :linehl :DapLogPointLine --- :numhl :DapLogPoint}) --- ---(vim.fn.sign_define :DapStopped --- {:text "" --- :texthl :DapStopped --- :linehl :DapStoppedLine --- :numhl :DapStopped}) --- ---(tset dap.listeners.after.event_initialized :dapui_config dapui.open) --- ---(tset dap.listeners.before.event_terminated :dapui_config dapui.close) --- ---(tset dap.listeners.before.event_exited :dapui_config dapui.close) --- ---(set dap.adapters.lldb {:type :executable --- :attach {:pidProperty :pid :pidSelect :ask} --- :command :lldb-vscode --- :env {:LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY :YES} --- :name :lldb}) --- ---local dap = require("dap") ---local dapui = require("dapui") ---dapui.setup() --- ---vim.api.nvim_set_hl(0, "DapBreakpoint", {ctermbg = 0, fg = "#993939", bg = "#31353f"}) ---vim.api.nvim_set_hl(0, "DapBreakpointLine", {bg = "#251215"}) ---vim.api.nvim_set_hl(0, "DapLogPoint", {ctermbg = 0, fg = "#61afef", bg = "#31353f"}) ---vim.api.nvim_set_hl(0, "DapLogPointLine", {bg = "#252849"}) ---vim.api.nvim_set_hl(0, "DapStopped", {ctermbg = 0, fg = "#98c379", bg = "#31353f"}) ---vim.api.nvim_set_hl(0, "DapStoppedLine", {bg = "#15171B"}) --- ---vim.fn.sign_define("DapBreakpoint", {text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"}) ---vim.fn.sign_define("DapBreakpointCondition", {text = "ﳁ", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"}) ---vim.fn.sign_define("DapBreakpointRejected", {text = "", texthl = "DapBreakpoint", linehl = "DapBreakpointLine", numhl = "DapBreakpoint"}) ---vim.fn.sign_define("DapLogPoint", {text = "", texthl = "DapLogPoint", linehl = "DapLogPointLine", numhl = "DapLogPoint"}) ---vim.fn.sign_define("DapStopped", {text = "", texthl = "DapStopped", linehl = "DapStoppedLine", numhl = "DapStopped"}) --- ---dap.listeners.after.event_initialized["dapui_config"] = function() ---dapui.open() ---end --- ---dap.listeners.before.event_terminated["dapui_config"] = function() ---dapui.close() ---end --- ---dap.listeners.before.event_exited["dapui_config"] = function() ---dapui.close() ---end --- ---dap.adapters.lldb = ({ --- type = "executable", --- attach = { --- pidProperty = "pid", --- pidSelect = "ask", --- }, --- command = "lldb-vscode", --- env = { --- LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY = "YES", --- }, --- name = "lldb" ---}).configurations.rust == dap.configurations.cpp local dap_ok, dap = pcall(require, "dap") if not (dap_ok) then print("nvim-dap not installed!") -- cgit v1.2.3 From 37be25930e0f213ea1ec1e6ed62d9d8c01a550bb Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 18 Mar 2023 23:17:08 +0200 Subject: Add c and python conf --- lua/plugins/dap.lua | 114 +++++++++++++++++++++++----------------------------- 1 file changed, 51 insertions(+), 63 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 5285ca1..9b96528 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,72 +1,60 @@ -local dap_ok, dap = pcall(require, "dap") -if not (dap_ok) then - print("nvim-dap not installed!") - return +local dap = require('dap') +local home_path = vim.fn.expand('$HOME') + +-- Unsafe Defaults +local mi_mode = "" +local mi_debugger_path = "" + +-- Unix +if vim.loop.os_uname().sysname == 'Linux' then + mi_mode = "gdb" + mi_debugger_path = vim.trim(vim.fn.system('which gdb')) +-- MacOS +elseif vim.loop.os_uname().sysname == 'Darwin' then + mi_mode = "lldb" + mi_debugger_path = vim.trim(vim.fn.system('which lldb-mi')) +else + error("Unsupported OS") end -require('dap').set_log_level('INFO') -- Helps when configuring DAP, see logs with :DapShowLog +dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + command = home_path .. '/extension/debugAdapters/bin/OpenDebugAD7', +} -dap.configurations = { - go = { - { - type = "go", -- Which adapter to use - name = "Debug", -- Human readable name - request = "launch", -- Whether to "launch" or "attach" to program - program = "${file}", -- The buffer you are focused on when running nvim-dap - }, +dap.configurations.cpp = { + { + name = "Launch file", + type = "cppdbg", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopAtEntry = true, + MIMode = mi_mode, + miDebuggerPath = mi_debugger_path } } -dap.adapters.go = { - type = "server", - port = "${port}", - executable = { - command = vim.fn.stdpath("data") .. '/mason/bin/dlv', - args = { "dap", "-l", "127.0.0.1:${port}" }, - }, + +dap.configurations.c = dap.configurations.cpp + +dap.adapters.python = { + type = 'executable'; + command = vim.trim(vim.fn.system('which python')); + args = { '-m', 'debugpy.adapter' }; } -local dap_ui_ok, ui = pcall(require, "dapui") -if not (dap_ok and dap_ui_ok) then - require("notify")("dap-ui not installed!", "warning") - return -end -ui.setup({ - icons = { expanded = "▾", collapsed = "▸" }, - mappings = { - open = "o", - remove = "d", - edit = "e", - repl = "r", - toggle = "t", - }, - expand_lines = vim.fn.has("nvim-0.7"), - layouts = { - { - elements = { - "scopes", - }, - size = 0.3, - position = "right" - }, +dap.configurations.python = { { - elements = { - "repl", - "breakpoints" - }, - size = 0.3, - position = "bottom", - }, - }, - floating = { - max_height = nil, - max_width = nil, - border = "single", - mappings = { - close = { "q", "" }, + -- 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, }, - }, - windows = { indent = 1 }, - render = { - max_type_length = nil, - }, -}) +} + -- cgit v1.2.3 From 04fb00bcd5bf415137e3b5ee7c4f92eaf235cb5c Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 18 Mar 2023 23:29:06 +0200 Subject: Add rust --- lua/plugins/dap.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 9b96528..1f9a8f1 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -39,6 +39,7 @@ dap.configurations.cpp = { } dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp dap.adapters.python = { type = 'executable'; -- cgit v1.2.3 From d861abc849918a83581955d3046ca2c3b3591d83 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 18 Mar 2023 23:57:59 +0200 Subject: Fixed dap errors --- lua/plugins/dap.lua | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 1f9a8f1..d858760 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -1,5 +1,5 @@ local dap = require('dap') -local home_path = vim.fn.expand('$HOME') +--local home_path = vim.fn.expand('$HOME') -- Unsafe Defaults local mi_mode = "" @@ -17,10 +17,21 @@ else error("Unsupported OS") end +--dap.adapters.cppdbg = { +-- type = "server", +-- port = "${port}", +-- executable = { +-- command = vim.fn.stdpath("data") .. '/mason/bin/dlv', +-- args = { "dap", "-l", "127.0.0.1:${port}" }, +-- }, +-- --command = home_path .. '/extension/debugAdapters/bin/OpenDebugAD7', +--} + +-- cpp dap.adapters.cppdbg = { - id = 'cppdbg', - type = 'executable', - command = home_path .. '/extension/debugAdapters/bin/OpenDebugAD7', + type = 'executable', + command = 'OpenDebugAD7', + id = 'cppdbg', } dap.configurations.cpp = { @@ -32,9 +43,9 @@ dap.configurations.cpp = { return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end, cwd = '${workspaceFolder}', - stopAtEntry = true, - MIMode = mi_mode, - miDebuggerPath = mi_debugger_path + --stopAtEntry = true, + --MIMode = mi_mode, + --miDebuggerPath = mi_debugger_path } } -- cgit v1.2.3 From 664cd6ba0204f67d603b38e477d19dbe9974b199 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 18 Mar 2023 23:58:55 +0200 Subject: Add javascript config --- lua/plugins/dap.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index d858760..9b3f0a9 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -52,6 +52,26 @@ dap.configurations.cpp = { dap.configurations.c = dap.configurations.cpp dap.configurations.rust = dap.configurations.cpp +-- javascript +dap.adapters.node2 = { + type = 'executable', + command = 'node-debug2-adapter', + args = {}, +} + +dap.configurations.javascript = { + { + name = 'Launch', + type = 'node2', + request = 'attach', + program = '${file}', + cwd = vim.fn.getcwd(), + sourceMaps = true, + protocol = 'inspector', + console = 'integratedTerminal', + }, +} + dap.adapters.python = { type = 'executable'; command = vim.trim(vim.fn.system('which python')); -- cgit v1.2.3 From 046b50e57de48222dae3109ca487a9ca39c4f6ee Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 21 Mar 2023 23:55:21 +0200 Subject: Update on rust config --- lua/plugins/dap.lua | 306 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 266 insertions(+), 40 deletions(-) diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index 9b3f0a9..dfe8030 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -2,53 +2,72 @@ local dap = require('dap') --local home_path = vim.fn.expand('$HOME') -- Unsafe Defaults -local mi_mode = "" -local mi_debugger_path = "" - --- Unix -if vim.loop.os_uname().sysname == 'Linux' then - mi_mode = "gdb" - mi_debugger_path = vim.trim(vim.fn.system('which gdb')) --- MacOS -elseif vim.loop.os_uname().sysname == 'Darwin' then - mi_mode = "lldb" - mi_debugger_path = vim.trim(vim.fn.system('which lldb-mi')) -else - error("Unsupported OS") -end - ---dap.adapters.cppdbg = { --- type = "server", --- port = "${port}", --- executable = { --- command = vim.fn.stdpath("data") .. '/mason/bin/dlv', --- args = { "dap", "-l", "127.0.0.1:${port}" }, --- }, --- --command = home_path .. '/extension/debugAdapters/bin/OpenDebugAD7', ---} +--local mi_mode = "" +--local mi_debugger_path = "" +-- +---- Unix +--if vim.loop.os_uname().sysname == 'Linux' then +-- mi_mode = "gdb" +-- mi_debugger_path = vim.trim(vim.fn.system('which gdb')) +---- MacOS +--elseif vim.loop.os_uname().sysname == 'Darwin' then +-- mi_mode = "lldb" +-- mi_debugger_path = vim.trim(vim.fn.system('which lldb-mi')) +--else +-- error("Unsupported OS") +--end --- cpp -dap.adapters.cppdbg = { +--local mason_registry = require("mason-registry") +--local codelldb_root = mason_registry.get_package("codelldb"):get_install_path() .. "/extension/" + +dap.adapters.lldb = { type = 'executable', - command = 'OpenDebugAD7', - id = 'cppdbg', + --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, + name = 'lldb' } +-- cpp + dap.configurations.cpp = { - { - name = "Launch file", - type = "cppdbg", - request = "launch", - program = function() - return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - end, - cwd = '${workspaceFolder}', - --stopAtEntry = true, - --MIMode = mi_mode, - --miDebuggerPath = mi_debugger_path - } + { + 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 = {}, + }, } + +--dap.configurations.cpp = { +-- { +-- name = "Launch file", +-- type = "cppdbg", +-- request = "launch", +-- program = function() +-- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') +-- end, +-- cwd = '${workspaceFolder}', +-- --stopAtEntry = true, +-- --MIMode = mi_mode, +-- --miDebuggerPath = mi_debugger_path +-- } +--} + +-- 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 @@ -90,3 +109,210 @@ dap.configurations.python = { }, } +local dapui = require('dapui') + + -- setup statusline + + -- setup repl + dap.repl.commands = vim.tbl_extend('force', dap.repl.commands, { + exit = { 'q', 'exit' }, + custom_commands = { + ['.run_to_cursor'] = dap.run_to_cursor, + ['.restart'] = dap.run_last + } + }) + + -- vim.api.nvim_create_augroup('DAPConfig', { clear = true }) + -- vim.api.nvim_create_autocmd('FileType', { + -- group = 'DAPConfig', + -- pattern = 'dap-repl', + -- callback = require('dap.ext.autocompl').attach + -- }) + + -- setup dapui + dapui.setup({ + mappings = { + expand = "", + open = "o", + remove = "D", + edit = "e", + repl = "r", + toggle = "t", + }, + layouts = { + { elements = { "scopes", "breakpoints", "stacks" }, size = 0.33, position = "right" }, + { elements = { "repl", "watches" }, size = 0.27, position = "bottom" }, + }, + icons = { expanded = "-", collapsed = "$" }, + controls = { enabled = false }, + floating = { border = "rounded", mappings = { close = { "q", "", "" } } }, + }) + + -- signs + vim.fn.sign_define("DapStopped", { text = '=>', texthl = 'DiagnosticWarn', numhl = 'DiagnosticWarn' }) + vim.fn.sign_define("DapBreakpoint", { text = '<>', texthl = 'DiagnosticInfo', numhl = 'DiagnosticInfo' }) + vim.fn.sign_define("DapBreakpointRejected", { text = '!>', texthl = 'DiagnosticError', numhl = 'DiagnosticError' }) + vim.fn.sign_define("DapBreakpointCondition", { text = '?>', texthl = 'DiagnosticInfo', numhl = 'DiagnosticInfo' }) + vim.fn.sign_define("DapLogPoint", { text = '.>', texthl = 'DiagnosticInfo', numhl = 'DiagnosticInfo' }) + + -- options + dap.defaults.fallback.focus_terminal = false + dap.defaults.fallback.terminal_win_cmd = '10split new' + + -- virtual text setup + --require('nvim-dap-virtual-text').setup({}) + + + +--local debugging = {} +-- +--function debugging.setup() +-- local dap = require("dap") +-- +-- local sign = vim.fn.sign_define +-- +-- -- These are to override the default highlight groups for catppuccin (see https://github.com/catppuccin/nvim/#special-integrations) +-- sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" }) +-- sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = "" }) +-- sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = "" }) +-- +-- local mason_registry = require("mason-registry") +-- local cpp_dap_executable = mason_registry.get_package("cpptools"):get_install_path() +-- .. "/extension/debugAdapters/bin/OpenDebugAD7" +-- +-- dap.adapters.cpp = { +-- id = "cppdbg", +-- type = "executable", +-- command = cpp_dap_executable, +-- } +-- +-- local codelldb_root = mason_registry.get_package("codelldb"):get_install_path() .. "/extension/" +-- local codelldb_path = codelldb_root .. "adapter/codelldb" +-- local liblldb_path = codelldb_root .. "lldb/lib/liblldb.so" +-- +-- dap.adapters.rust = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path) +-- +-- -- To use the venv for debugpy that is installed with mason, obtain the path and pass it to `setup` as shown below. +-- -- I don't think this is the best idea right now, because it requires that the user installs the packages into a venv that they didn't create and may not know of. +-- +-- -- local debugpy_root = mason_registry.get_package("debugpy"):get_install_path() +-- require("dap-python").setup(--[[ debugpy_root.. "/venv/bin/python" --]]) +-- require('dap-python').test_runner = 'pytest' +-- +-- dap.configurations.lua = { +-- { +-- type = "nlua", +-- request = "attach", +-- name = "Attach to running Neovim instance", +-- }, +-- } +-- +-- dap.adapters.nlua = function(callback, config) +-- callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 }) +-- end +-- +-- require("nvim-dap-virtual-text").setup({ +-- enabled = true, +-- enabled_commands = true, +-- highlight_changed_variables = true, +-- highlight_new_as_changed = true, +-- show_stop_reason = true, +-- commented = true, +-- only_first_definition = true, +-- all_references = true, +-- display_callback = function(variable, _buf, _stackframe, _node) +-- return " " .. variable.name .. " = " .. variable.value .. " " +-- end, +-- -- 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) , +-- }) +-- +-- local dapui = require("dapui") +-- dapui.setup({ +-- icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" }, +-- mappings = { +-- -- Use a table to apply multiple mappings +-- expand = { "", "<2-LeftMouse>" }, +-- open = "o", +-- remove = "d", +-- edit = "e", +-- repl = "r", +-- toggle = "t", +-- }, +-- -- Expand lines larger than the window +-- -- Requires >= 0.7 +-- expand_lines = vim.fn.has("nvim-0.7") == 1, +-- -- Layouts define sections of the screen to place windows. +-- -- The position can be "left", "right", "top" or "bottom". +-- -- The size specifies the height/width depending on position. It can be an Int +-- -- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while +-- -- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns) +-- -- Elements are the elements shown in the layout (in order). +-- -- Layouts are opened in order so that earlier layouts take priority in window sizing. +-- layouts = { +-- { +-- elements = { +-- -- Elements can be strings or table with id and size keys. +-- "breakpoints", +-- "stacks", +-- "watches", +-- { id = "scopes", size = 0.25 }, +-- }, +-- size = 40, -- 40 columns +-- position = "left", +-- }, +-- { +-- elements = { +-- "repl", +-- "console", +-- }, +-- size = 0.25, -- 25% of total lines +-- position = "bottom", +-- }, +-- }, +-- controls = { +-- -- Requires Neovim nightly (or 0.8 when released) +-- enabled = true, +-- -- Display controls in this element +-- element = "repl", +-- icons = { +-- pause = "", +-- play = "", +-- step_into = "", +-- step_over = "", +-- step_out = "", +-- step_back = "", +-- run_last = "↻", +-- terminate = "□", +-- }, +-- }, +-- 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", "" }, +-- }, +-- }, +-- windows = { indent = 1 }, +-- render = { +-- max_type_length = nil, -- Can be integer or nil. +-- max_value_lines = 100, -- Can be integer or nil. +-- }, +-- }) +-- +-- dap.listeners.after.event_initialized["dapui_config"] = function() +-- dapui.open() +-- end +-- -- dap.listeners.before.event_terminated["dapui_config"] = function() +-- -- dapui.close() +-- -- end +-- -- dap.listeners.before.event_exited["dapui_config"] = function() +-- -- dapui.close() +-- -- end +--end +-- +--return debugging -- cgit v1.2.3 From 757c46498b0a957d43168e0dde6ad9055df6ee00 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 21 Mar 2023 23:55:36 +0200 Subject: New mapping for dashboard --- lua/user/keys.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index e007260..d00717b 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -383,7 +383,7 @@ map("n", "de", function() end) -- Dashboard -map("n", "db", "Dashboard") +map("n", "", "Dashboard") -- map("", "l", require("lsp_lines").toggle, { desc = "Toggle lsp_lines" }) -- cgit v1.2.3 From a6dbd983a6dbf796c55af6dd506bfa49849f637b Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 21 Mar 2023 23:55:51 +0200 Subject: Install mason-nvim-dap --- lua/user/pack.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 249796b..8cd06b9 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -77,6 +77,15 @@ return packer.startup(function(use) use("mfussenegger/nvim-dap") -- Debug Adapter Protocol client implementation for Neovim use("rcarriga/nvim-dap-ui") -- UI for nvim-dap 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, + }) -- Linters/Formatters use("jay-babu/mason-null-ls.nvim") -- cgit v1.2.3 From d3133788ed35563ace10f788d81d747f4d946438 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 21 Mar 2023 23:56:13 +0200 Subject: Include rust-tools --- lua/plugins/lsp.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 855818f..1818640 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -296,6 +296,39 @@ require("lspconfig").rust_analyzer.setup{ } end +local opts = { + tools = { + runnables = { + use_telescope = true, + }, + inlay_hints = { + auto = true, + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "", + }, + }, + + -- all the opts to send to nvim-lspconfig + -- these override the defaults set by rust-tools.nvim + -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer + server = { + -- on_attach is a callback called when the language server attachs to the buffer + on_attach = on_attach, + settings = { + -- to enable rust-analyzer settings visit: + -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc + ["rust-analyzer"] = { + -- enable clippy on save + checkOnSave = { + command = "clippy", + }, + }, + }, + }, +} +require('rust-tools').setup(opts) + vim.diagnostic.config({ underline = false, signs = true, -- cgit v1.2.3 From b264270d98ba43e114788b7017c6fba22d60ca16 Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 22 Mar 2023 23:52:28 +0200 Subject: Changed search_dirs for find_projects() to "~/projects" --- lua/plugins/telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 605cdc3..1299b2f 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -319,7 +319,7 @@ function M.find_projects() prompt_title = " Find Projects", path_display = { "smart" }, search_dirs = { - "~/src", + "~/projects", }, layout_strategy = "horizontal", layout_config = { preview_width = 0.65, width = 0.75 }, -- cgit v1.2.3 From c31333d41c59adb8710f679adc7bf739dadbf4ec Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 23 Mar 2023 22:27:06 +0200 Subject: Changed order of plugins and removed dap and dashboard, reason nvim freezes, TODO: fix --- init.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 85fde42..28b7dd6 100644 --- a/init.lua +++ b/init.lua @@ -55,12 +55,12 @@ local modules = { "user.mods", -- Modules/functions --"user.deps", -- Plugins --"user.scripts", + "plugins.colorscheme", "plugins.treesitter", "plugins.telescope", "plugins.nvim-tree", "plugins.quickfix", "plugins.cmp", - "plugins.dap", "plugins.luasnip", "plugins.colorizer", "plugins.prettier", @@ -73,15 +73,14 @@ local modules = { "plugins.autopairs", "plugins.web-devicons", "plugins.navic", + "plugins.heirline", "plugins.zen-mode", - "plugins.colorscheme", - "plugins.dashboard", "plugins.fidget", - "plugins.heirline", "plugins.toggleterm", "plugins.trouble", - --"plugins.modify-blend", + --"plugins.dashboard", --"plugins.dap", + --"plugins.modify-blend", --"plugins.floatterm", } -- cgit v1.2.3 From 561601eb215aee76daeb340f8924de9990a0e813 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 23 Mar 2023 22:27:52 +0200 Subject: A few ensure servers installed added --- lua/plugins/lsp.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 1818640..ca91c2f 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -14,6 +14,13 @@ require("mason-lspconfig").setup({ "lua_ls", "pylsp", "pyright", + "jedi_language_server", + "rust_analyzer", + "bashls", + --"bash-language-server", + "vimls" + --"vim-language-server", + }, ui = { icons = { @@ -33,6 +40,7 @@ require("mason-lspconfig").setup({ }, }, max_concurrent_installers = 10, + automatic_installation = true, }) -- Use an on_attach function to only map the following keys after the language server attaches to the current buffer -- cgit v1.2.3 From a6b3c7ea0990ce13dc4c385e393e8eb672b68f50 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 23 Mar 2023 22:28:23 +0200 Subject: Trying to troubleshoot dashboard causing a freeze whenever I open nvim --- lua/plugins/dashboard.lua | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua index c6c610d..b288f46 100644 --- a/lua/plugins/dashboard.lua +++ b/lua/plugins/dashboard.lua @@ -73,10 +73,3 @@ db.setup({ -- footer = {} --your footer }) ---vim.cmd([[ --- autocmd FileType dashboard :highlight DashboardHeader guifg='#b2b2b2' --- autocmd FileType dashboard :highlight DashboardCenter guifg='#5f8700' --- autocmd FileType dashboard :highlight DashboardCenterIcon guifg='#0087af' --- autocmd FileType dashboard :highlight DashboardShortCut guifg='#ffd7ff' --- autocmd FileType dashboard :highlight DashboardFooter guifg='#878787' ---]]) -- cgit v1.2.3 From 592e50d56ab7aa022b1b4a78fc9907f3f612ef1e Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 23 Mar 2023 22:28:55 +0200 Subject: Trying to troubleshoot dashboard causing nvim to freeze --- lua/user/pack.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 8cd06b9..7208dc4 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -205,11 +205,11 @@ return packer.startup(function(use) -- require'alpha'.setup(require'alpha.themes.startify'.config) -- end --}) - use({ - 'glepnir/dashboard-nvim', - event = 'VimEnter', - requires = {'nvim-tree/nvim-web-devicons'} - }) + --use({ + -- 'glepnir/dashboard-nvim', + -- event = 'VimEnter', + -- requires = {'nvim-tree/nvim-web-devicons'} + --}) use("rcarriga/nvim-notify") -- Notification plugin use("karb94/neoscroll.nvim") -- Faster/smooth scrolling use("MunifTanjim/prettier.nvim") -- Prettier plugin for Neovim's built-in LSP client -- cgit v1.2.3 From 8c36cd95d4aa08e992b69a4cac8682632b61abf1 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 23 Mar 2023 22:37:45 +0200 Subject: Info on install neovim nightly --- init.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 28b7dd6..f431e37 100644 --- a/init.lua +++ b/init.lua @@ -26,11 +26,24 @@ -- -------------------------------------------------------------------------- -- +-- ================================== -- +-- == Install neovim-nightly == -- +-- ================================== -- + +-- Download nvim-linux64.tar.gz: +--$ curl -L -o nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz +-- Extract: +--$ tar xzvf nvim-linux64.tar.gz +-- Run: +--$ ./nvim-linux64/bin/nvim + +-- ---------------------------------- -- + -- Initialize config with this one liner in the terminal ---nvim --headless -c 'call mkdir(stdpath("config"), "p") | exe "edit" stdpath("config") . "/init.lua" | write | quit' +--$ nvim --headless -c 'call mkdir(stdpath("config"), "p") | exe "edit" stdpath("config") . "/init.lua" | write | quit' -- Command to see startup time ---nvim --startuptime startup.log -c exit && tail -100 startup.log +--$ nvim --startuptime startup.log -c exit && tail -100 startup.log -- Load impatient (Faster loading times) local impatient_ok, impatient = pcall(require, "impatient") -- cgit v1.2.3 From 2cc49af148642e6f201ac78afbc7d0eaecdd749f Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 28 Mar 2023 12:10:12 +0200 Subject: Add dashboard back after cleaning nvim cache and solved freezing error --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index f431e37..6bee2e3 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ local modules = { "plugins.fidget", "plugins.toggleterm", "plugins.trouble", - --"plugins.dashboard", + "plugins.dashboard", --"plugins.dap", --"plugins.modify-blend", --"plugins.floatterm", -- cgit v1.2.3 From bebd2f560e54527263e5377485156fe34c2f2e21 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 28 Mar 2023 12:10:43 +0200 Subject: Add dashboard back after cleaning cache/freezing error --- lua/user/pack.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/user/pack.lua b/lua/user/pack.lua index 7208dc4..50ed41e 100644 --- a/lua/user/pack.lua +++ b/lua/user/pack.lua @@ -205,11 +205,11 @@ return packer.startup(function(use) -- require'alpha'.setup(require'alpha.themes.startify'.config) -- end --}) - --use({ - -- 'glepnir/dashboard-nvim', - -- event = 'VimEnter', - -- requires = {'nvim-tree/nvim-web-devicons'} - --}) + use({ + 'glepnir/dashboard-nvim', + event = 'VimEnter', + requires = {'nvim-tree/nvim-web-devicons'} + }) use("rcarriga/nvim-notify") -- Notification plugin use("karb94/neoscroll.nvim") -- Faster/smooth scrolling use("MunifTanjim/prettier.nvim") -- Prettier plugin for Neovim's built-in LSP client -- cgit v1.2.3 From 604922fcc810906cd1a1c7592eb0951bb73782d2 Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 30 Mar 2023 23:57:52 +0200 Subject: Add desc for lsp_lines toggle mapping --- lua/user/keys.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/user/keys.lua b/lua/user/keys.lua index d00717b..4b6e9ef 100644 --- a/lua/user/keys.lua +++ b/lua/user/keys.lua @@ -385,6 +385,6 @@ end) -- Dashboard map("n", "", "Dashboard") --- +-- Lsp Lines toggle map("", "l", require("lsp_lines").toggle, { desc = "Toggle lsp_lines" }) -- cgit v1.2.3 From 96b6dfaaa07b1bd5c8197ebcabe788e9b11bcc2f Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 2 Apr 2023 23:54:03 +0200 Subject: Experimenting with web dev formatting --- lua/plugins/null-ls.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua index 8e7ddd7..2f4e898 100644 --- a/lua/plugins/null-ls.lua +++ b/lua/plugins/null-ls.lua @@ -24,12 +24,15 @@ local sources = { builtins.formatting.clang_format, builtins.formatting.rustfmt, builtins.formatting.sql_formatter, - builtins.formatting.prettierd.with { + --builtins.formatting.prettierd.with { + -- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "json", "yaml", "markdown", "html", "css", "scss", "less", "graphql", "vue", "svelte" }, + -- condition = function(utils) + -- return utils.root_has_file ".prettierrc" or utils.root_has_file ".prettierrc.js" or utils.root_has_file ".prettierrc.json" or utils.root_has_file "prettier.config.js" or utils.root_has_file "prettier.config.cjs" + -- end, + --}, + builtins.formatting.prettier.with({ -- markdown, html/js formatting filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "json", "yaml", "markdown", "html", "css", "scss", "less", "graphql", "vue", "svelte" }, - condition = function(utils) - return utils.root_has_file ".prettierrc" or utils.root_has_file ".prettierrc.js" or utils.root_has_file ".prettierrc.json" or utils.root_has_file "prettier.config.js" or utils.root_has_file "prettier.config.cjs" - end, - }, + }), builtins.diagnostics.dotenv_linter, builtins.diagnostics.shellcheck.with({ -- shell script diagnostics @@ -128,9 +131,6 @@ return M -- -- so you should prefer caching results if possible -- }), ---- require("null-ls").builtins.formatting.stylua, -- lua formatting ----- require("null-ls").builtins.formatting.prettier.with({ -- markdown, html/js formatting ----- filetypes = { "html", "css", "javascript", "javascriptreact", "markdown", "json", "yaml" }, ----- }), ---- require("null-ls").builtins.formatting.black, ---- require("null-ls").builtins.formatting.prettierd, ---- require("null-ls").builtins.diagnostics.cspell.with { -- cgit v1.2.3 From a5bd4983f244eade6ff30ede94245406d1fab62c Mon Sep 17 00:00:00 2001 From: srdusr Date: Sun, 2 Apr 2023 23:54:19 +0200 Subject: Trying to format on save --- lua/user/mods.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lua/user/mods.lua b/lua/user/mods.lua index 0be0783..8a1f3f3 100644 --- a/lua/user/mods.lua +++ b/lua/user/mods.lua @@ -25,6 +25,29 @@ M.has = function(feat) end +-------------------------------------------------- + + +-- Format on save +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) +require("null-ls").setup({ + -- you can reuse a shared lspconfig on_attach callback here + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + -- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead + vim.lsp.buf.formatting_seq_sync() + end, + }) + end + end, +}) + + -------------------------------------------------- ---Determine if a value of any type is empty -- cgit v1.2.3