local function map(m, k, v, opts) opts = opts or {} if not opts['silent'] then opts['silent'] = true end vim.keymap.set(m, k, v, opts) end -- Save and Quit map('n', '', ':wq') map('i', '', ':wq') -- Save map('n', '', ':w') map('i', '', ':w') -- Telescope local telescope_builtin = require('telescope.builtin') map('n', 'ff', telescope_builtin.find_files, { desc = 'Find Files' }) map('n', 'fF', ":Telescope find_files hidden=true", { desc = 'Find Files (including hidden)' }) map('n', 'fg', telescope_builtin.live_grep, { desc = 'Live Grep' }) map('n', 'fb', telescope_builtin.buffers, { desc = 'Find Buffers' }) map('n', 'fh', telescope_builtin.help_tags, { desc = 'Help Tags' }) -- NvimTree Toggle (File Explorer) map('n', '', ':NvimTreeToggle') -- ToggleTerm map('n', '', ':ToggleTerm') map('t', '', ':ToggleTerm') --[[ -- Pane navigation map('n', '', ':wincmd h') map('n', '', ':wincmd j') map('n', '', ':wincmd k') map('n', '', ':wincmd l') map('t', '', ':wincmd h') map('t', '', ':wincmd j') map('t', '', ':wincmd k') map('t', '', ':wincmd l') ]] -- Pane management map('n', 'sv', ':vsplit', { desc = 'Split Vertical' }) map('n', 'sh', ':split', { desc = 'Split Horizontal' }) -- Debugging map("n", "", ":lua require('dapui').toggle()") map("n", "", ":lua require('dap').toggle_breakpoint()") map("n", "", ":lua require('dap').continue()") map("n", "", ":lua require('dap').step_over()") map("n", "", ":lua require('dap').step_into()") map("n", "", ":lua require('dap').step_out()") map("n", "dsc", ":lua require('dap').continue()") map("n", "dsv", ":lua require('dap').step_over()") map("n", "dsi", ":lua require('dap').step_into()") map("n", "dso", ":lua require('dap').step_out()") map("n", "dhh", ":lua require('dap.ui.variables').hover()") map("v", "dhv", ":lua require('dap.ui.variables').visual_hover()") map("n", "duh", ":lua require('dap.ui.widgets').hover()") map("n", "duf", ":lua local widgets=require('dap.ui.widgets');widgets.centered_float(widgets.scopes)") map("n", "dro", ":lua require('dap').repl.open()") map("n", "drl", ":lua require('dap').repl.run_last()") map("n", "dbc", ":lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))") map("n", "dbm", ":lua require('dap').set_breakpoint({ nil, nil, vim.fn.input('Log point message: '))") map("n", "dbt", ":lua require('dap').toggle_breakpoint()") map("n", "dc", ":lua require('dap.ui.variables').scopes()") map("n", "di", ":lua require('dapui').toggle()") -- luasnip vim.cmd [[ " Use Tab to expand and jump through snippets imap luasnip#expand_or_jumpable() ? 'luasnip-expand-or-jump' : '' smap luasnip#jumpable(1) ? 'luasnip-jump-next' : '' " Use Shift-Tab to jump backwards through snippets imap luasnip#jumpable(-1) ? 'luasnip-jump-prev' : '' smap luasnip#jumpable(-1) ? 'luasnip-jump-prev' : '' ]] -- GUI (Neovide -- Toggle fullscreen in Neovide with Alt + Enter) if vim.g.neovide then map({ "n", "i", "t" }, "", function() vim.g.neovide_fullscreen = not vim.g.neovide_fullscreen end) end -- -- barbar -- local barbar_opts = { noremap = true, silent = true } -- -- -- Move to previous/next -- map('n', '', 'BufferPrevious', barbar_opts) -- map('n', '', 'BufferNext', barbar_opts) -- -- Re-order to previous/next -- map('n', '', 'BufferMovePrevious', barbar_opts) -- map('n', '>', 'BufferMoveNext', barbar_opts) -- -- Goto buffer in position... -- map('n', '', 'BufferGoto 1', barbar_opts) -- map('n', '', 'BufferGoto 2', barbar_opts) -- map('n', '', 'BufferGoto 3', barbar_opts) -- map('n', '', 'BufferGoto 4', barbar_opts) -- map('n', '', 'BufferGoto 5', barbar_opts) -- map('n', '', 'BufferGoto 6', barbar_opts) -- map('n', '', 'BufferGoto 7', barbar_opts) -- map('n', '', 'BufferGoto 8', barbar_opts) -- map('n', '', 'BufferGoto 9', barbar_opts) -- map('n', '', 'BufferLast', barbar_opts) -- -- Pin/unpin buffer -- map('n', '', 'BufferPin', barbar_opts) -- -- Close buffer -- map('n', '', 'BufferClose', barbar_opts) -- -- Wipeout buffer -- -- :BufferWipeout -- -- -- Close commands -- -- :BufferCloseAllButCurrent -- -- :BufferCloseAllButPinned -- -- :BufferCloseAllButCurrentOrPinned -- -- :BufferCloseBuffersLeft -- -- :BufferCloseBuffersRight -- -- Magic buffer-picking mode -- map('n', '', 'BufferPick', barbar_opts) -- -- Sort automatically by... -- map('n', 'bb', 'BufferOrderByBufferNumber', barbar_opts) -- map('n', 'bd', 'BufferOrderByDirectory', barbar_opts) -- map('n', 'bl', 'BufferOrderByLanguage', barbar_opts) -- map('n', 'bw', 'BufferOrderByWindowNumber', barbar_opts) -- -- -- Other: -- -- :BarbarEnable - enables barbar (enabled by default) -- -- :BarbarDisable - very bad command, should never be used -- Disable arrow keys local arrows = { '', '', '', '' } for i = 1, #arrows do map('n', arrows[i], function() end) map('i', arrows[i], function() end) end -- Code actions with ctrl + . map('n', '.', function() vim.lsp.buf.code_action({ apply = true }) end, { desc = 'Code action/Quick fix' }) -- Show telescope commands fuzzy finder map('n', '', function() require('telescope.builtin').commands() end, { desc = 'Show commands' }) -- Show diagnostics in floating window map('n', 'e', function() vim.diagnostic.open_float() end, { desc = 'Show diagnostics' })