tmux; dap; dapui; debugging

This commit is contained in:
aliaksandrkotau 2023-12-23 12:43:15 +01:00
parent 985b6f94aa
commit f89dbf8e7f
7 changed files with 198 additions and 8 deletions

31
dummy_src/learn_nvim.txt Normal file
View File

@ -0,0 +1,31 @@
# Vim Motions Practice
hjkl: Move left, down, up, right. Try it now!
w: Move to next word. Move to "word" in this line.
b: Move to previous word. Move to "Move" in this line.
e: Move to end of word. Move to "line" in this line.
0: Move to beginning of line. Do it now!
$: Move to end of line. Do it now!
G: Move to end of file. Do it now!
gg: Move to beginning of file. Do it now!
f{char}: Move to next occurrence of {char}. Move to "c" in this line.
F{char}: Move to previous occurrence of {char}. Move to "M" in this line.
t{char}: Move to before next occurrence of {char}. Move to before "c" in this line.
T{char}: Move to after previous occurrence of {char}. Move to after "M" in this line.
;: Repeat last f, F, t, or T motion. Do it now!
,: Repeat last f, F, t, or T motion in opposite direction. Do it now!
H: Move to top of screen. Do it now!
M: Move to middle of screen. Do it now!
L: Move to bottom of screen. Do it now!
z{char}: Scroll the screen and position the current line. zt: top, zz: middle, zb: bottom. Try them now!
{num}G: Move to line {num}. Move to line 10 now!
:{num}: Move to line {num}. Move to line 20 now!
%: Move to matching parenthesis, bracket, or brace. Move to the opening brace in this line {
^: Move to first non-blank character of the line. Move to the first letter in this line.
g_: Move to last non-blank character of the line. Move to the last letter in this line.
/ {pattern}: Search forward for {pattern}. Search for "line" in this file.
? {pattern}: Search backward for {pattern}. Search for "word" in this file.
n: Repeat last search in same direction. Do it now!
N: Repeat last search in opposite direction. Do it now!
* : Search forward for the word under the cursor. Move to "screen" and search for it.
# : Search backward for the word under the cursor. Move to "file" and search for it.

19
dummy_src/p.py Normal file
View File

@ -0,0 +1,19 @@
import logging
def f(x: int) -> str:
a = 100
logging.debug(a)
b = [200] * 10
logging.info(a, b)
c = {x: x*x for x in b}
logging.warning(c)
d = f'Values {x=} {a=} {b=} {c=}'
logging.error(d)
logging.exception('FATAL!!!!!!!###!@#')
return d
if __name__ == '__main__':
logging.debug('start')
print(f(100500))
logging.debug('end')

View File

@ -163,8 +163,7 @@ require('lazy').setup({
},
{
-- Choices:
----'navarasu/onedark.nvim',
-- Neovim Color Theme
_G.THEME_REPO,
priority = 1000,
config = function()
@ -173,6 +172,7 @@ require('lazy').setup({
},
{
-- TODO: move to plugins
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
@ -266,7 +266,7 @@ require('lazy').setup({
-- NOTE: You can change these options as you wish!
-- Set highlight on search
vim.o.hlsearch = true
vim.o.hlsearch = false
-- Make line numbers default
vim.wo.number = true
@ -278,7 +278,7 @@ vim.wo.list = true
vim.wo.listchars = "tab:»·,trail:·,extends:>,precedes:<,nbsp:."
vim.wo.colorcolumn = '120'
vim.wo.wrap = false
vim.opt.cmdheight = 3
vim.opt.cmdheight = 2
vim.opt.ignorecase = true
vim.opt.showtabline = 2
@ -304,8 +304,8 @@ vim.o.smartcase = true
vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
vim.o.timeoutlen = 200
vim.o.updatetime = 150
vim.o.timeoutlen = 100
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
@ -686,6 +686,19 @@ vim.cmd [[
-- \ [ 'In &Project', 'echo "undefined"' ],
-- \ ])
--]]
vim.cmd [[
call quickui#menu#install(
\ '&Debugger',
\ [
\ ['Start &Debug', ':lua require("dap").continue()'],
\ ['DAP UI: &Toggle', ':lua require("dapui").toggle()'],
\ ['--',''],
\ ['DAP UI: &Setup', ':lua require("dapui").setup()'],
\ ['DAP UI: &Open', ':lua require("dapui").open()'],
\ ['DAP UI: &Close', ':lua require("dapui").close()'],
\ ]
\ )
]]
vim.cmd [[
call quickui#menu#install('&Window', [
\ ['Open &Neotree', ':Neotree'],
@ -719,8 +732,33 @@ vim.cmd [[
\ ], 10000)
]]
vim.api.nvim_set_keymap('n', '<leader>m', ':call quickui#menu#open()<CR>', { noremap = true })
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
vim.keymap.set('n', '<Leader>b', function() require('dap').toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>B', function() require('dap').set_breakpoint() end)
vim.keymap.set('n', '<Leader>lp', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end)
vim.keymap.set('n', '<Leader>dr', function() require('dap').repl.open() end)
vim.keymap.set('n', '<Leader>dl', function() require('dap').run_last() end)
vim.keymap.set({'n', 'v'}, '<Leader>dh', function()
require('dap.ui.widgets').hover()
end)
vim.keymap.set({'n', 'v'}, '<Leader>dp', function()
require('dap.ui.widgets').preview()
end)
vim.keymap.set('n', '<Leader>df', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.frames)
end)
vim.keymap.set('n', '<Leader>ds', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.scopes)
end)
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@ -33,5 +33,6 @@
"vim-quickui": { "branch": "master", "commit": "4c6ff1250f5d0d62a8b2f373d2dcb667e1fdc5ee" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
}

View File

@ -0,0 +1,9 @@
return {
'mfussenegger/nvim-dap-python',
dependencies = {
'mfussenegger/nvim-dap',
},
config = function ()
require('dap-python').setup('~/.venvs_python/debugpy/bin/python')
end
}

View File

@ -0,0 +1,89 @@
return {
'rcarriga/nvim-dap-ui',
dependencies = {
'mfussenegger/nvim-dap',
},
config = function()
require("dapui").setup({
controls = {
element = "repl",
enabled = true,
icons = {
disconnect = "",
pause = "",
play = "",
run_last = "",
step_back = "",
step_into = "",
step_out = "",
step_over = "",
terminate = ""
}
},
element_mappings = {},
expand_lines = true,
floating = {
border = "single",
mappings = {
close = { "q", "<Esc>" }
}
},
force_buffers = true,
icons = {
collapsed = "",
current_frame = "",
expanded = ""
},
layouts = {
{
elements = {
{
id = "console",
size = 0.5
},
},
position = "bottom",
size = 10
},
{
elements = {
{
id = "repl",
size = 0.2
},
{
id = "scopes",
size = 0.2
},
{
id = "breakpoints",
size = 0.2
},
{
id = "stacks",
size = 0.2
},
{
id = "watches",
size = 0.2
},
},
position = "right",
size = 40
},
},
mappings = {
edit = "e",
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
repl = "r",
toggle = "t"
},
render = {
indent = 1,
max_value_lines = 100
}
})
end
}

View File

@ -0,0 +1,3 @@
return {
'christoomey/vim-tmux-navigator'
}