dap and dap ui + live-command and rust-tools updates

- setup signs for dap
- improved dap and dapmode keybindings
- live-command preview plugin
master
spike 2 years ago
parent fba0ef8038
commit b0ca1ac78d

@ -2,3 +2,7 @@ snippet fn
function() function()
$0 $0
end end
snippet lm
local M = {}
$0

@ -1,8 +1,8 @@
NVIM v0.8.0-dev-1194-ga80ab395a NVIM v0.9.0-dev-77-gf175ca9f7
Build type: RelWithDebInfo Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3 LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include Compilation: /usr/bin/gcc-10 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az220-425 Compiled by runner@fv-az47-468
Features: +acl +iconv +tui Features: +acl +iconv +tui
See ":help feature-compile" See ":help feature-compile"

@ -27,7 +27,16 @@ M.general = { --{{{
},--}}} },--}}}
n = {--{{{ n = {--{{{
["<ESC>"] = { "<cmd> noh <CR>", "no highlight" }, ["<ESC>"] = {
function()
if vim.o.filetype == "qf" then
vim.cmd("q")
else
vim.cmd("noh")
end
end,
"no highlight"
},
-- switch between windows -- switch between windows
["<C-h>"] = { "<C-w>h", "window left" }, ["<C-h>"] = { "<C-w>h", "window left" },
@ -146,8 +155,9 @@ M.general = { --{{{
}, },
-- quick close window -- quick close window
["<C-x>"] = {"<C-w>c", "close window"}, ["<C-x><C-x>"] = {"<C-w>c", "close window"},
-- Increase number is with double <C-a> and decrease with simple C-x
-- yank from cusor to eol to system and primary clipboard -- yank from cusor to eol to system and primary clipboard
@ -493,11 +503,19 @@ M.general = { --{{{
n = { n = {
["<leader>ds"] = { ["<leader>ds"] = {
function() function()
if vim.o.filetype == "go" then local mydap = require("spike.dap")
local spdap = require("spike.dap")
spdap.setup() mydap.setup()
spdap.go_debug() require('spike.dap.utils').init_breakpoints()
-- set a breakpoint at current line if there are none in
-- the project
if vim.o.filetype == "go" then
mydap.go_debug()
elseif vim.o.filetype == "rust" then
local rt = require("rust-tools")
-- make sure lsp is running ?
rt.debuggables.debuggables()
end end
end, end,
"start dap session" "start dap session"
@ -524,10 +542,18 @@ M.general = { --{{{
}, },
["<leader>dm"] = { ["<leader>dm"] = {
function() function()
require("spike.dapmode").start() require('spike.dap.dapmode').start()
end, end,
"enter dap mode" "enter dap mode"
} },
["<leader>dr"] = {"<cmd>lua require'dap'.run_last()<CR>", "[dap] rerun last"},
["<leader>dl"] = {
function()
require('spike.dap.utils').dap_logpoint()
end,
"[dap] add log point"
},
["<leader>dt"] = {"<cmd>lua require'dapui'.toggle()<CR>", "[dap] toggle UI"},
}, },
}-- }}} }-- }}}

@ -98,6 +98,7 @@ g.netrw_winsize = 20 -- width of the window (25%)
opt.signcolumn = "yes" opt.signcolumn = "yes"
opt.signcolumn = "auto:1-3" -- accommodate up to 3 icons
opt.splitbelow = true opt.splitbelow = true
opt.splitright = true opt.splitright = true
opt.termguicolors = true opt.termguicolors = true

@ -56,12 +56,12 @@ M.ui = {
italic = true, italic = true,
}, },
DiagnosticFloatingInfo = { DiagnosticFloatingInfo = {
fg="white", fg = "white",
italic=true, italic = true,
}, },
DiagnosticUnderlineError = { DiagnosticUnderlineError = {
fg="black", fg = "black",
bg="pink", bg = "pink",
}, },
-- Code Lens related colors -- Code Lens related colors
LspCodeLens = { LspCodeLens = {
@ -88,7 +88,22 @@ M.ui = {
fg = "grey", fg = "grey",
bg = "baby_pink", bg = "baby_pink",
}, },
}, DapBreakpoint = {
fg = "green"
},
DapStopped = {
fg = "#ff4848"
},
DapLogPoint = {
fg = "vibrant_green"
},
DapBreakpointCondition = {
fg = "cyan"
},
DapBreakpointRejected = {
fg = "purple"
}
},
-- hl_override = { -- hl_override = {
-- CursorLine = { -- CursorLine = {
-- underline = 1 -- underline = 1
@ -108,13 +123,6 @@ M.ui = {
M.plugins = { M.plugins = {
user = require "custom.plugins", user = require "custom.plugins",
override = { override = {
["folke/which-key.nvim"] = {
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
i = { "j", "k" },
v = { "j", "k" },
},
},
["NvChad/ui"] = { ["NvChad/ui"] = {
-- tabufline = { -- tabufline = {
-- lazyload = false, -- lazyload = false,

@ -37,13 +37,14 @@ vim.cmd [[
-- suckless { -- suckless {
vim.cmd [[ vim.cmd [[
" Autocompile suckless " Autocompile suckless
let dwm_file_patterns = expand("$HOME/.local/src/suckless/*/{config.h,*.c}") " NOTE: symlinks do not work with autocommand patterns
let dwm_file_patterns = expand("/data/source/suckless/*/{config.h,*.c}")
augroup DWM augroup DWM
au! au!
execute "au BufEnter " . dwm_file_patterns . " :lcd %:p:h" execute "au BufEnter " . dwm_file_patterns . " :lcd %:p:h"
execute "au BufWrite " . dwm_file_patterns . " :AsyncRun! make clean && make && sudo make install" execute "au BufWritePost " . dwm_file_patterns . " :AsyncRun! make clean && make && sudo make install"
"au BufWrite */src/*/dwm*/{*.h,dwm.c} :AsyncRun! make clean && make && sudo make install "au BufWrite */src/*/dwm*/{*.h,dwm.c} :AsyncRun! make clean && make && sudo make install
augroup END augroup END
]] ]]

@ -0,0 +1,10 @@
-- local dap = require("dap")
local M = {}
local opts = {
}
M.setup = function()
end
return M

@ -0,0 +1,82 @@
local dapui = require('dapui')
local M = {}
local opts = {
icons = { expanded = "", collapsed = "", current_frame = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7") == 1,
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
"stacks",
-- "watches",
},
size = 40, -- 40 columns
position = "left",
},
{
elements = {
"repl",
"watches"
-- "console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
controls = {
-- Requires Neovim nightly (or 0.8 when released)
enabled = true,
-- Display controls in this element
element = "repl",
icons = {
pause = "",
play = "",
step_into = "",
step_over = "",
step_out = "",
step_back = "",
run_last = "",
terminate = "",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
max_value_lines = 100, -- Can be integer or nil.
}
}
M.setup = function()
dapui.setup(opts)
end
return M

@ -0,0 +1,42 @@
local M = {}
local opts = {
defaults = {
enable_highlighting = true,
inline_highlighting = true,
hl_groups = {
insertion = "DiffAdd",
deletion = "DiffDelete",
change = "DiffChange",
},
},
debug = true,
commands = {
Norm = { cmd = "norm" },
Reg = {
cmd = "norm",
-- This will transform ":5Reg a" into ":norm 5@a"
args = function(opts)
return (opts.count == -1 and "" or opts.count) .. "@" .. opts.args
end,
range = "",
},
}
}
function M.get_cmds()
local cmds = {}
for cmd, _ in pairs(opts.commands) do
table.insert(cmds, cmd)
end
return cmds
end
function M.setup()
require("live-command").setup(opts)
end
return M

@ -47,7 +47,7 @@ local config = {
{ key = 'gL', func = require('navigator.diagnostics').show_diagnostics, desc = 'lsp show_diagnostics' }, { key = 'gL', func = require('navigator.diagnostics').show_diagnostics, desc = 'lsp show_diagnostics' },
{ key = 'gG', func = require('navigator.diagnostics').show_buf_diagnostics, desc = 'lsp show_buf_diagnostics' }, { key = 'gG', func = require('navigator.diagnostics').show_buf_diagnostics, desc = 'lsp show_buf_diagnostics' },
-- { key = '<Leader>dt', func = require('navigator.diagnostics').toggle_diagnostics, desc = 'lsp toggle_diagnostics' }, -- { key = '<Leader>dt', func = require('navigator.diagnostics').toggle_diagnostics, desc = 'lsp toggle_diagnostics' },
{ key = '<Leader>dt', func = require('spike.lsp').toggle_diagnostics, desc = 'lsp toggle_diagnostics' }, { key = '<Leader>td', func = require('spike.lsp').toggle_diagnostics, desc = 'lsp toggle_diagnostics' },
{ key = ']d', func = vim.diagnostic.goto_next, desc = 'lsp next diagnostics' }, { key = ']d', func = vim.diagnostic.goto_next, desc = 'lsp next diagnostics' },
{ key = '[d', func = vim.diagnostic.goto_prev, desc = 'lsp prev diagnostics' }, { key = '[d', func = vim.diagnostic.goto_prev, desc = 'lsp prev diagnostics' },
{ key = ']O', func = vim.diagnostic.set_loclist, desc = 'lsp diagnostics set loclist' }, { key = ']O', func = vim.diagnostic.set_loclist, desc = 'lsp diagnostics set loclist' },
@ -56,13 +56,13 @@ local config = {
{ key = '<C-LeftMouse>', func = vim.lsp.buf.definition, desc = 'lsp definition' }, { key = '<C-LeftMouse>', func = vim.lsp.buf.definition, desc = 'lsp definition' },
{ key = 'g<LeftMouse>', func = vim.lsp.buf.implementation, desc = 'lsp implementation' }, { key = 'g<LeftMouse>', func = vim.lsp.buf.implementation, desc = 'lsp implementation' },
{ key = '<Leader>k', func = require('navigator.dochighlight').hi_symbol, desc = 'lsp hi_symbol' }, { key = '<Leader>k', func = require('navigator.dochighlight').hi_symbol, desc = 'lsp hi_symbol' },
{ key = '<Space>wa', func = require('navigator.workspace').add_workspace_folder, desc = 'lsp add_workspace_folder' }, { key = '<leader>wa', func = require('navigator.workspace').add_workspace_folder, desc = 'lsp add_workspace_folder' },
{ {
key = '<Space>wr', key = '<leader>wr',
func = require('navigator.workspace').remove_workspace_folder, func = require('navigator.workspace').remove_workspace_folder,
desc = 'lsp lsp remove_workspace_folder', desc = 'lsp lsp remove_workspace_folder',
}, },
{ key = '<Space>ff', func = vim.lsp.buf.format, mode = 'n', desc = 'lsp format' }, { key = '<space>fm', func = vim.lsp.buf.format, mode = 'n', desc = 'lsp format' },
-- { key = '<Space>ff', func = vim.lsp.buf.range_formatting, mode = 'v', desc = 'lsp range format' }, -- { key = '<Space>ff', func = vim.lsp.buf.range_formatting, mode = 'v', desc = 'lsp range format' },
-- DEPRECATED -- DEPRECATED
-- { -- {
@ -71,8 +71,8 @@ local config = {
-- mode = 'n', -- mode = 'n',
-- desc = 'lsp range format operator e.g gmip', -- desc = 'lsp range format operator e.g gmip',
-- }, -- },
{ key = '<Space>wl', func = require('navigator.workspace').list_workspace_folders, desc = 'lsp list_workspace_folders' }, { key = '<leader>wl', func = require('navigator.workspace').list_workspace_folders, desc = 'lsp list_workspace_folders' },
{ key = '<Space>la', mode = 'n', func = require('navigator.codelens').run_action, desc = 'lsp run code lens action' }, { key = '<leader>ll', mode = 'n', func = require('navigator.codelens').run_action, desc = 'lsp run code lens action' },
}, },
icons = { icons = {

@ -171,6 +171,7 @@ local opts = {
type = "executable", type = "executable",
command = "lldb-vscode", command = "lldb-vscode",
name = "rt_lldb", name = "rt_lldb",
console = "integratedTerminal",
}, },
}, },
} }

@ -35,10 +35,10 @@ return {
-- My Plugins -- My Plugins
["~/.config/nvim/my_packages/perproject"] = {-- {{{ ["~/.config/nvim/my_packages/perproject"] = { -- {{{
opt = true, opt = true,
after = {"nvim-lspconfig", "navigator.lua"}, after = { "nvim-lspconfig", "navigator.lua" },
require = {"nvim-lspconfig", "navigator.lua"}, require = { "nvim-lspconfig", "navigator.lua" },
config = function() config = function()
require("perproject").setup() require("perproject").setup()
-- callbacks = { -- callbacks = {
@ -48,12 +48,12 @@ return {
-- } -- }
-- }) -- })
end end
},-- }}} }, -- }}}
-- treesitter -- treesitter
["nvim-treesitter/nvim-treesitter"] = {-- {{{ ["nvim-treesitter/nvim-treesitter"] = { -- {{{
-- custom config in chadrc -> custom.configs.treesitter -- custom config in chadrc -> custom.configs.treesitter
setup = function() setup = function()
require("core.lazy_load").on_file_open "nvim-treesitter" require("core.lazy_load").on_file_open "nvim-treesitter"
@ -80,13 +80,13 @@ return {
config = function() config = function()
require("custom.plugins.configs.treesitter-context").setup() require("custom.plugins.configs.treesitter-context").setup()
end end
},-- }}} }, -- }}}
-- autocomplete -- autocomplete
["hrsh7th/cmp-buffer"] = {-- {{{ ["hrsh7th/cmp-buffer"] = { -- {{{
config = function () config = function()
local disabled_ft = { local disabled_ft = {
"guihua", "guihua",
"clap_input", "clap_input",
@ -95,7 +95,7 @@ return {
} }
require("cmp").setup.buffer { require("cmp").setup.buffer {
enabled = function () enabled = function()
for _, v in ipairs(disabled_ft) do for _, v in ipairs(disabled_ft) do
if vim.o.ft == v then return false end if vim.o.ft == v then return false end
end end
@ -103,11 +103,11 @@ return {
end end
} }
end end
},-- }}} }, -- }}}
-- snippets -- snippets
["honza/vim-snippets"] = {-- {{{ ["honza/vim-snippets"] = { -- {{{
module = {"cmp", "cmp_nvim_lsp"}, module = { "cmp", "cmp_nvim_lsp" },
event = "InsertEnter", event = "InsertEnter",
}, },
@ -117,7 +117,7 @@ return {
-- load default config first -- load default config first
require("plugins.configs.others").luasnip() require("plugins.configs.others").luasnip()
vim.g.my_snippets_paths = {"./custom_snippets"} vim.g.my_snippets_paths = { "./custom_snippets" }
require("luasnip").filetype_extend("markdown", { "markdown_zk" }) require("luasnip").filetype_extend("markdown", { "markdown_zk" })
-- load snippets from "honza/vim-snippets" -- load snippets from "honza/vim-snippets"
@ -128,7 +128,7 @@ return {
override_priority = 800 override_priority = 800
} }
end end
},-- }}} }, -- }}}
-- text formatting -- text formatting
@ -142,8 +142,8 @@ return {
["tpope/vim-surround"] = {}, ["tpope/vim-surround"] = {},
["godlygeek/tabular"] = { ["godlygeek/tabular"] = {
cmd = "Tabularize" lcmd = "Tabularize"
},-- }}} }, -- }}}
-- ["p00f/nvim-ts-rainbow"] = { -- ["p00f/nvim-ts-rainbow"] = {
@ -153,47 +153,63 @@ return {
-- dap -- dap
["mfussenegger/nvim-dap"] = {-- {{{ ["mfussenegger/nvim-dap"] = { -- {{{
lock = true, lock = true,
module = "dap", module = "dap",
setup = function() setup = function()
require("core.utils").load_mappings "dap" require("core.utils").load_mappings "dap"
require('spike.dap').setup()
end, end,
config = function()
require("custom.plugins.configs.dap").setup()
end
}, },
["rcarriga/nvim-dap-ui"] = { ["rcarriga/nvim-dap-ui"] = {
tag = "*", tag = "*",
after = "nvim-dap", after = "nvim-dap",
config = function()
require('custom.plugins.configs.dapui').setup()
end
}, },
["theHamsta/nvim-dap-virtual-text"] = { ["theHamsta/nvim-dap-virtual-text"] = {
lock = true, lock = true,
after = "nvim-dap" after = "nvim-dap"
},-- }}} }, -- }}}
-- User Interface / UX -- User Interface / UX
--
-- allows to preview commands after they are registerd by plugin
-- the current registerd norm command works by first selecting a visual selection
-- then doing the changes, it's an enhanced multi cursor
["smjonas/live-command.nvim"] = {
cmd = require("custom.plugins.configs.live-command").get_cmds(),
opt = true,
config = function()
require("custom.plugins.configs.live-command").setup()
end
},
["folke/which-key.nvim"] = {-- {{{ ["folke/which-key.nvim"] = { -- {{{
lock = true, lock = true,
disable = false, disable = false,
keys = {"<leader>", "<BS>", "<Space>"} keys = { "<leader>", "<BS>", "<Space>", "\"", "`", "'", "z", "g" }
}, },
-- repeat operator for plugin commands -- repeat operator for plugin commands
["tpope/vim-repeat"] = { ["tpope/vim-repeat"] = {
keys = {"."}, keys = { "." },
}, },
["nvim-telescope/telescope.nvim"] = { ["nvim-telescope/telescope.nvim"] = {
-- lock = true, -- lock = true,
after = "vim-hardtime",
disable = false, disable = false,
}, },
["tom-anders/telescope-vim-bookmarks.nvim"] = { ["tom-anders/telescope-vim-bookmarks.nvim"] = {
opt = true, opt = true,
module = "telescope", module = "telescope",
after = {"telescope.nvim", "vim-bookmarks"}, after = { "telescope.nvim", "vim-bookmarks" },
-- cmd = "Telescope", -- cmd = "Telescope",
-- requires = "vim-bookmarks", -- requires = "vim-bookmarks",
-- after = {"vim-bookmarks", "telescope"}, -- after = {"vim-bookmarks", "telescope"},
@ -205,7 +221,7 @@ return {
["nvim-telescope/telescope-fzf-native.nvim"] = { ["nvim-telescope/telescope-fzf-native.nvim"] = {
opt = true, opt = true,
module = "telescope", module = "telescope",
after = {"telescope.nvim"}, after = { "telescope.nvim" },
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
}, },
["ibhagwan/fzf-lua"] = { ["ibhagwan/fzf-lua"] = {
@ -218,31 +234,32 @@ return {
setup = function() setup = function()
require("core.utils").load_mappings "fzf_lua" require("core.utils").load_mappings "fzf_lua"
end end
},-- }}} }, -- }}}
-- Theme customization -- Theme customization
["uga-rosa/ccc.nvim"] = { ["uga-rosa/ccc.nvim"] = { -- {{{{{{
commit = "427471b", commit = "427471b",
cmd = {"Ccc*", "<Plug>(ccc-insert)"}, cmd = { "Ccc*", "<Plug>(ccc-insert)" },
setup = function() setup = function()
require("core.utils").load_mappings "ccc" require("core.utils").load_mappings "ccc"
end, end,
config = function() config = function()
require("ccc").setup({}) require("ccc").setup({})
end end
}, }, -- }}}}}}
-- navigation / jumping / buffer modification
-- navigation / jumps
-- ["justinmk/vim-sneak"] = { -- ["justinmk/vim-sneak"] = {
-- lock = true, -- lock = true,
-- keys = {"s", "S"}, -- keys = {"s", "S"},
-- }, -- },
["ggandor/leap.nvim"] = {-- {{{ ["ggandor/leap.nvim"] = { -- {{{
config = function() config = function()
require "custom.plugins.configs.leap" require "custom.plugins.configs.leap"
end end
},-- }}} }, -- }}}
-- tmux helpers -- tmux helpers
["christoomey/vim-tmux-navigator"] = { ["christoomey/vim-tmux-navigator"] = {
@ -260,18 +277,19 @@ return {
-- Job management (use nvim startjob ) -- Job management (use nvim startjob )
-- Run async commands (make & errors) -- Run async commands (make & errors)
["skywind3000/asyncrun.vim"] = {-- {{{ -- TODO: replace with https://github.com/skywind3000/asynctasks.vim
["skywind3000/asyncrun.vim"] = { -- {{{
lock = true, lock = true,
cmd = "AsyncRun", cmd = "AsyncRun",
setup = function() setup = function()
require("core.utils").load_mappings "asyncrun" require("core.utils").load_mappings "asyncrun"
vim.g.asyncrun_open = 8 vim.g.asyncrun_open = 8
end end
},-- }}} }, -- }}}
-- Git -- Git
["tpope/vim-fugitive"] = { ["tpope/vim-fugitive"] = {
cmd = {"G", "Git", "G*"} cmd = { "G", "Git", "G*" }
}, },
-- session and view -- session and view
@ -292,41 +310,55 @@ return {
-- Misc / General plugins -- Misc / General plugins
-- Read info files -- Read info files
["https://gitlab.com/HiPhish/info.vim.git"] = { ["https://gitlab.com/HiPhish/info.vim.git"] = { -- {{{{{{
cmd = "Info", cmd = "Info",
}, }, -- }}}}}}
["MattesGroeger/vim-bookmarks"] = { ["MattesGroeger/vim-bookmarks"] = { -- {{{
config = function() config = function()
require("core.utils").load_mappings "vim_bookmarks" require("core.utils").load_mappings "vim_bookmarks"
end end
}, }, -- }}}
-- create new vim modes -- create new vim modes
["Iron-E/nvim-libmodal"] = { ["Iron-E/nvim-libmodal"] = { -- {{{
lock = true, lock = true,
}, }, -- }}}
-- get rid of bad habits -- get rid of bad habits
["takac/vim-hardtime"] = { -- ["ja-ford/delaytrain.nvim"] = {
-- keys = { "h", "j", "k", "l" }, ["~/src/delaytrain.nvim"] = {
setup = function() config = function()
vim.g.hardtime_default_on = 1 require('delaytrain').setup({
vim.g.hardtime_showmsg = 1 delay_ms = 1000, -- How long repeated usage of a key should be prevented
vim.g.list_of_normal_keys = {"h","j","k","l"} grace_period = 1, -- How many repeated keypresses are allowed
vim.g.list_of_visual_keys = {"h","j","k","l"} keys = { -- Which keys (in which modes) should be delayed
vim.g.hardtime_ignore_quickfix = 1 ['nv'] = { 'h', 'j', 'k', 'l' },
vim.g.hardtime_ignore_buffer_patterns = { -- ['nvi'] = { '<Left>', '<Down>', '<Up>', '<Right>' },
"NERD.*",
"netrw",
"TelescopePrompt",
"fugitive",
"guihua*",
}
vim.g.hardtime_maxcount = 2
end,
}, },
ignore_filetypes = {"qf", "NvimTree", "help", "qf", "netrw"},
})
end
},
-- ["takac/vim-hardtime"] = {-- {{{
-- -- keys = { "h", "j", "k", "l" },
-- setup = function()
-- vim.g.hardtime_default_on = 1
-- vim.g.hardtime_showmsg = 1
-- vim.g.list_of_normal_keys = {"h","j","k","l"}
-- vim.g.list_of_visual_keys = {"h","j","k","l"}
-- vim.g.hardtime_ignore_quickfix = 1
-- vim.g.hardtime_ignore_buffer_patterns = {
-- "NERD.*",
-- "netrw",
-- "TelescopePrompt",
-- "fugitive",
-- "guihua*",
-- }
-- vim.g.hardtime_maxcount = 2
-- end,
-- },-- }}}
-- ["chentoast/marks.nvim"] = { -- ["chentoast/marks.nvim"] = {
-- opt = true, -- opt = true,
@ -341,9 +373,9 @@ return {
-- LSP -- LSP
-- ------------------ -- ------------------
["neovim/nvim-lspconfig"] = {-- {{{ ["neovim/nvim-lspconfig"] = { -- {{{
after = {"lua-dev.nvim", "mason.nvim", "mason-lspconfig.nvim"}, after = { "lua-dev.nvim", "mason.nvim", "mason-lspconfig.nvim" },
module = {"lspconfig"}, module = { "lspconfig" },
lock = false, lock = false,
config = function() config = function()
require("plugins.configs.lspconfig").setup() require("plugins.configs.lspconfig").setup()
@ -351,16 +383,16 @@ return {
}, },
["williamboman/mason-lspconfig.nvim"] = { ["williamboman/mason-lspconfig.nvim"] = {
lock = false, lock = false,
requires = {"williamboman/mason.nvim", "nvim-lspconfig"}, requires = { "williamboman/mason.nvim", "nvim-lspconfig" },
-- after = "mason.nvim", -- after = "mason.nvim",
module = {"mson-lspconfig.nvim", "mason.nvim"}, module = { "mson-lspconfig.nvim", "mason.nvim" },
config = function() config = function()
require("mason-lspconfig").setup({}) require("mason-lspconfig").setup({})
end, end,
}, },
["ray-x/guihua.lua"] = { ["ray-x/guihua.lua"] = {
lock = true, lock = true,
module = {"navigator"}, module = { "navigator" },
run = "cd lua/fzy && make", run = "cd lua/fzy && make",
config = function() config = function()
require("guihua.maps").setup { require("guihua.maps").setup {
@ -378,7 +410,7 @@ return {
opt = true, opt = true,
module = "navigator", module = "navigator",
after = { "nvim-lspconfig", "base46", "ui", "mason.nvim", "mason-lspconfig.nvim", "lua-dev.nvim" }, after = { "nvim-lspconfig", "base46", "ui", "mason.nvim", "mason-lspconfig.nvim", "lua-dev.nvim" },
requires = {"neovim/nvim-lspconfig", "ray-x/guihua.lua", "nvim-treesitter/nvim-treesitter"}, requires = { "neovim/nvim-lspconfig", "ray-x/guihua.lua", "nvim-treesitter/nvim-treesitter" },
setup = function() setup = function()
require("core.lazy_load").on_file_open "navigator.lua" require("core.lazy_load").on_file_open "navigator.lua"
require("core.utils").load_mappings "navigator" require("core.utils").load_mappings "navigator"
@ -394,12 +426,12 @@ return {
["ray-x/lsp_signature.nvim"] = { ["ray-x/lsp_signature.nvim"] = {
lock = true, lock = true,
after = {"navigator.lua"}, after = { "navigator.lua" },
config = function() config = function()
require("custom.plugins.configs.lsp_signature").setup() require("custom.plugins.configs.lsp_signature").setup()
end end
},-- }}} }, -- }}}
-- side panel with symbols (replaced by Navigator :LspSymbols cmd) -- side panel with symbols (replaced by Navigator :LspSymbols cmd)
-- ["liuchengxu/vista.vim"] = { -- ["liuchengxu/vista.vim"] = {
@ -445,7 +477,7 @@ return {
-- power Repl {{{ -- power Repl {{{
["hkupty/iron.nvim"] = { ["hkupty/iron.nvim"] = {
loack = true, loack = true,
cmd = {"Iron*"}, cmd = { "Iron*" },
setup = function() setup = function()
require("core.utils").load_mappings "iron" require("core.utils").load_mappings "iron"
end, end,
@ -459,12 +491,12 @@ return {
lock = true, lock = true,
cmd = "Repl", cmd = "Repl",
after = "nvim-cmp", after = "nvim-cmp",
config = function () config = function()
local autocmd = vim.api.nvim_create_autocmd local autocmd = vim.api.nvim_create_autocmd
autocmd("FileType",{ autocmd("FileType", {
pattern = "neorepl", pattern = "neorepl",
callback = function () callback = function()
require('cmp').setup.buffer({enabled = false}) require('cmp').setup.buffer({ enabled = false })
-- custom keymap example -- custom keymap example
-- activate corresponding section in mappings -- activate corresponding section in mappings
@ -479,28 +511,28 @@ return {
["folke/lua-dev.nvim"] = { ["folke/lua-dev.nvim"] = {
lock = true, lock = true,
module = "lua-dev", module = "lua-dev",
},-- }}} }, -- }}}
-- golang dev -- golang dev
["ray-x/go.nvim"] = {-- {{{ ["ray-x/go.nvim"] = { -- {{{
lock = true, lock = true,
-- after = {"nvim-lspconfig", "navigator.lua", "guihua.lua"}, -- after = {"nvim-lspconfig", "navigator.lua", "guihua.lua"},
ft = {"go"}, ft = { "go" },
opt = true, opt = true,
config = function() config = function()
require("custom.plugins.configs.gonvim").setup() require("custom.plugins.configs.gonvim").setup()
end end
},-- }}} }, -- }}}
-- Rust dev -- Rust dev
["simrat39/rust-tools.nvim"] = {-- {{{ ["simrat39/rust-tools.nvim"] = { -- {{{
lock = true, lock = true,
ft = {"rust"}, ft = { "rust" },
opt = true, opt = true,
config = function() config = function()
require("custom.plugins.configs.rust-tools").setup() require("custom.plugins.configs.rust-tools").setup()
end end
}-- }}} } -- }}}
} }

@ -37,7 +37,7 @@ local modes = {
} }
local function is_dapmode() local function is_dapmode()
return require("spike.dapmode").is_active() return require("spike.dap.dapmode").is_active()
-- return false -- return false
end end

@ -65,8 +65,14 @@ local options = {
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.complete(), -- Try to emulate native neovim C-x completion style behavior
["<C-e><C-e>"] = cmp.mapping.complete(),
["<C-c>"] = cmp.mapping.close(), ["<C-c>"] = cmp.mapping.close(),
["<C-e>"] = cmp.mapping.abort(),
["<C-y>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
["<CR>"] = cmp.mapping.confirm { ["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,

@ -7,6 +7,7 @@ end
require("base46").load_highlight "whichkey" require("base46").load_highlight "whichkey"
local options = { local options = {
registers = true,
icons = { icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
@ -33,7 +34,7 @@ local options = {
-- list of mode / prefixes that should never be hooked by WhichKey -- list of mode / prefixes that should never be hooked by WhichKey
i = { "j", "k" }, i = { "j", "k" },
v = { "j", "k" }, v = { "j", "k" },
n = { "`", "'", "\"", "@"}, -- n = { "\"", "@" }, -- disable registers
}, },
} }

@ -1,33 +0,0 @@
local dapmode = require("spike.dapmode")
local M = {}
local function register_listeners()
local present, dap = pcall(require, "dap")
if not present then
print("nvim-dap missing !")
return
end
dap.listeners.before['event_initialized']['spike-dap'] = function(session, body)
dapmode.start()
end
dap.listeners.after['event_terminated']['spike-dap'] = function(session, body)
-- print("dap session ended")
dapmode.stop()
end
end
function M.go_debug()
local present, gdap = pcall(require, "go.dap")
if not present then return end
gdap.run()
end
function M.setup()
dapmode.setup({})
register_listeners()
end
return M

@ -1,30 +1,32 @@
local libmodal = require "libmodal" local libmodal = require 'libmodal'
local daputils = require 'spike.dap.utils'
M = {} M = {}
M.layer = nil M.layer = nil
local config = { local config = {
mappings = { mappings = {
n = n =
{ {
t = { rhs = '<cmd> DapToggleBreakpoint<CR>', desc= "[dap] toggle breakpoint" }, t = { rhs = '<cmd> DapToggleBreakpoint<CR>', desc= '[dap] toggle breakpoint' },
T = { T = {
rhs = function() rhs = function()
require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))
end, end,
desc = "[dap] conditional breakpoint", desc = '[dap] conditional breakpoint',
}, },
c = { c = {
rhs = function() rhs = function()
require('dap').continue() require('dap').continue()
end, end,
desc = "[dap] continue" desc = '[dap] continue'
}, },
n = { n = {
rhs = function() rhs = function()
require('dap').step_over() require('dap').step_over()
end, end,
desc = "[dap] step over" desc = '[dap] step over'
}, },
s = { s = {
rhs = function() rhs = function()
@ -40,45 +42,45 @@ local config = {
}, },
r = { r = {
rhs = function() rhs = function()
require('go.dap').run() require('dap').run_last()
end, end,
desc = '[dap] run' desc = '[dap] restart'
}, },
S = { S = {
rhs = function() rhs = function()
require('go.dap').stop() daputils.disconnect_dap()
end, end,
desc = "[dap] stop" desc = '[dap] stop'
}, },
C = { C = {
rhs = function() rhs = function()
require('dap').run_to_cursor() require('dap').run_to_cursor()
end, end,
desc = "[dap] run to curosr" desc = '[dap] run to curosr'
}, },
W = { W = {
rhs = function() rhs = function()
require("dapui").float_element('watches') require('dapui').float_element('watches')
end, end,
desc = '[dapui] float watches' desc = '[dapui] float watches'
}, },
B = { B = {
rhs = function() rhs = function()
require("dapui").float_element('breakpoints') require('dapui').float_element('breakpoints')
end, end,
desc = '[dapui] float breakpoints' desc = '[dapui] float breakpoints'
}, },
O = { O = {
rhs = function() rhs = function()
require("dapui").float_element('scopes') require('dapui').float_element('scopes')
end, end,
desc = '[dapui] float scopes' desc = '[dapui] float scopes'
}, },
["Q"] = { ['Q'] = {
rhs = function() rhs = function()
M.layer:exit() M.layer:exit()
end, end,
desc = "[dap] exit dap mode" desc = '[dap] exit dap mode'
} }
} }
} }
@ -97,7 +99,7 @@ function M.stop()
end end
function M.setup (opts) function M.setup (opts)
config = vim.tbl_deep_extend("force", config, opts or {}) config = vim.tbl_deep_extend('force', config, opts or {})
end end
function M.is_active() function M.is_active()
@ -110,5 +112,6 @@ end
-- -- -- --
-- layer:enter() -- layer:enter()
-- --
M.disconnect_dap = disconnect_dap
return M return M

@ -0,0 +1,70 @@
local dapmode = require("spike.dap.dapmode")
local daputils = require('spike.dap.utils')
local dapui = require("dapui")
local M = {}
M.signs = {
DapBreakpoint = {
icon = '',
hl = 'DapBreakpoint'
},
DapLogPoint = {
icon = '',
hl = 'DapLogPoint',
},
DapStopped = {
icon = '',
hl = 'DapStopped',
},
DapBreakpointCondition = {
icon = '',
hl = 'DapBreakpointCondition',
},
DapBreakpointRejected = {
icon = '',
hl = 'DapBreakpointRejected'
}
}
local function register_listeners()
local present, dap = pcall(require, "dap")
if not present then
print("nvim-dap missing !")
return
end
dap.listeners.before['event_initialized']['spike-dap'] = function(session, body)
dapmode.start()
dapui.open()
end
dap.listeners.after['event_terminated']['spike-dap'] = function(session, body)
-- print("dap session ended")
dapmode.stop()
dapui.close()
end
end
function M.go_debug()
local present, gdap = pcall(require, "go.dap")
if not present then return end
gdap.run()
end
local function set_signs()
for sign, conf in pairs(M.signs) do
vim.fn.sign_define(sign, {text = conf.icon, texthl=conf.hl})
end
end
function M.prepare_launch()
end
function M.setup()
dapmode.setup({})
register_listeners()
set_signs()
end
return M

@ -0,0 +1,35 @@
local ok, dap = pcall(require, 'dap')
if not ok then
vim.notify('dap module missing')
end
local M = {}
M.disconnect_dap = function()
local has_dap, dap = pcall(require, 'dap')
if has_dap then
dap.disconnect()
dap.repl.close()
vim.cmd('sleep 100m') -- allow cleanup
else
vim.notify('dap not found')
end
end
M.dap_logpoint = function()
vim.ui.input({ prompt = 'Logpoint message> '}, function (input)
dap.set_breakpoint(nil,nil,input)
end)
end
-- if there are no breakpoints in the project set a breakpoint on the current
-- line
M.init_breakpoints = function()
-- see https://github.com/rcarriga/nvim-dap-ui/blob/master/lua/dapui/state.lua
-- for a reference to access dap breakpoint details
local breakpoints = require('dap.breakpoints').get() or {}
if #breakpoints == 0 then
dap.set_breakpoint()
end
end
return M

@ -18,3 +18,13 @@ R = function(name)
RELOAD(name) RELOAD(name)
return require(name) return require(name)
end end
TBL_HASVAL = function(tab, val)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end

Loading…
Cancel
Save