vim中的^ @符号 [英] ^@ symbol in vim
问题描述
---< snip> ---以下符号显示了当我在vim中查看我的文件时 -
^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @
^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ ^ @ fstalone
---< snip> -----
我创建的文件是通过重定向我的实用程序的 stdout
和 stderr
,如下所示:# ./my_util> util.log 2>& 1
。这个文件往往会变得相当庞大(〜4 MB)
$ b $ ol
因为我们不知道你的工具正在做什么,如果是罪魁祸首,你会如果您想要我们帮助,需要向我们展示一些代码。否则,如果您只想从文件中删除字符,请使用替换:
%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 )
- What is this symbol?
- 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屋!