keymaps.lua (1996B)
1 -- Globals. 2 vim.g.mapleader=' ' -- Set <leader> key. 3 4 -- Kill arrow keys, for great justice. 5 vim.keymap.set('n', '<Up>', '<NOP>') 6 vim.keymap.set('n', '<Down>', '<NOP>') 7 vim.keymap.set('n', '<Left>', '<NOP>') 8 vim.keymap.set('n', '<Right>', '<NOP>') 9 10 -- In terminal, C-[ (ESC) is passed through to the terminal by default. 11 -- Remap C-] to return to normal mode like C-[ does by default. 12 vim.keymap.set('t', '<C-]>', '<C-\\><C-n>') 13 14 -- Launch a terminal in a new vertical split, focus it and enter insert mode. 15 vim.keymap.set('n', '<leader>t', 16 '<cmd>vsplit | wincmd l | terminal<CR><cmd>startinsert<CR>', 17 { noremap = true, silent = true }) 18 19 -- Retain selection on <,>. 20 vim.keymap.set('v', '<', '<gv') 21 vim.keymap.set('v', '>', '>gv') 22 23 -- Configure netrw. 24 vim.g.netrw_banner=0 25 vim.g.netrw_liststyle=3 26 vim.keymap.set('n', '<leader>ee', '<cmd>35Lexplore<CR>') 27 vim.keymap.set('n', '<leader>ef', '<cmd>35Lexplore %:p:h<CR>') 28 29 -- Configure fzf-lua. 30 vim.keymap.set('n', '<leader>b', '<cmd>FzfLua buffers<CR>') 31 vim.keymap.set('n', '<leader>fg', '<cmd>FzfLua grep<CR>') 32 vim.keymap.set('n', '<leader>fl', '<cmd>FzfLua live_grep<CR>') 33 vim.keymap.set('n', '<leader>fc', '<cmd>FzfLua builtin commands<CR>') 34 vim.keymap.set('n', '<leader>ff', '<cmd>FzfLua files<CR>') 35 vim.keymap.set('n', '<leader>fr', '<cmd>FzfLua lsp_references<CR>') 36 vim.keymap.set('n', '<leader>fs', '<cmd>FzfLua lsp_document_symbols<CR>') 37 38 -- Toggle diagnostics. 39 vim.keymap.set('n', '<leader>dd', function() 40 vim.diagnostic.enable(not vim.diagnostic.is_enabled()) 41 end, { silent = true }) 42 vim.keymap.set("n", "<leader>qf", vim.diagnostic.setqflist, {silent = true}) 43 44 -- Key mapping to toggle absolute/relative numbering. 45 vim.keymap.set('n', '<leader>n', function() 46 local opt = vim.opt 47 if opt.number:get() == false then 48 opt.number = true 49 elseif opt.relativenumber:get() == false then 50 opt.relativenumber = true 51 else 52 opt.relativenumber = false 53 opt.number = false 54 end 55 end)