Neovim Substitution & Global Commands: Regex-Powered Refactoring | Episode 5

21views
1likes
0
8:14
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
Master search-and-replace at scale in Neovim! In Episode 5, we cover :s substitution with flags (g, c, i, n), regex patterns with capture groups and back-references, :g (global) and :v (inverse global) line operations, and real-world refactoring workflows. Every keystroke is shown on screen with 3-second pauses so you can follow along at your own pace. What You'll Learn: - Substitution basics: :s/old/new/ first match, :%s whole file - Substitution flags: /g all matches, /gc confirm each, /gi case-insensitive, /gn count only - Range substitution: :3,20s/old/new/g — substitute within a line range - Regex capture groups: \(\) captures, \1 back-reference, \| alternation - Case conversion: \u uppercase next character — snake_case to camelCase - Global command: :g/pattern/d — delete all matching lines - Inverse global: :v/pattern/d — keep only matching lines (delete non-matching) - Global move: :g/pattern/m$ — move matching lines to end of file - Global normal: :g/pattern/normal I — apply normal-mode edit to matching lines - Refactoring: rename functions, move imports to top, delete blank lines Timestamps: 0:00 - Introduction 0:15 - What You'll Learn (Preview) 0:45 - Substitution (:s, :%s, /g, /gc, /gi, /gn, regex, capture groups) 3:27 - Global Commands (:g, :v, :g/d, :g/m$, :g/normal) 4:53 - Refactoring (rename, snake→camelCase, move imports, cleanup) 6:14 - Recap: 5 Key Takeaways 7:14 - End Screen Key Takeaways: 1. :s/old/new/ substitutes first match, :%s applies to entire file 2. Flags: /g all matches, /gc confirm, /gi case-insensitive, /gn count 3. \(\) capture groups, \1 back-reference, \u uppercase — regex power 4. :g/pattern/d deletes matching lines, :v is inverse (keeps only matching) 5. :g + normal applies any edit to every matching line This is Episode 5 of the Neovim Tutorial Series. Episode 4 covers visual mode and macros. Next episode covers configuration (init.lua from scratch). Taught by CelesteAI. Like & subscribe for more Neovim tutorials! #neovim #vim #terminal #tutorial #programming #substitution #regex #globalcommands #refactoring #searchandreplace #linux #macos #developer Tags neovim, neovim tutorial, neovim substitution, vim substitution, vim search replace, neovim regex, vim regex, capture groups, back reference, vim global command, neovim global command, vim g command, vim v command, inverse global, refactoring vim, snake case camel case, vim flags, neovim episode 5, learn neovim, learn vim, vim editing, neovim editing, terminal editor, text editor, screenkey, vim patterns, bulk editing, programming tutorial, developer tools, code editor, vim beginners, neovim beginners

Tags

neovimneovim tutorialneovim substitutionvim substitutionvim search replaceneovim regexvim regexcapture groupsback referencevim global commandneovim global commandvim g commandvim v commandinverse globalrefactoring vim
Back to tutorials

Duration

8:14

Published

February 28, 2026

Added to Codegiz

March 15, 2026

Open in YouTube