From 74f0bf214f17e8cedf75e7504ca7a8abfebd4bca Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Sun, 18 Sep 2022 11:07:25 +0530 Subject: nvim which-key config --- .config/nvim/init.lua | 1 + .config/nvim/lua/justsaumit/keymaps.lua | 8 ++++---- .config/nvim/lua/justsaumit/plugins.lua | 2 ++ .config/nvim/lua/justsaumit/which-key-config.lua | 9 +++++++++ .config/nvim/plugin/packer_compiled.lua | 5 +++++ 5 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 .config/nvim/lua/justsaumit/which-key-config.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index fdd446d..e6343da 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -8,4 +8,5 @@ require("justsaumit.bufferline-config") require("justsaumit.nvim-tree-config") require("justsaumit.lastplace-config") require("justsaumit.autopairs") +require("justsaumit.which-key-config") print ("while(!(succeed = try() ) );") diff --git a/.config/nvim/lua/justsaumit/keymaps.lua b/.config/nvim/lua/justsaumit/keymaps.lua index 8d9b31b..2a29f46 100644 --- a/.config/nvim/lua/justsaumit/keymaps.lua +++ b/.config/nvim/lua/justsaumit/keymaps.lua @@ -28,10 +28,10 @@ keymap("n", "", "k", opts) keymap("n", "", "l", opts) -- Resize with arrows -keymap("n", "", ":resize -2", opts) -keymap("n", "", ":resize +2", opts) -keymap("n", "", ":vertical resize -2", opts) -keymap("n", "", ":vertical resize +2", opts) +keymap("n", "", ":resize +2", opts) +keymap("n", "", ":resize -2", opts) +keymap("n", "", ":vertical resize +2", opts) +keymap("n", "", ":vertical resize -2", opts) -- Move text up and down keymap("n", "", ":m .+1==gi", opts) diff --git a/.config/nvim/lua/justsaumit/plugins.lua b/.config/nvim/lua/justsaumit/plugins.lua index b1d73fc..8c075ec 100644 --- a/.config/nvim/lua/justsaumit/plugins.lua +++ b/.config/nvim/lua/justsaumit/plugins.lua @@ -60,6 +60,8 @@ return packer.startup(function(use) use {'akinsho/bufferline.nvim', tag = "v2.*", requires = 'kyazdani42/nvim-web-devicons'} --Nvim-tree File explorer for nvim use {'kyazdani42/nvim-tree.lua', requires = { 'kyazdani42/nvim-web-devicons'}} +--Whick-key - displays a popup with possible key bindings + use {'folke/which-key.nvim'} --HTML use 'windwp/nvim-ts-autotag' --cmp diff --git a/.config/nvim/lua/justsaumit/which-key-config.lua b/.config/nvim/lua/justsaumit/which-key-config.lua new file mode 100644 index 0000000..11bb49c --- /dev/null +++ b/.config/nvim/lua/justsaumit/which-key-config.lua @@ -0,0 +1,9 @@ +local wk = require("which-key") +local mappings = { + q = {":q", "Quit"}, + Z = {":wq", "Save and Quit"}, + w = {":w", "Save"}, + x ={":bdelete", "Close"} +} +local opts = {prefix = ''} +wk.register(mappings, opts) diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index adb17a6..2c4489e 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -138,6 +138,11 @@ _G.packer_plugins = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", url = "https://github.com/folke/tokyonight.nvim" + }, + ["which-key.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/which-key.nvim", + url = "https://github.com/folke/which-key.nvim" } } -- cgit v1.2.3