local function map(mode, combo, mapping, opts) local options = {noremap = true} if opts then options = vim.tbl_extend('force', options, opts) end vim.api.nvim_set_keymap(mode, combo, mapping, options) end vim.g.mapleader = ' ' -- Navigate through panes using lead key and vim direction map('', 'h', ':wincmd h') map('', 'j', ':wincmd j') map('', 'k', ':wincmd k') map('', 'l', ':wincmd l') -- Create splits and tabs map('', 'v', ':vsp') map('', 'b', ':sp') map('', 'W', ':tabnew') -- Move to tab using lead key plus number map('', '1', '1gt') map('', '2', '2gt') map('', '3', '3gt') map('', '4', '4gt') map('', '5', '5gt') map('', '6', '6gt') map('', '7', '7gt') map('', '8', '8gt') map('', '9', '9gt') map('', '0', '10gt') -- Open undotree panel map('', 'u', ':UndotreeToggle') -- Open lazy.nvim map('', 'p', ':Lazy home') --- Telescope --- -- List project files vim.keymap.set('', '', function() require("telescope-config").project_files() end) -- Grep through files in project vim.keymap.set('', '', ":Telescope live_grep") --- Miscellaneous -- Toggle line wrap vim.keymap.set('', 'w', function() vim.cmd("set wrap! linebreak! nolist!") end) -- Format markdown tables map('', 't', ":TableFormat") -- Open lazy.nvim menu map('', 'lh', ":Lazy home") -- Allow transparent scrolling through wrapped lines vim.api.nvim_set_keymap("n", "k", "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true }) vim.api.nvim_set_keymap("n", "j", "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true })