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

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,27 @@
return {
-- meta - v
'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'
}
}
}
}