From bee32df567610b374cab920ff21cc02442adc035 Mon Sep 17 00:00:00 2001 From: Nick Burt Date: Mon, 8 Jan 2024 18:36:07 -0600 Subject: [PATCH] create and configure whichkey module --- init.lua | 21 --------------------- lua/plugins.lua | 1 - lua/plugins/whichkey.lua | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 lua/plugins/whichkey.lua diff --git a/init.lua b/init.lua index e16d1b43..aa38724e 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,6 @@ --- Set as the leader key vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- [[ Install `lazy.nvim` plugin manager ]] --- https://github.com/folke/lazy.nvim local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim.fn.system { @@ -16,7 +13,6 @@ if not vim.loop.fs_stat(lazypath) then } end vim.opt.rtp:prepend(lazypath) - require('lazy').setup('plugins'); -- [[ Setting options ]] @@ -272,23 +268,6 @@ local on_attach = function(_, bufnr) end, { desc = 'Format current buffer with LSP' }) end --- document existing key chains -require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, -} --- register which-key VISUAL mode -require('which-key').register({ - [''] = { name = 'VISUAL ' }, - ['h'] = { 'Git [H]unk' }, -}, { mode = 'v' }) - -- mason-lspconfig requires that these setup functions are called in this order -- before setting up the servers. require('mason').setup() diff --git a/lua/plugins.lua b/lua/plugins.lua index df718056..ef1a1c08 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -2,7 +2,6 @@ return { 'tpope/vim-fugitive', 'tpope/vim-rhubarb', 'tpope/vim-sleuth', - { 'folke/which-key.nvim', opts = {} }, { 'numToStr/Comment.nvim', opts = {} }, -- require 'kickstart.plugins.autoformat', diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua new file mode 100644 index 00000000..7dc820a9 --- /dev/null +++ b/lua/plugins/whichkey.lua @@ -0,0 +1,20 @@ +return { 'folke/which-key.nvim', opts = {}, + config = function() + -- document existing key chains + require('which-key').register { + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + } + -- register which-key VISUAL mode + require('which-key').register({ + [''] = { name = 'VISUAL ' }, + ['h'] = { 'Git [H]unk' }, + }, { mode = 'v' }) + end +}