Member-only story

Neovim for Beginners— Auto Pairs

Configure treesitter-based auto-pairing, auto-tagging, and end-wise completion.

--

Neovim for Beginners — Auto Pairs

In this article, we are going to

  • Configure automated pairings for multiple characters and HTML tags.
  • Configure end-wise completion for Lua.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

Auto Pairs

In the lua/plugins.lua file, add the following lines to install nvim-autopairs.

Create a new file lua/config/autopairs.lua with the following content.

We use treesitter to check for a pair, and also configure the experimental end-wise feature for Lua.

In a previous article, we configured both coq.nvim and nvim-cmp as our completion plugins. nvim-autopairs supports both of them. Here we are going to use nvim-cmp.

For nvim-cmp, add the following lines to lua/config/cmp.lua.

Run the :PackerInstall command to install the plugin.

Now auto pairs feature should work for multiple characters like (, {, ,, etc.

Auto Pairs

For Lua, we should have end-wise completion.

--

--

alpha2phi
alpha2phi

Written by alpha2phi

Software engineer, Data Science and ML practitioner.

No responses yet