Neovim 101 — Regular Expression
Vim regular expression is powerful but could be challenging for beginners to learn. In this article, we go through several tricks to help us use Vim regular expression.
This article is part of the Neovim 101 series.
The Neovim configuration files are available in this repository.
Getting Started
We will not go through the basics of Vim regular expression. From the Vim documentation, we would suggest reading the followings.
- Search commands and patterns (
:h usr_27.txt
)
- The definition of a pattern (
:h regexp
) - Patterns and search commands (
:h pattern-searches
) - Substitute (
:h :substitute
)
incsearch and hlsearch
hlsearch
and incsearch
are global parameters that highlight all matches as we type. They are on by default in Neovim.
inccommand
For substitution, the inccommand
(:h icm
) option shows the effects of :substitute
, :smagic,
:snomagic
and user commands with the :command-preview
flag as we type.
The possible values for this option are
nosplit
— Shows the effects of a command incrementally in the buffer.split
— Likenosplit
, but also shows partial off-screen results in a preview window.
Notes
- This option is only available for Neovim
- For Vim users, check out the traces.vim plugin