Neovim for Beginners — Cheatsheet and Coding Assistant
In this article, we will develop a Lua module to help us find code snippets, search for cheatsheets, and learn any programming languages.
This article is part of the Neovim for Beginners series.
The Neovim configuration files are available in this repository.
As developers, we need to learn and code constantly. As Neovim users we want to do it all from within Neovim.
cheat.shprovides unified access to the best community-driven cheatsheets repositories in the world. Using Lua, we can easily integrate it as part of our development workflow to help us learn and code faster.
lua/utils/cht.lua module with the following code snippets.
- We create a vertical split and open a terminal.
- From the terminal, we use
curlto query for cheatsheets.
- We set the file type of the buffer to
after/plugin/autocmds.lua file, we create an auto command to make it easy to exit the cheatsheet window (line 14) by pressing
Which Key Mapping
lua/config/whichkey.lua file, we define a key mapping to invoke the Lua function.