aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2023-03-14 16:00:04 +0200
committersrdusr <trevorgray@srdusr.com>2023-03-14 16:00:04 +0200
commit2b7afee4ce1754e521dd3f650fca357aff6bb09c (patch)
treeb01624c64a16348e4ea3972c90e5e6181a86a649 /.config
parent28e504b49ac6680939a8f53f1945805f50e95cac (diff)
parent7bf0bc4fab41f035c544e5e8c705804bdbf51094 (diff)
downloaddotfiles-2b7afee4ce1754e521dd3f650fca357aff6bb09c.tar.gz
dotfiles-2b7afee4ce1754e521dd3f650fca357aff6bb09c.zip
Merge commit '92804480aafc8da1b232dbfea7b3fc5ab760c869'
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/autoload/utils.vim16
-rw-r--r--.config/nvim/init.lua3
-rw-r--r--.config/nvim/lua/plugins/dap.lua249
-rw-r--r--.config/nvim/lua/plugins/telescope.lua14
-rw-r--r--.config/nvim/lua/user/keys.lua44
-rw-r--r--.config/nvim/lua/user/pack.lua2
6 files changed, 324 insertions, 4 deletions
diff --git a/.config/nvim/autoload/utils.vim b/.config/nvim/autoload/utils.vim
index 1f10423..b4356ba 100644
--- a/.config/nvim/autoload/utils.vim
+++ b/.config/nvim/autoload/utils.vim
@@ -100,3 +100,19 @@ endfunction
"-------------------------------------------------
+
+" Toggle Diff
+let g:diff_is_open = 0
+
+function! utils#ToggleDiff()
+ if g:diff_is_open
+ windo diffoff
+ let g:diff_is_open = 0
+ else
+ windo diffthis
+ let g:diff_is_open = 1
+ endif
+endfunction
+
+
+"-------------------------------------------------
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index ec29d65..85fde42 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -60,10 +60,11 @@ local modules = {
"plugins.nvim-tree",
"plugins.quickfix",
"plugins.cmp",
+ "plugins.dap",
"plugins.luasnip",
"plugins.colorizer",
"plugins.prettier",
- "plugins.git",
+ --"plugins.git",
"plugins.gitsigns",
"plugins.neoscroll",
"plugins.null-ls",
diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua
new file mode 100644
index 0000000..2fb4333
--- /dev/null
+++ b/.config/nvim/lua/plugins/dap.lua
@@ -0,0 +1,249 @@
+--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!")
+ return
+end
+
+require('dap').set_log_level('INFO') -- Helps when configuring DAP, see logs with :DapShowLog
+
+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.adapters.go = {
+ type = "server",
+ port = "${port}",
+ executable = {
+ command = vim.fn.stdpath("data") .. '/mason/bin/dlv',
+ args = { "dap", "-l", "127.0.0.1:${port}" },
+ },
+}
+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"
+ },
+ {
+ elements = {
+ "repl",
+ "breakpoints"
+ },
+ size = 0.3,
+ position = "bottom",
+ },
+ },
+ floating = {
+ max_height = nil,
+ max_width = nil,
+ border = "single",
+ mappings = {
+ close = { "q", "<Esc>" },
+ },
+ },
+ windows = { indent = 1 },
+ render = {
+ max_type_length = nil,
+ },
+})
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
index 95a5dd6..605cdc3 100644
--- a/.config/nvim/lua/plugins/telescope.lua
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -312,6 +312,20 @@ function M.find_scripts()
}
end
+function M.find_projects()
+ require("telescope.builtin").find_files {
+ hidden = true,
+ no_ignore = true,
+ prompt_title = " Find Projects",
+ path_display = { "smart" },
+ search_dirs = {
+ "~/src",
+ },
+ layout_strategy = "horizontal",
+ layout_config = { preview_width = 0.65, width = 0.75 },
+ }
+end
+
function M.grep_notes()
local opts = {}
opts.hidden = false
diff --git a/.config/nvim/lua/user/keys.lua b/.config/nvim/lua/user/keys.lua
index 689ff13..fe9e3af 100644
--- a/.config/nvim/lua/user/keys.lua
+++ b/.config/nvim/lua/user/keys.lua
@@ -287,9 +287,10 @@ map("n", "<leader>fk", "<cmd>lua require('telescope.builtin').keymaps()<cr>")
map("n", "<leader>fn", [[<Cmd>lua require'plugins.telescope'.find_notes()<CR>]]) -- find notes
map("n", "<leader>fgn", [[<Cmd>lua require'plugins.telescope'.grep_notes()<CR>]]) -- search notes
map("n", "<leader>f.", [[<Cmd>lua require'plugins.telescope'.find_configs()<CR>]]) -- find configs
-map("n", "<leader>fs", [[<Cmd>lua require'plugins.telescope'.find_scripts()<CR>]]) -- find notes
+map("n", "<leader>fs", [[<Cmd>lua require'plugins.telescope'.find_scripts()<CR>]]) -- find scripts
+map("n", "<leader>fw", [[<Cmd>lua require'plugins.telescope'.find_projects()<CR>]]) -- find projects
map("n", "<leader>fm", "<cmd>lua require('telescope').extensions.media_files.media_files({})<cr>") -- find media files
-map("n", "<leader>fi", "<cmd>lua require('telescope').extensions.notify.notify({})<cr>") -- find media files
+map("n", "<leader>fi", "<cmd>lua require('telescope').extensions.notify.notify({})<cr>") -- find notifications
-- FZF
map("n", "<leader>fz", "<cmd>lua require('fzf-lua').files()<CR>")
@@ -331,6 +332,45 @@ map("n", "<leader>q", function()
end
end, { desc = "Toggle quickfix window" })
+-- Dap (debugging)
+local dap_ok, dap = pcall(require, "dap")
+local dap_ui_ok, ui = pcall(require, "dapui")
+
+if not (dap_ok and dap_ui_ok) then
+ require("notify")("nvim-dap or dap-ui not installed!", "warning")
+ return
+end
+
+vim.fn.sign_define('DapBreakpoint', { text = '🐞' })
+
+-- Start debugging session
+map("n", "<leader>ds", function()
+ dap.continue()
+ ui.toggle({})
+ vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-w>=", false, true, true), "n", false) -- Spaces buffers evenly
+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>db", dap.toggle_breakpoint)
+map("n", "<leader>dn", dap.step_over)
+map("n", "<leader>di", dap.step_into)
+map("n", "<leader>do", dap.step_out)
+map("n", "<leader>dC", function()
+ dap.clear_breakpoints()
+ require("notify")("Breakpoints cleared", "warn")
+end)
+
+-- 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)
+
-- Dashboard
map("n", "<leader>db", "<CMD>Dashboard<CR>")
diff --git a/.config/nvim/lua/user/pack.lua b/.config/nvim/lua/user/pack.lua
index 0bcb006..249796b 100644
--- a/.config/nvim/lua/user/pack.lua
+++ b/.config/nvim/lua/user/pack.lua
@@ -111,7 +111,7 @@ return packer.startup(function(use)
-- Git
use("tpope/vim-fugitive") --
- use("dinhhuy258/git.nvim") -- For git blame & browse
+ --use("dinhhuy258/git.nvim") -- For git blame & browse
use("kdheepak/lazygit.nvim") -- Terminal UI for git commands
use("lewis6991/gitsigns.nvim") -- Git decorations