vimtricks.wiki Concise Vim tricks, one at a time.

How do I uppercase only the text inside braces using a visual text object?

Answer

f{vi{U

Explanation

When editing structured text, you often need to transform content inside delimiters without touching the delimiters themselves. f{vi{U is a compact pattern that jumps to a brace, selects only the inner block, and applies uppercase to that region.

How it works

  • f{ moves the cursor forward to the next { on the line
  • vi{ enters visual mode and selects the text inside curly braces
  • U uppercases the active visual selection

This is faster and safer than trying to motion-select by character count. Because it uses a text object, it adapts to different content lengths automatically and keeps the braces unchanged.

Example

Before:

config = {alpha beta};

Run:

f{vi{U

After:

config = {ALPHA BETA};

Tips

  • The same approach works with other delimiters, including parentheses and brackets
  • Replace U with other visual operators to reuse the same selection shape for different edits

Next

How do I move the current split into a new tab and immediately jump back to the previous tab?