Nvim: add dap, tshjkl bindings, working gitlinker

This commit is contained in:
Robert Kmieć
2023-11-28 23:23:34 +01:00
parent dbc1095cb4
commit 0acc861edd
7 changed files with 92 additions and 34 deletions

View File

@@ -27,8 +27,6 @@ map('n', '<leader>2', '<cmd>set tabstop=2 softtabstop=2 shiftwidth=2<cr>', defau
map('n', '<leader>4', '<cmd>set tabstop=4 softtabstop=4 shiftwidth=4<cr>', default_options) map('n', '<leader>4', '<cmd>set tabstop=4 softtabstop=4 shiftwidth=4<cr>', default_options)
map('n', '<leader>8', '<cmd>set tabstop=8 softtabstop=8 shiftwidth=8<cr>', default_options) map('n', '<leader>8', '<cmd>set tabstop=8 softtabstop=8 shiftwidth=8<cr>', default_options)
map('n', '<leader><space>', '<cmd>nohlsearch<cr>', default_options)
-- digraphs -- digraphs
map('i', '<C-k>d', '<cmd>lua require("better-digraphs").digraphs("i")<cr>', default_options) map('i', '<C-k>d', '<cmd>lua require("better-digraphs").digraphs("i")<cr>', default_options)
@@ -101,11 +99,21 @@ map('n', '<C-w>|', "<cmd>WindowsMaximizeHorizontally<cr>", default_options)
map('n', '<C-w>=', "<cmd>WindowsEqualize<cr>", default_options) map('n', '<C-w>=', "<cmd>WindowsEqualize<cr>", default_options)
-- specs -- specs
vim.api.nvim_set_keymap('n', 'n', 'n:lua require("specs").show_specs()<CR>', default_options) map('n', 'n', 'n:lua require("specs").show_specs()<CR>', default_options)
vim.api.nvim_set_keymap('n', 'N', 'N:lua require("specs").show_specs()<CR>', default_options) map('n', 'N', 'N:lua require("specs").show_specs()<CR>', default_options)
vim.api.nvim_set_keymap('n', '<leader>v', ':lua require("specs").show_specs({width = 97, winhl = "Search", delay_ms = 610, inc_ms = 21})<CR>', { noremap = true, silent = true }) map('n', '<leader><space>', function()
vim.cmd.noh()
require("specs").show_specs({width = 97, winhl = "Search", delay_ms = 610, inc_ms = 21})
end, default_options)
vim.api.nvim_set_keymap('n', '<leader>cb', ':lua require("nvim-navbuddy").open()<cr>', default_options) vim.api.nvim_set_keymap('n', '<leader>cb', ':lua require("nvim-navbuddy").open()<cr>', default_options)
-- dap -- dap
map('v', 'K', '<cmd>lua require("dapui").eval()<cr>', default_options) map('v', 'K', '<cmd>lua require("dapui").eval()<cr>', default_options)
map('n', '<leader>dc', ':lua require("dap").continue()<cr>', default_options);
map('n', '<leader>db', ':lua require("dap").toggle_breakpoint()<cr>', default_options);
map('n', '<leader>dB', ':lua require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))<cr>', default_options);
map('n', '<leader>dn', ':lua require("dap").step_over()<cr>', default_options);
map('n', '<leader>di', ':lua require("dap").step_into()<cr>', default_options);
map('n', '<leader>do', ':lua require("dap").step_out()<cr>', default_options);
map('n', '<leader>dl', ':lua require("dap").run_last()<cr>', default_options);

View File

@@ -2,5 +2,5 @@ return {
'Saecki/crates.nvim', 'Saecki/crates.nvim',
dependencies = 'jose-elias-alvarez/null-ls.nvim', dependencies = 'jose-elias-alvarez/null-ls.nvim',
config = true, config = true,
filetype = { "rust", "toml" } ft = { "rust", "toml" }
} }

View File

@@ -1,4 +1,37 @@
return { return {
'theHamsta/nvim-dap-virtual-text', 'theHamsta/nvim-dap-virtual-text',
config = true, config = function()
require("nvim-dap-virtual-text").setup{
enabled = true, -- enable this plugin (the default)
enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
show_stop_reason = true, -- show stop reason when stopped for exceptions
commented = false, -- prefix virtual text with comment string
only_first_definition = true, -- only show virtual text at first definition (if there are multiple)
all_references = false, -- show virtual text on all all references of the variable (not only definitions)
clear_on_continue = false, -- clear virtual text on "continue" (might cause flickering when stepping)
--- A callback that determines how a variable is displayed or whether it should be omitted
--- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable
--- @param buf number
--- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
--- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`)
--- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text
--- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed
display_callback = function(variable, buf, stackframe, node, options)
if options.virt_text_pos == 'inline' then
return ' = ' .. variable.value
else
return variable.name .. ' = ' .. variable.value
end
end,
-- position of virtual text, see `:h nvim_buf_set_extmark()`, default tries to inline the virtual text. Use 'eol' to set to end of line
virt_text_pos = vim.fn.has 'nvim-0.10' == 1 and 'inline' or 'eol',
-- experimental features:
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) ,
}
end
} }

View File

@@ -3,27 +3,22 @@ return {
dependencies = { dependencies = {
'nvim-lua/plenary.nvim' 'nvim-lua/plenary.nvim'
}, },
opts = { config = function()
-- callbacks = { require('gitlinker').setup({
-- ["git.viessmann.com"] = function(url_data) router = {
-- local url = require'gitlinker.hosts'.get_base_https_url(url_data) browse = {
-- if not url_data.file or not url_data.rev then -- example: ssh://git@git.viessmann.com:7999/sysfunc/efmclib.git
-- return url ["^git%.viessmann%.com"] = "https://git.viessmann.com/projects/"
-- end .. "{_A.USER}/repos/"
-- url = url .. "/src/" .. url_data.rev .. "/" .. url_data.file .. "{_A.REPO}/browse/"
-- .. "{_A.FILE}"
-- if not url_data.lstart then .. "#{_A.LSTART}"
-- return url .. "{(_A.LEND > _A.LSTART and ('-' .. _A.LEND) or '')}",
-- end }
-- url = url .. "#lines-" .. url_data.lstart },
-- if url_data.lend then debug = true,
-- url = url .. ":" .. url_data.lend file_log = true,
-- end })
-- end,
-- return url cmd = "GitLink"
-- end
-- },
-- default mapping to call url generation with action_callback
mappings = "<leader>gl"
}
} }

View File

@@ -14,8 +14,8 @@ return {
null_ls.builtins.diagnostics.hadolint, null_ls.builtins.diagnostics.hadolint,
null_ls.builtins.diagnostics.buf, null_ls.builtins.diagnostics.buf,
null_ls.builtins.diagnostics.typos, null_ls.builtins.diagnostics.typos,
null_ls.builtins.code_actions.proselint, --null_ls.builtins.code_actions.proselint,
null_ls.builtins.diagnostics.proselint, --null_ls.builtins.diagnostics.proselint,
null_ls.builtins.hover.dictionary, null_ls.builtins.hover.dictionary,
null_ls.builtins.formatting.black}, null_ls.builtins.formatting.black},
}) })

View File

@@ -12,5 +12,5 @@ return {
exclude_groups = {}, -- table: groups you don't want to clear exclude_groups = {}, -- table: groups you don't want to clear
}) })
end, end,
cmd = {"TransparentEnable", "TransparentDisable", "TransparentToggle" }, --cmd = {"TransparentEnable", "TransparentDisable", "TransparentToggle" },
} }

View File

@@ -1,5 +1,27 @@
return { return {
-- meta - v -- meta - v
'gsuuon/tshjkl.nvim', 'gsuuon/tshjkl.nvim',
setup = true opts = {
keymaps = {
toggle = '<leader>v',
},
marks = {
parent = {
virt_text = { {'h', 'ModeMsg'} },
virt_text_pos = 'overlay'
},
child = {
virt_text = { {'l', 'ModeMsg'} },
virt_text_pos = 'overlay'
},
prev = {
virt_text = { {'k', 'ModeMsg'} },
virt_text_pos = 'overlay'
},
next = {
virt_text = { {'j', 'ModeMsg'} },
virt_text_pos = 'overlay'
}
}
}
} }