vim中的^ @符号 [英] ^@ symbol in vim

查看:325
本文介绍了vim中的^ @符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  ---< snip> ---以下符号显示了当我在vim中查看我的文件时 -  
^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @
^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ^ @ fstalone
---< snip> -----

我创建的文件是通过重定向我的实用程序的 stdout stderr ,如下所示:# ./my_util> util.log 2>& 1 。这个文件往往会变得相当庞大(〜4 MB)
$ b $ ol

  • 这个符号是什么?

  • 如何摆脱它?
  • 空字符,这种格式(Vim使用了很多,正如你可能注意到的那样)称为。基本上,不知何故,你得到字节充满了零到你的文件。

    因为我们不知道你的工具正在做什么,如果是罪魁祸首,你会如果您想要我们帮助,需要向我们展示一些代码。否则,如果您只想从文件中删除字符,请使用替换:

     %s /< Ctrl-V> ;< Ctrl-J> // g 

    Ctrl-V 标记转义序列的开始。在按下 Ctrl-J 之后,你应该看到 ^ @ 出现在你的命令中。因此,正如你所猜测的, Ctrl-V,Ctrl-J 是空字符的一个转义序列。


    The following symbol shows up when i view my file in vim.

    ---<snip>----
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
    ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@fstalone
    ---<snip>-----
    

    The file that I create is by redirecting stdout and stderr of my utility, like this: #./my_util > util.log 2>&1. This file tend to grow quite huge ( ~4 MB )

    1. What is this symbol?
    2. How to get rid of it?

    解决方案

    That is the null character, in a format (which Vim uses a lot, as you've probably noticed) called caret notation. Basically, somehow you're getting bytes full of zeros into your file.

    Since we don't know what your utility is doing, if it's the culprit, you'll need to show us some code if you want us to help. Otherwise, if you just want to remove the characters from your file, use a substitution:

    %s/<Ctrl-V><Ctrl-J>//g
    

    Ctrl-V marks the beginning of an escape sequence. After pressing Ctrl-J as well, you should see ^@ appear in your command. Thus, as you guessed, Ctrl-V, Ctrl-J is one escape sequence for the null character.

    这篇关于vim中的^ @符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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