keymaps.lua (1666B)
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, ESC returns to normal mode. 11 vim.keymap.set('t', '<Esc>', '<C-\\><C-n>') 12 13 -- Retain selection on <,>. 14 vim.keymap.set('v', '<', '<gv') 15 vim.keymap.set('v', '>', '>gv') 16 17 -- Configure netrw. 18 vim.g.netrw_banner=0 19 vim.g.netrw_liststyle=3 20 vim.keymap.set('n', '<leader>ee', '<cmd>35Lexplore<CR>') 21 vim.keymap.set('n', '<leader>ef', '<cmd>35Lexplore %:p:h<CR>') 22 23 -- Configure fzf-lua. 24 vim.keymap.set('n', '<leader>b', '<cmd>FzfLua buffers<CR>') 25 vim.keymap.set('n', '<leader>fg', '<cmd>FzfLua grep<CR>') 26 vim.keymap.set('n', '<leader>fl', '<cmd>FzfLua live_grep<CR>') 27 vim.keymap.set('n', '<leader>fc', '<cmd>FzfLua builtin commands<CR>') 28 vim.keymap.set('n', '<leader>ff', '<cmd>FzfLua files<CR>') 29 vim.keymap.set('n', '<leader>fr', '<cmd>FzfLua lsp_references<CR>') 30 vim.keymap.set('n', '<leader>fs', '<cmd>FzfLua lsp_document_symbols<CR>') 31 32 -- Toggle diagnostics. 33 vim.keymap.set('n', '<leader>dd', function() 34 vim.diagnostic.enable(not vim.diagnostic.is_enabled()) 35 end, { silent = true }) 36 vim.keymap.set("n", "<leader>qf", vim.diagnostic.setqflist, {silent = true}) 37 38 -- Key mapping to toggle absolute/relative numbering. 39 vim.keymap.set('n', '<leader>n', function() 40 local opt = vim.opt 41 if opt.number:get() == false then 42 opt.number = true 43 elseif opt.relativenumber:get() == false then 44 opt.relativenumber = true 45 else 46 opt.relativenumber = false 47 opt.number = false 48 end 49 end)