dotfiles/private_dot_config/nvim/lua/custom/mappings.lua
2023-11-13 21:31:42 -05:00

89 lines
2.2 KiB
Lua

---@type MappingsTable
local M = {}
M.general = {
n = {
[";"] = { ":", "enter command mode", opts = { nowait = true } },
},
v = {
[">"] = { ">gv", "indent"},
},
}
M.dap = {
plugin = true,
n = {
["<leader>db"] = {"<cmd> DapToggleBreakpoint <CR>","Toggle Breakpoint"},
["<leader>dus"] = {
function ()
local widgets = require('dap.ui.widgets');
local sidebar = widgets.sidebar(widgets.scopes);
sidebar.open();
end,
"Open debugging sidebar"
}
}
}
M.dap_python = {
plugin = true,
n = {
["<leader>dpr"] = {
function()
require('dap-python').test_method()
end
}
}
}
M.crates = {
plugin = true,
n = {
["<leader>rcu"] = {
function ()
require('crates').upgrade_all_crates()
end,
"update crates"
}
}
}
M.hop = {
plugin = true,
n = {
['<Leader><Right>'] = {function ()
require('hop').hint_words({direction = require('hop.hint').HintDirection.AFTER_CURSOR, current_line_only = true})
end,
},
['<Leader><Left>'] = {function ()
require('hop').hint_words({direction = require('hop.hint').HintDirection.BEFORE_CURSOR, current_line_only = true})
end
},
['<Leader><Down>'] = {function ()
require('hop').hint_lines_skip_whitespace({direction = require('hop.hint').HintDirection.AFTER_CURSOR, current_line_only = false})
end},
['<Leader><Up>'] = {function ()
require('hop').hint_lines_skip_whitespace({direction = require('hop.hint').HintDirection.BEFORE_CURSOR, current_line_only = false})
end},
-- rebind f/F
['f'] = {function()
require('hop').hint_char1({ direction = require('hop.hint').HintDirection.AFTER_CURSOR, current_line_only = true })
end, opts={remap=true}},
['F'] = {function()
require('hop').hint_char1({ direction = require('hop.hint').HintDirection.BEFORE_CURSOR, current_line_only = true })
end, opts={remap=true}},
-- override t/T for multi window search
['t'] = {function()
require('hop').hint_words({ multi_windows=true})
end, "Hop across windows", opts={remap=true}},
['T']= {function()
require('hop').hint_char2({ multi_windows=true})
end, "Hop to chars across windows", opts={remap=true}}
}
}
return M