Vim:\n 与 \r [英] Vim: \n vs. \r

查看:31
本文介绍了Vim:\n 与 \r的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段时间没有在 Unix 系统中使用 vim,但我记得没有 \r,它总是 \n.

I haven't used vim in a Unix system in a while, but as I recall there was no \r, it was always \n.

我在windows下使用gVim,当我搜索换行符时,我使用\n.搜索 \r 不返回任何内容.但是当我替换 字符时,我必须使用\r.\n 给我 ^@

I'm using gVim under windows and when I search for new line characters I use \n. Searching for \r returns nothing. But when I replace the characters I have to use \r's. \n's give me ^@

谁能解释一下这里发生了什么?

Can anyone explain what's going on here?

推荐答案

查找:

:set fileformat=unix
:set fileformat=dos

这可以在任一平台上使用以切换到其他编码.

This can be used on either platform to switch to the other encoding.

这篇关于Vim:\n 与 \r的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆