Add nvim-dap, custom commands pickers
This commit is contained in:
parent
3f08c78c13
commit
0066e28c8f
@ -56,8 +56,25 @@ M.general = {
|
|||||||
-- ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
-- ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
|
||||||
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||||
|
|
||||||
["<leader>y"] = {"<cmd> :w! /tmp/vimtmp<CR>", "Save into a global tmp file"},
|
-- ["<leader>y"] = {"<cmd> :w! /tmp/vimtmp<CR>", "Save into a global tmp file"},
|
||||||
["<leader>p"] = {"<cmd> :r! cat /tmp/vimtmp<CR>", "Restore from the global tmp file"},
|
-- ["<leader>p"] = {"<cmd> :r! cat /tmp/vimtmp<CR>", "Restore from the global tmp file"},
|
||||||
|
|
||||||
|
["<leader>dgg"] = {":lua require('dap').continue() <CR>", "Continue debu[g]ging"},
|
||||||
|
["<leader>dg<CR>"] = {":lua require('dapui').toggle() <CR>", "Toggle DAP ui"},
|
||||||
|
["<leader>dgw"] = {":lua require('dapui').eval() <CR>", "Open floating windows about current [w]ord"},
|
||||||
|
["<leader>dgb"] = {":lua require('dap').toggle_breakpoint() <CR>", "Toggle [b]reakpoint"},
|
||||||
|
["<leader>dgf"] = {":lua require('dap-python').test_method() <CR>", "Debug [f]unction"},
|
||||||
|
["<leader>dgo"] = {":lua require('dap').step_over() <CR>", "DAP step [o]ver method"},
|
||||||
|
["<leader>dgt"] = {":lua require('dap').step_into() <CR>", "DAP step in[t]o method"},
|
||||||
|
["<leader>dgp"] = {":lua require('dap').step_back() <CR>", "DAP step back ([p]revious)"},
|
||||||
|
["<leader>dgs"] = {
|
||||||
|
function()
|
||||||
|
local widgets = require("dap.ui.widgets")
|
||||||
|
local sidebar = widgets.sidebar(widgets.scopes)
|
||||||
|
sidebar.open({widgth = '50%'})
|
||||||
|
end,
|
||||||
|
"DAP Show debugged [s]copes",
|
||||||
|
},
|
||||||
|
|
||||||
-- new buffer
|
-- new buffer
|
||||||
-- ["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
|
-- ["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
|
||||||
@ -80,6 +97,9 @@ M.general = {
|
|||||||
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
-- ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
|
||||||
["<"] = { "<gv", "Indent line" },
|
["<"] = { "<gv", "Indent line" },
|
||||||
[">"] = { ">gv", "Indent line" },
|
[">"] = { ">gv", "Indent line" },
|
||||||
|
|
||||||
|
["<leader>dgd"] = {":lua require('dap-python').debug_selection()", "DAP debug selection"},
|
||||||
|
["<leader>dgw"] = {":lua require('dap-python').eval()", "DAP eval selection"},
|
||||||
},
|
},
|
||||||
|
|
||||||
x = {
|
x = {
|
||||||
@ -437,6 +457,7 @@ M.telescope = {
|
|||||||
|
|
||||||
["<leader>wl"] = { "<cmd> Telescope workspaces <CR>", "Find workspaces" },
|
["<leader>wl"] = { "<cmd> Telescope workspaces <CR>", "Find workspaces" },
|
||||||
|
|
||||||
|
["<leader>gm"] = { "<cmd> lua require('custom.telescope').cpickers()<CR>", "Commonly used commands" },
|
||||||
-- git
|
-- git
|
||||||
--- Commits
|
--- Commits
|
||||||
["<leader>gc"] = { "<cmd> lua require('custom.telescope').my_git_commits()<CR>", "Custom Git commits" },
|
["<leader>gc"] = { "<cmd> lua require('custom.telescope').my_git_commits()<CR>", "Custom Git commits" },
|
||||||
@ -641,4 +662,16 @@ M.gitsigns = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local all_modes = {
|
||||||
|
-- Override all delete/yank/paste to use the registers M by default
|
||||||
|
["y"] = { "\"my", "Yank", { remap=false } },
|
||||||
|
["p"] = { "\"mp", "Paste", { remap=false } },
|
||||||
|
["d"] = { "\"md", "Delete", { remap=false } },
|
||||||
|
|
||||||
|
["<leader>y"] = { "\"+y", "Yank into system register", { remap=false } },
|
||||||
|
["<leader>p"] = { "\"+p", "Paste from system register", { remap=false } },
|
||||||
|
}
|
||||||
|
|
||||||
|
M.general[{"n", "v"}] = all_modes
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
5
lua/custom/commands.lua
Normal file
5
lua/custom/commands.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
local C = {
|
||||||
|
{ "Replace {{X}} with {{ X }} in jinja template", "%s/{{\\(.[^ ]*\\)}}/{{ \\1 }}/g" },
|
||||||
|
}
|
||||||
|
|
||||||
|
return C
|
||||||
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
local previewers = require('telescope.previewers')
|
local previewers = require('telescope.previewers')
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
|
local pickers = require("telescope.pickers")
|
||||||
|
local finders = require("telescope.finders")
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
|
||||||
local E = {}
|
local E = {}
|
||||||
|
|
||||||
@ -59,4 +64,44 @@ E.project_files = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local custom_commands = require("custom.commands")
|
||||||
|
|
||||||
|
E.cpickers = function(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
pickers.new(opts, {
|
||||||
|
prompt_title = "Commands",
|
||||||
|
|
||||||
|
finder = finders.new_table {
|
||||||
|
results = custom_commands,
|
||||||
|
entry_maker = function(entry)
|
||||||
|
return {
|
||||||
|
value = entry,
|
||||||
|
display = entry[1],
|
||||||
|
ordinal = entry[2],
|
||||||
|
}
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
previewer = previewers.new_buffer_previewer {
|
||||||
|
title = "Custom commands preview",
|
||||||
|
define_preview = function (self, entry, _)
|
||||||
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, {
|
||||||
|
entry['ordinal'],
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
attach_mappings = function(prompt_bufnr, _)
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
local selection = action_state.get_selected_entry()
|
||||||
|
vim.cmd(selection.ordinal)
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
sorter = conf.generic_sorter(opts),
|
||||||
|
}):find()
|
||||||
|
end
|
||||||
|
|
||||||
return E
|
return E
|
||||||
|
|||||||
@ -20,6 +20,46 @@ local default_plugins = {
|
|||||||
{"preservim/tagbar", lazy=false},
|
{"preservim/tagbar", lazy=false},
|
||||||
{"ludovicchabant/vim-gutentags", lazy=false},
|
{"ludovicchabant/vim-gutentags", lazy=false},
|
||||||
{"emaniacs/vim-rest-console", lazy=false},
|
{"emaniacs/vim-rest-console", lazy=false},
|
||||||
|
{"git@github.com:mfussenegger/nvim-dap.git", lazy=false},
|
||||||
|
{
|
||||||
|
"git@github.com:rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
"nvim-neotest/nvim-nio"
|
||||||
|
},
|
||||||
|
lazy=false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"git@github.com:mfussenegger/nvim-dap-python.git",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
},
|
||||||
|
lazy=false,
|
||||||
|
init = function()
|
||||||
|
require("dap-python").setup("python")
|
||||||
|
-- Setup nvim-dap-ui also
|
||||||
|
require("dapui").setup()
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
local dap = require('dap')
|
||||||
|
vim.api.nvim_set_hl(0, "dark-orange", { bg="#402c16"})
|
||||||
|
vim.fn.sign_define('DapBreakpoint', {text='🛑', texthl='', linehl='', numhl=''})
|
||||||
|
vim.fn.sign_define('DapStopped', {text='', texthl='', linehl='dark-orange', numhl=''})
|
||||||
|
dap.defaults.fallback.terminal_win_cmd = 'tabnew'
|
||||||
|
dap.defaults.fallback.focus_terminal = true
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Weissle/persistent-breakpoints.nvim",
|
||||||
|
lazy=false,
|
||||||
|
config = function(_, opts)
|
||||||
|
require('persistent-breakpoints').setup{
|
||||||
|
load_breakpoints_event = { "BufReadPost" }
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{"nvim-telescope/telescope-dap.nvim", lazy=false},
|
||||||
{"harrisoncramer/gitlab.nvim",
|
{"harrisoncramer/gitlab.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user