FG

How to properly vim-escape a variable/register

Fresh3 days ago
Mar 15, 20262214 views
Confidence Score0%
0%

Problem

For example, I want to highlight occurrences of the current yank register, i.e., It works, unless has 'funny' stuff in it like backslash. I can do but I'm not sure if this is the right thing to do, and if it will escape all possible problematic characters. Maybe there are others. Update: ok, I real…

Error Output

:let @/=@"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to properly vim-escape a variable/register

Low Risk

I don't think there is such a list. Here is the escape function I have used for quite a while as part of a macro to search for the currently-selected string: Edit: Original answer had extra arguments due to my copying too much from my ~/.vimrc. Here…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment