本文介绍了为什么 是 Vim 的换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
来自问题 如何替换一个Vim 中的换行符?.为换行符替换文本时必须使用 ,就像这样
From question How to replace a character for a newline in Vim?. You have to use when replacing text for a newline, like this
:%s/%/
/g
但是当替换一个字符的行尾和换行符时,你可以这样做:
But when replacing end of lines and newlines for a character, you can do it like:
:%s/
/%/g
手册的哪一部分记录了这些行为,其背后的原因是什么?
What section of the manual documents these behaviors, and what's the reasoning behind them?
推荐答案
来自 vim模式文档:
匹配
匹配行尾 -在字符串中匹配而不是缓冲文本文字换行符字符匹配.
matches an end-of-line - When matching in a string instead of buffer text a literal newline character is matched.
这篇关于为什么 是 Vim 的换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!