diff --git a/src/normal.cc b/src/normal.cc index 1019ef46..8e65d9f5 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -849,9 +849,9 @@ void use_selection_as_search_pattern(Context& context, NormalParams params) for (auto& sel : sels) { const auto beg = sel.min(), end = buffer.char_next(sel.max()); - patterns.push_back(format("{}\\Q{}\\E{}", + patterns.push_back(format("{}{}{}", smart and is_bow(buffer, beg) ? "\\b" : "", - buffer.string(beg, end), + escape(buffer.string(beg, end), "^$\\.*+?()[]{}|", '\\'), smart and is_eow(buffer, end) ? "\\b" : "")); }