]> git.sthu.org Git - vimconf.git/commitdiff
plugins: Add vimspector
authorStefan Huber <shuber@sthu.org>
Sun, 26 Dec 2021 00:59:58 +0000 (01:59 +0100)
committerStefan Huber <shuber@sthu.org>
Sun, 26 Dec 2021 00:59:58 +0000 (01:59 +0100)
neosnippets/vimspector.json [new file with mode: 0644]
plugins-noroot-nolowendbox.vim

diff --git a/neosnippets/vimspector.json b/neosnippets/vimspector.json
new file mode 100644 (file)
index 0000000..5517eee
--- /dev/null
@@ -0,0 +1,48 @@
+{
+    "configurations": {
+        "Launch": {
+            "default": true,
+            "adapter": "vscode-cpptools",
+            "filetypes": [ "cpp", "c", "objc", "rust" ],
+            "configuration": {
+                "request": "launch",
+                "MIMode": "gdb",
+                "program": "${fileBasenameNoExtension}",
+                "args": [ ],
+                "environment": [ ],
+                "externalConsole": true
+            }
+        },
+        "Attach": {
+            "adapter": "vscode-cpptools",
+            "filetypes": [ "cpp", "c", "objc", "rust" ],
+            "configuration": {
+                "request": "attach",
+                "MIMode": "gdb",
+                "program": "${fileBasenameNoExtension}"
+            }
+        },
+        "Python: Attach To Vim": {
+            "adapter": "multi-session",
+            "filetypes": [ "python" ],
+            "variables": {
+                "port": "5678",
+                "host": "localhost"
+            },
+            "configuration": {
+                "request": "attach"
+            }
+        },
+        "Python: Run current script": {
+            "default": true,
+            "adapter": "debugpy",
+            "filetypes": [ "python" ],
+            "configuration": {
+                "request": "launch",
+                "program": "${file}",
+                "args": [ "*${args:--update-gadget-config}" ],
+                "justMyCode#json": "${justMyCode:true}"
+            }
+        }
+    }
+}
index 602724ec11f19477ea6c69579e2bf9ba02494d8a..f802c9ced50c71524fe22fae4560cdfeb52c711d 100644 (file)
@@ -13,6 +13,7 @@ endif
 Plug 'artur-shaik/vim-javacomplete2', {'for': 'java'}
 
 Plug 'neomake/neomake'
+Plug 'puremourning/vimspector'
 
 " Prevent slow foling update, e.g., for vimtex
 Plug 'Konfekt/FastFold'
@@ -240,4 +241,35 @@ EOF
     let g:vimtex_fold_enabled = 1
     let g:vimtex_fold_levelmarker = '➜'
 
+    au FileType c,cpp,obj,java,python packadd! vimspector
+    let g:vimspector_install_gadgets = [ 'debugpy', 'vscode-cpptools' ]
+    "let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
+
+    function VimspectorRestartOrCreateConfig()
+        if !filereadable('.vimspector.json')
+            execute 'tabe .vimspector.json'
+        else
+            call vimspector#Restart()
+        endif
+    endfunction
+
+    nmap <leader>dc  <Plug>VimspectorContinue
+    nmap <leader>ds  <Plug>VimspectorStop
+    nmap <leader>dr  :call VimspectorRestartOrCreateConfig()<CR>
+    nmap <leader>drr :call vimspector#Reset()<CR>
+    nmap <leader>dp  <Plug>VimspectorPause
+    nmap <leader>db  <Plug>VimspectorToggleBreakpoint
+    nmap <leader>dcb <Plug>VimspectorToggleConditionalBreakpoint
+    nmap <leader>dfb <Plug>VimspectorAddFunctionBreakpoint
+    nmap <leader>dtc <Plug>VimspectorRunToCursor
+    nmap <leader>do  <Plug>VimspectorStepOver
+    nmap <leader>di  <Plug>VimspectorStepInto
+    nmap <leader>dof <Plug>VimspectorStepOut
+    " for normal mode, the word under the cursor
+    nmap <Leader>de  <Plug>VimspectorBalloonEval
+    " for visual mode, the visually selected text
+    xmap <Leader>de  <Plug>VimspectorBalloonEval
+
+    au BufNewFile .vimspector.json read ~/.vim/neosnippets/vimspector.json
+
 endfunction