summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2024-02-14 21:24:28 -0500
committerJacob McDonnell <jacob@jacobmcdonnell.com>2024-02-14 21:24:28 -0500
commit2fba5da98a48fe1d562b6c015dda4a6fb4baccfe (patch)
tree1c75a7775b009656cc2d5a10eb8636ae2029f835 /.config
parentbd2185c23d2f79de2ce478d2ab6a30af52748d25 (diff)
Integrated dap nvim with lldb
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/init.vim32
-rw-r--r--.config/nvim/lua/dap_lldb.lua52
2 files changed, 33 insertions, 51 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 3503890..7bb71b7 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -58,8 +58,6 @@ map <C-l> <C-w>l
call plug#begin('~/.local/share/nvim/plugged')
Plug 'junegunn/goyo.vim' " Nice for reading Documents
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Code Completion
-Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
-Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}
Plug 'tpope/vim-commentary' " Makes commenting multiple lines easier
Plug 'NLKNguyen/papercolor-theme'
Plug 'nvim-lua/plenary.nvim'
@@ -67,10 +65,12 @@ Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.x' }
Plug 'ThePrimeagen/harpoon', { 'branch': 'harpoon2' }
Plug 'neovim/nvim-lspconfig'
Plug 'mfussenegger/nvim-dap'
-Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
-Plug 'theHamsta/nvim-dap-virtual-text'
+Plug 'rcarriga/nvim-dap-ui'
call plug#end()
+"Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
+"Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}
+
let g:coc_global_extensions = [
\ 'coc-html',
\ 'coc-java',
@@ -87,6 +87,14 @@ lua vim.g.coq_settings = {auto_start = 'shut-up',}
lua require("dap_lldb")
+" nvim-dap keybinds
+map <leader>db :lua require("dap").toggle_breakpoint()<CR>
+map <leader>dc :lua require("dap").continue()<CR>
+map <leader>dso :lua require("dap").step_over()<CR>
+map <leader>ds :lua require("dap").step_into()<CR>
+map <leader>dr :lua require("dapui").open({ reset = true })<CR>
+map <leader>dt :lua require("dapui").toggle()<CR>
+
" Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set linebreak<CR>
@@ -107,20 +115,6 @@ autocmd BufWritePre *.go lua goimports(1000)
set t_Co=256
-" ChangeBackground changes the background mode based on macOS's `Appearance`
-" setting. We also refresh the statusline colors to reflect the new mode.
-function! ChangeBackground()
- if system("defaults read -g AppleInterfaceStyle") =~ '^Dark'
- set background=dark " for the dark version of the theme
- else
- set background=light " for the light version of the theme
- endif
-endfunction
-
-" initialize the colorscheme for the first run
-call ChangeBackground()
-
-map <leader>b :call ChangeBackground()<CR>
-map <leader>d :colorscheme default<CR>
+set background=light " for the light version of the theme
colorscheme PaperColor
diff --git a/.config/nvim/lua/dap_lldb.lua b/.config/nvim/lua/dap_lldb.lua
index 495fb72..40861d0 100644
--- a/.config/nvim/lua/dap_lldb.lua
+++ b/.config/nvim/lua/dap_lldb.lua
@@ -1,37 +1,25 @@
-local dap = require('dap')
+local dap = require'dap'
+
+require("dapui").setup()
+
dap.adapters.lldb = {
- type = 'executable',
- command = '/usr/bin/lldb-vscode', -- adjust as needed, must be absolute path
- name = 'lldb'
+ type = 'executable',
+ -- absolute path is important here, otherwise the argument in the `runInTerminal` request will default to $CWD/lldb-vscode
+ command = '/usr/bin/lldb-vscode',
+ name = "lldb"
}
-
-local dap = require('dap')
dap.configurations.c = {
- {
- name = 'Launch',
- type = 'lldb',
- request = 'launch',
- program = function()
- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
- end,
- cwd = '${workspaceFolder}',
- stopOnEntry = false,
- args = {},
-
- -- 💀
- -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
- --
- -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
- --
- -- Otherwise you might get the following error:
- --
- -- Error on launch: Failed to attach to the target process
- --
- -- But you should be aware of the implications:
- -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
- -- runInTerminal = false,
- },
+ {
+ name = "Launch",
+ type = "lldb",
+ request = "launch",
+ program = function()
+ return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
+ end,
+ cwd = '${workspaceFolder}',
+ stopOnEntry = false,
+ args = {},
+ runInTerminal = true,
+ },
}
-dap.configurations.cpp = dap.configurations.c
-require("nvim-dap-virtual-text").setup()