TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Vim Magic Option

14 点作者 vijaydev超过 15 年前

2 条评论

mcantor超过 15 年前
In addition to useful special characters in search pattern matching, vim can also do some excellent stuff in the second phrase of its substitution statements, as documented in sub-replace-special: <a href="http://vimdoc.sourceforge.net/htmldoc/change.html#sub-replace-special" rel="nofollow">http://vimdoc.sourceforge.net/htmldoc/change.html#sub-replac...</a><p>I find \U, \L and \E to be most useful, for example:<p><pre><code> :%s/ALL_CAPS_\(.*\)_HUZZAH/SOME_LOWERCASE_\L\1\E_HUZZAH/g </code></pre> Will translate "ALL_CAPS_IS_GREAT_HUZZAH" to "SOME_LOWERCASE_is_great_HUZZAH". Super handy in certain situations.<p>It's also worth noting that these "magic" settings affect :s, :g, / and ?.
grogers超过 15 年前
But is there any way to set the "very magic" option in your .vimrc so you don't have to type \v every time you want to avoid a barrage of backslashes?
评论 #906181 未加载