Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Find and Replace Text in 1 or More Files Using Vim, fzf and ripgrep


In this video we'll cover a bunch of different find / replace use cases ranging from simple word searches to regular expressions.

Quick Jump: Demo Video Showing Everything

Vim is a great editor and over the months I’ve configured a number of custom mappings and plugins to help me find and replace text in a number of different ways.

In this video, we’ll go over how to set things up so you can:
  • Find and jump to a word in a line
  • Find and cycle through word matches in the current file
  • Find and cycle through visual selection matches in the current file
  • Find and cycle through regular expression matches in the current file
  • Find any word, visual selection or regexp match in the current directory
  • Replace a word, visual selection or regexp match in the current visual selection
  • Replace a word, visual selection or regexp match in the current file
  • Perform a multiple cursors style replace, but without using multiple cursors
  • Replace a word, visual selection or regexp match in the current directory

Basically we’ll cover close to every possible find / replace use case you’ll encounter while doing some programming work or writing. Everything will be accessible with easy to remember mappings or short commands and searching will be lightning fast.

Demo Video Showing Everything

Timestamped Table of Contents

  • 0:55 – Cloning an example project to work with
  • 1:43 – Finding or jumping to a word on a single line
  • 3:25 – Finding a term in the current file
  • 4:57 – Automatically clearing search highlights on cursor move
  • 6:37 – Manually replacing text in the current file
  • 7:33 – Using the star mapping to search a word under your cursor
  • 7:54 – Replacing the last searched word using a custom mapping
  • 10:45 – Using the visual star plugin to search for any selected term
  • 11:59 – Replacing any selected term using a custom mapping
  • 13:31 – Replacing text inside of a visual selection
  • 14:48 – A multiple cursors alternative in Vim
  • 18:28 – Custom key mapping to quickly replace near by text
  • 19:53 – Finding terms in multiple files based on where you opened Vim
  • 21:33 – Opening search results in vsplits, splits or tabs
  • 22:42 – Opening multiple search results at once
  • 23:22 – Seeing real time search results when finding text in multiple files
  • 24:02 – Filtering multiple file search results by file type
  • 24:48 – Finding files, viewing git commits and more with the fzf.vim plugin
  • 26:50 – Installing and configuring fzf
  • 28:26 – Installing and configuring fzf.vim
  • 30:26 – Installing and configuring ripgrep to work with fzf and fzf.vim
  • 32:41 – Finding and replacing text in multiple files with vim-grepper
  • 35:42 – Finding and replacing a phrase or regexp in multiple files
  • 39:15 – Installing and configuring the vim-grepper plugin
  • 40:48 – Running vim-grepper manually for more complex find / replace

What do you do to solve finding and replacing text? Let me know below!

Never Miss a Tip, Trick or Tutorial

Like you, I'm super protective of my inbox, so don't worry about getting spammed. You can expect a few emails per month (at most), and you can 1-click unsubscribe at any time. See what else you'll get too.