Neovim for Beginners — Key Mappings and WhichKey

Configure key mappings and the WhichKey plugin.

alpha2phi
3 min readDec 28, 2021
Neovim for Beginners — Key Mappings and WhichKey

We are going to configure a few sensible default key mappings and set up the WhichKey plugin that displays a popup with possible key bindings of the command we type.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

Key Mappings

Let’s configure a few sensible key mappings using the Neovim Lua API (:h nvim_set_keymap).

Note: Check out this article for the Lua keymap APIs (:h lua-keymap).

Create a file called keymaps.lua under theafter/plugin folder.

Remember that both .vim and .lua files are loaded automatically from the runtimepath (:h rtp, :h load-plugins). Vimscript files are sourced before Lua files.

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.