adjust mappings

This commit is contained in:
fiplox 2023-01-19 17:06:23 +01:00
parent 65aec821bc
commit 192d6c0cb4

View File

@ -20,6 +20,10 @@ vim.api.nvim_set_keymap('n', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true,
vim.api.nvim_set_keymap('t', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true }) vim.api.nvim_set_keymap('t', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true }) vim.api.nvim_set_keymap('v', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true }) vim.api.nvim_set_keymap('i', '<home>', '<cmd>ToggleTerm<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<end>', '<cmd>ToggleTerm direction=vertical<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('t', '<end>', '<cmd>ToggleTerm direction=vertical<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', '<end>', '<cmd>ToggleTerm direction=vertical<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('i', '<end>', '<cmd>ToggleTerm direction=vertical<cr>', { noremap = true, silent = true })
-- }}} -- }}}
-- misc {{{ -- misc {{{
vim.api.nvim_set_keymap('n', '<c-space>', '<cmd>nohlsearch<cr>', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '<c-space>', '<cmd>nohlsearch<cr>', { noremap = true, silent = true })
@ -148,24 +152,64 @@ local opts = {
-- leader mappings {{{ -- leader mappings {{{
-- TODO create entire treesitter section -- TODO create entire treesitter section
local mappings = { local mappings = {
['<leader>'] = { '<cmd>Lf<cr>', 'Lf' }, ['<leader>'] = {
function()
require('buffer_manager.ui').toggle_quick_menu()
end,
'Buffers',
},
['f'] = { '<cmd>Lf<cr>', 'Lf' },
['rr'] = 'Search and replace all', ['rr'] = 'Search and replace all',
['rs'] = 'Search and replace', ['rs'] = 'Search and replace',
-- ["b"] = {"<cmd>FindrBuffers<cr>", "List buffers"}, ['b'] = {
['k'] = { '<cmd>bd!<cr>', 'Kill buffer' }, function()
['n'] = { '<cmd>bn<cr>', 'Next buffer' }, require('buffer_manager.ui').toggle_quick_menu()
['p'] = { '<cmd>bp<cr>', 'Next buffer' }, end,
'List buffers',
},
['n'] = {
function()
require('buffer_manager.ui').nav_next()
end,
'List buffers',
},
['p'] = {
function()
require('buffer_manager.ui').nav_prev()
end,
'List buffers',
},
['h'] = { '<cmd>TSBufToggle highlight<cr>', 'Enable TS highlight' }, ['h'] = { '<cmd>TSBufToggle highlight<cr>', 'Enable TS highlight' },
-- ['t'] = { '<cmd>ToggleTerm direction=horizontal<cr>', 'HTerminal' }, ['1'] = {
['T'] = { '<cmd>ToggleTerm direction=vertical<cr>', 'VTerminal' }, function()
['D'] = 'Type definition', require('buffer_manager.ui').nav_file(1)
['rn'] = 'Rename', end,
['ca'] = 'Code action', 'Buffer 1',
['1'] = { '<cmd>b 1<cr>', 'Buffer 1' }, },
['2'] = { '<cmd>b 2<cr>', 'Buffer 2' }, ['2'] = {
['3'] = { '<cmd>b 3<cr>', 'Buffer 3' }, function()
['4'] = { '<cmd>b 4<cr>', 'Buffer 4' }, require('buffer_manager.ui').nav_file(2)
['5'] = { '<cmd>b 5<cr>', 'Buffer 5' }, end,
'Buffer 2',
},
['3'] = {
function()
require('buffer_manager.ui').nav_file(3)
end,
'Buffer 3',
},
['4'] = {
function()
require('buffer_manager.ui').nav_file(4)
end,
'Buffer 4',
},
['5'] = {
function()
require('buffer_manager.ui').nav_file(5)
end,
'Buffer 5',
},
['g'] = { '<cmd>Lazygit<cr>', 'Lazygit' }, ['g'] = { '<cmd>Lazygit<cr>', 'Lazygit' },
l = { l = {
name = 'LSP', name = 'LSP',
@ -201,30 +245,10 @@ local mappings = {
v = { '<C-w>v', 'Vertical split' }, v = { '<C-w>v', 'Vertical split' },
h = { '<C-w>s', 'Horizontal split' }, h = { '<C-w>s', 'Horizontal split' },
}, },
t = {
name = 'Telescope',
f = { '<cmd>Telescope find_files<cr>', 'Files' },
g = { '<cmd>Telescope live_grep<cr>', 'Grep' },
b = { '<cmd>Telescope buffers<cr>', 'Buffers' },
t = { '<cmd>Telescope<cr>', 'Pickers' },
r = { '<cmd>Telescope lsp_references<cr>', 'Lsp references' },
},
o = { o = {
name = 'Open', name = 'Open',
n = { '<cmd>Lf ~/.config/nvim/ <cr>', 'Neovim config' }, n = { '<cmd>Lf ~/.config/nvim/ <cr>', 'Neovim config' },
}, },
-- d = {
-- name = 'DAP',
-- b = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", 'Toggle breakpoint' },
-- c = { "<md>lua require'dap'.continue()<cr>", 'Continue' },
-- i = { "<cmd>lua require'dap'.step_into()<cr>", 'Step into' },
-- o = { "<cmd>lua require'dap'.step_over()<cr>", 'Step over' },
-- O = { "<cmd>lua require'dap'.step_out()<cr>", 'Step out' },
-- r = { "<cmd>lua require'dap'.repl_toggle()<cr>", 'Toggle repl' },
-- l = { "<cmd>lua require'dap'.run_last()<cr>", 'Run last' },
-- u = { "<cmd>lua require'dapui'.toggle()<cr>", 'UI' },
-- t = { "<cmd>lua require'dap'.terminate()<cr>", 'Terminate' },
-- },
} }
-- }}} -- }}}
wk.register(mappings, opts) wk.register(mappings, opts)