dotfiles/neovim/.config/nvim/lua/keybindings.lua

153 lines
5.4 KiB
Lua
Raw Normal View History

2022-10-12 09:33:11 +02:00
vim.g.mapleader = "½"
--FILEHANDLING
2022-08-25 14:11:17 +02:00
vim.api.nvim_set_keymap('n', '<M-1>',
2022-10-12 09:33:11 +02:00
"<cmd>lua require('telescope.builtin').find_files()<CR>",
2022-08-25 14:11:17 +02:00
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<M-2>',
2022-10-12 09:33:11 +02:00
"<cmd>lua require('telescope.builtin').buffers()<CR>",
{ noremap = true, silent = true }
)
--TESTING
vim.api.nvim_set_keymap('n', '<F10>',
"<cmd>lua require('neotest').output.open()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F58>',
"<cmd>lua require('neotest').summary.toggle()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F34>',
"<cmd>lua require('neotest').run.run()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F22>',
"<cmd>lua require('neotest').run.run(vim.fn.expand('%'))<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F46>',
"<cmd>lua require('neotest').run.run('tests/')<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F11>',
"<cmd>lua require('coverage').load(true)<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F59>',
"<cmd>lua require('coverage').summary()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F35>',
"<cmd>lua require('coverage').toggle()<CR>",
{ noremap = true, silent = true }
)
--DEBUGGING
vim.api.nvim_set_keymap('n', '<C-b>',
"<cmd>lua require('dap').toggle_breakpoint()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F57>',
"<cmd>lua require('dapui').toggle()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F45>',
"<cmd>lua require('dap').continue()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F33>',
"<cmd>lua require('dap-python').test_method()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F8>',
"<cmd>lua require('dap').step_over()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<F32>',
"<cmd>lua require('dap').step_into()<CR>",
2022-08-25 14:11:17 +02:00
{ noremap = true, silent = true }
)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
2022-10-12 09:33:11 +02:00
vim.keymap.set('n', '<C-J>', '<C-W><C-J>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-K>', '<C-W><C-K>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-L>', '<C-W><C-L>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-H>', '<C-W><C-H>', { noremap = true, silent = true })
2022-10-13 16:29:56 +02:00
vim.keymap.set("n", "<F5>", "<cmd>TroubleToggle document_diagnostics<cr>",
2022-10-12 09:33:11 +02:00
{silent = true, noremap = true}
)
2022-10-13 16:29:56 +02:00
--TERMINAL BINDINGS
vim.api.nvim_set_keymap('n', '<F12>', "<cmd>ToggleTerm<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<F36>', "<cmd>ToggleTermToggleAll<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<F36>', "<cmd>ToggleTermToggleAll<CR>", { noremap = true, silent = true })
vim.keymap.set('t', '<ESC>', "<C-\\><C-n>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('t', '<C-H>', "<cmd>wincmd h<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<C-J>', "<cmd>wincmd j<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<C-K>', "<cmd>wincmd k<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<C-L>', "<cmd>wincmd l<CR>", { noremap = true, silent = true })
2022-10-12 09:33:11 +02:00
-- WHICH KEY
local wk = require("which-key")
wk.register({
g = {
name = "+Git",
h = {
name = "+Github",
c = {
name = "+Commits",
c = { "<cmd>GHCloseCommit<cr>", "Close" },
e = { "<cmd>GHExpandCommit<cr>", "Expand" },
o = { "<cmd>GHOpenToCommit<cr>", "Open To" },
p = { "<cmd>GHPopOutCommit<cr>", "Pop Out" },
z = { "<cmd>GHCollapseCommit<cr>", "Collapse" },
},
i = {
name = "+Issues",
p = { "<cmd>GHPreviewIssue<cr>", "Preview" },
},
l = {
name = "+Litee",
t = { "<cmd>LTPanel<cr>", "Toggle Panel" },
},
r = {
name = "+Review",
b = { "<cmd>GHStartReview<cr>", "Begin" },
c = { "<cmd>GHCloseReview<cr>", "Close" },
d = { "<cmd>GHDeleteReview<cr>", "Delete" },
e = { "<cmd>GHExpandReview<cr>", "Expand" },
s = { "<cmd>GHSubmitReview<cr>", "Submit" },
z = { "<cmd>GHCollapseReview<cr>", "Collapse" },
},
p = {
name = "+Pull Request",
c = { "<cmd>GHClosePR<cr>", "Close" },
d = { "<cmd>GHPRDetails<cr>", "Details" },
e = { "<cmd>GHExpandPR<cr>", "Expand" },
o = { "<cmd>GHOpenPR<cr>", "Open" },
p = { "<cmd>GHPopOutPR<cr>", "PopOut" },
r = { "<cmd>GHRefreshPR<cr>", "Refresh" },
t = { "<cmd>GHOpenToPR<cr>", "Open To" },
z = { "<cmd>GHCollapsePR<cr>", "Collapse" },
},
t = {
name = "+Threads",
c = { "<cmd>GHCreateThread<cr>", "Create" },
n = { "<cmd>GHNextThread<cr>", "Next" },
t = { "<cmd>GHToggleThread<cr>", "Toggle" },
},
},
},
}, { prefix = "<leader>" })