local wk = require('which-key') vim.opt.timeout = true vim.opt.timeoutlen = 500 wk.register({ ['-'] = { 'FloatermNew nnn', 'invoke floaterm with nnn as file picker' }, [';'] = { ':', 'Colon with semicolon' }, [''] = { 'checktimeredraw!', 'redraw/reload with F5' }, [''] = { 'blast', 'buffer navigation with arrow keys' }, [''] = { 'bprevious', 'buffer navigation with arrow keys' }, [''] = { 'bnext', 'buffer navigation with arrow keys' }, [''] = { 'bfirst', 'buffer navigation with arrow keys' }, ['¬'] = { '>>', 'bubbling lines with alt-hjkl', noremap = false }, ['˙'] = { '<<', 'bubbling lines with alt-hjkl', noremap = false }, ['˚'] = { ':move .-2', 'bubbling lines with alt-hjkl', noremap = false }, ['∆'] = { ':move .+1', 'bubbling lines with alt-hjkl', noremap = false }, g = { name = 'code-related mappings', -- for more code-mappings: see treesitter.lua D = { 'lua vim.lsp.buf.declaration()', 'show/go to declaration' }, I = { 'lua vim.lsp.buf.implementation()', 'show/go to implementation' }, L = { 'lua vim.lsp.buf.references()', 'show/go to referennces' }, a = { 'lua vim.lsp.buf.code_action()', 'run code action' }, b = { 'Gitsigns blame_line', 'git blame line' }, e = { 'lua vim.diagnostic.goto_next()', 'go to next error in file' }, f = { 'lua vim.lsp.buf.format()', 'format file with LSP' }, h = { 'lua vim.lsp.buf.hover()', 'show hover info' }, x = { 'execute "/\\v^[<\\|=>]{7}/"', 'find git conflicts in file' }, }, K = { '', 'K man-pages mapping removed' }, N = { 'Nzzzv', 'kepping it centered with N' }, Q = { '', 'Q ex-mode-mapping removed' }, S = { function() require('flash').treesitter() end, 'flash treesitter select' }, j = { 'gj', 'j and k with wrapped lines' }, k = { 'gk', 'j and k with wrapped lines' }, n = { 'nzzzv', 'kepping it centered with n' }, s = { function() require('flash').jump() end, 'flash jump' }, v = { '', 'remapping visual/visual-block mode' }, -- with as modifier [''] = { 'NavigatorLeft', 'move to the lefthand split' }, [''] = { 'NavigatorDown', 'move to the rigthand split' }, [''] = { 'NavigatorUp', 'move to the upper split' }, [''] = { 'NavigatorRight', 'move to the lower split' }, }) -- all normal mode leader key mappings in one place wk.register({ [','] = { 'Telescope find_files', 'find files' }, ['-'] = { 'sj', 'Horizontal split' }, ['.'] = { 'Telescope buffers', 'find buffers' }, ['/'] = { 'Telescope search_history', 'find in search history' }, [';'] = { 'Telescope command_history', 'find in command history' }, ['\''] = { 'Telescope git_files', 'find in git files' }, ['\\'] = { 'vl', 'Vertical split' }, [']'] = { 'Telescope current_buffer_fuzzy_find', 'find line in current buffer' }, a = { 'Telescope live_grep', 'live ripgrep' }, b = { 'Telescope git_branches', 'git branches' }, c = { 'Telescope git_bcommits', 'commits for buffer' }, f = { 'Spectre', 'open spectre for search/replace' }, l = { 'FloatermNew lazygit', 'open lazygit' }, t = { 'FloatermNew', 'open new terminal' }, v = { name = 'vim related', e = { 'e $MYVIMRC', 'edit vimrc' }, r = { 'source $MYVIMRC', 'source vimrc' }, }, w = { 'set wrap! wrap?', 'toggle line-wrapping' }, }, { prefix = '' }) -- visual-mode mappings wk.register({ [';'] = { ':', 'Colon with semicolon' }, ['¬'] = { '>gv', 'bubbling lines with alt-hjkl', noremap = false }, ['˙'] = { 'gv", 'bubbling lines with alt-hjkl', noremap = false }, ['∆'] = { ":move '>+1gv", 'bubbling lines with alt-hjkl', noremap = false }, v = { '', 'remapping visual/visual-block mode' }, }, { mode = 'v' }) -- insert-substitute-mode mappings for snippets wk.register({ [''] = { 'vsnip#available(1) ? "(vsnip-expand-or-jump)" : ""', 'snippet expansion' }, }, { mode = 'i', expr = true, noremap = true }) wk.register({ [''] = { 'vsnip#available(-1) ? "(vsnip-jump-prev)" : ""', 'snippet expansion' }, }, { mode = 's', expr = true, noremap = true })