Logo

dev-resources.site

for different kinds of informations.

Vim Regex Tricks - Capitalize Every First Letter

Published at
12/2/2024
Categories
vim
neovim
regex
productivity
Author
gokayburuc
Categories
4 categories in total
vim
open
neovim
open
regex
open
productivity
open
Author
10 person written this
gokayburuc
open
Vim Regex Tricks - Capitalize Every First Letter

Capitalize the First Letter of Every Word Using Vim Regex

To capitalize the first letter of each word in a sentence, use the following Vim command:

:s/\<\w/\u&/g
Enter fullscreen mode Exit fullscreen mode

Explanation of the Command

  • :s/ starts the substitution command in Vim, which is used to find a pattern and replace it with a specified value.
  • \< matches the beginning of a word. In Vim, a word is defined as a sequence of letters, digits, or underscores.
  • \w matches any word character (letters, digits, or underscores).
  • \u is a replacement flag in Vim that converts the next character in the replacement string to uppercase.
  • & represents the entire matched text from the search pattern (in this case, the first character of each word).
  • /g applies the substitution globally, ensuring every matching occurrence in the line is processed rather than just the first one.

By running this command, Vim will capitalize the first letter of each word in the specified text.

regex Article's
30 articles in total
Favicon
Here are 7 Regex tools that can save your life from hell πŸ”₯
Favicon
What are the benefits of using bounded quantifiers in regex
Favicon
Understanding Regex in Python: A Practical Example
Favicon
Coding challenge: Design and Implement an Advanced Text Search System
Favicon
Automating Email Validation with Python: A Step-by-Step Tutorial
Favicon
Streaming regex scanner β€” regexpscanner
Favicon
Unraveling the Magic of Regular Expressions: The Ultimate Guide to Mastering Sed, Gawk, and POSIX PatternsπŸš€
Favicon
Masking confidential data in prompts using Regex and spaCy
Favicon
Regular Expressions for Highlighting Comments in PyCharm
Favicon
Regex lookahead
Favicon
Easy to follow Regular Expression Cheatsheet
Favicon
πŸ“ Cross-Post Project Update: Regex, Bug Fixes, and More Regex!
Favicon
How to work with regular expressions
Favicon
Advent of Code 2024 - Day 3: Mull it Over
Favicon
Vim Regex Tricks - Capitalize Every First Letter
Favicon
Finally figured out a whole bunch of Nginx regex. It's more confusing than normal regex somehow
Favicon
From Regex Rampage to Lazy Bliss: My rjq Performance Adventure
Favicon
Regular Expressions
Favicon
Building a Regex Engine in Go: Introducing MatchGo
Favicon
Build up your confidence with Regex: 5 Techniques to make it STICK
Favicon
Mastering Regular Expressions: A Semantic Approach to Regex
Favicon
Regex for a Java Software Engineer
Favicon
Intro to Regular Expressions
Favicon
Intro to Regular Expressions
Favicon
The importance of the environment in Regex pattern matching
Favicon
js / ts - expressΓ£o regular
Favicon
A Guide to Splitting Strings in JavaScript by Regex
Favicon
Taming the Regex Beast: A Beginner's Guide to Regular Expressions
Favicon
The JS string replace() method
Favicon
Learn Enough Regex Without Losing Your Mind

Featured ones: