local wk = require('which-key') local map = vim.keymap.set wk.setup({ replace = { key = { { '', '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.add({ { '', 'NERDTreeToggle', desc = 'Toggle NERDTree' }, { '', 'Telescope find_files theme=dropdown', desc = 'Find file in current directory' }, { '/', 'Telescope live_grep', desc = 'Search current directory' }, -- File { 'fl', 'NERDTreeFind', desc = 'Show in NERDTree' }, -- Window { '"', 'split', desc = 'Split horizontally' }, { '%', 'vsplit', desc = 'Split vertically' }, }) -- wk.register({ -- [''] = { 'Telescope find_files theme=dropdown', '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 theme=dropdown', 'Find file' }, -- F = { 'Telescope find_files theme=dropdown', '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' }, -- p = { 'Git push -u origin head', 'Push' }, -- P = { 'Git push -u origin head --force-with-lease', 'Push (force with lease)' }, -- f = { -- name = 'fetch', -- o = { 'Git fetch origin', 'origin' }, -- u = { 'Git fetch upstream', 'upstream' }, -- }, -- r = { -- name = 'rebase', -- o = { 'Git rebase origin/main', 'origin/main' }, -- O = { 'Git rebase --interactive origin/main', '-i origin/main' }, -- u = { 'Git rebase upstream/main', 'upstream/main' }, -- U = { 'Git rebase --interactive upstream/main', '-i upstream/main' }, -- } -- }, -- i = { -- name = 'insert', -- e = { 'Telescope emoji theme=dropdown', 'emoji' }, -- }, -- }, { prefix = '' })