local wk = require('which-key') local map = vim.keymap.set vim.cmd([[ augroup keys_user_config autocmd! autocmd BufWritePost keys.lua source augroup end ]]) wk.setup({ key_labels = { [''] = 'SPC', [''] = 'RET', [''] = 'TAB' } }) vim.opt.timeoutlen = 500 vim.g.mapleader = ' ' -- Handy to remap semi-colon to colon map({ 'n', 'v' }, ';', ':') map({ 'n', 'v' }, 'q;', 'q:') -- System clipboard via -> y | p map({ 'n', 'v' }, 'y', '"+y') map( 'n', 'Y', '"+Y') map({ 'n', 'v' }, 'p', '"+p') map({ 'n', 'v' }, 'P', '"+P') -- Common short-hands map('n', 'w', 'w') map('n', 'q', 'q') map('n', 'o', 'only') map('n', '', 'nohlsearch') wk.register({ [''] = { 'Telescope find_files', 'File file in project' }, ['/'] = { 'Telescope live_grep', 'Search project' }, [''] = { 'NERDTreeToggle', 'Toggle NERDTree' }, f = { name = 'file', e = { 'Telescope find_files cwd=~/.config/nvim', 'Find file in .config/nvim' }, E = { 'e ~/.config/nvim', 'Browse .config/nvim' }, f = { 'Telescope find_files cwd=~/ hidden=true no_ignore=true no_ignore_parent=true follow=true', 'Find file' }, F = { 'Telescope find_files', 'File file from here' }, l = { 'NERDTreeFind', 'Locate file' }, r = { 'Telescope oldfiles', 'Recent files' }, }, e = { name = 'editor', p = { name = 'packer', s = { 'PackerSync', 'Packer Sync' }, c = { 'PackerCompile', 'Packer Compile' }, l = { 'PackerClean', 'Packer Clean' }, } }, g = { name = 'git', s = { 'Git', 'Status' }, f = { 'Git fetch', 'Fetch' }, p = { 'Git push --force-with-lease -u origin head', 'Push' }, r = { name = 'rebase', m = { 'Git rebase origin/main', 'origin/main' }, M = { 'Git rebase --interactive origin/main', 'Interactive origin/main' } } }, }, { prefix = '' })