简体   繁体   English

viminfo 中的标记格式

[英]Format of marks in viminfo

I'm trying to find information on how file marks are stored in the 'viminfo' file.我正在尝试查找有关文件标记如何存储在'viminfo'文件中的信息。 For example, here is an entry I have:例如,这是我的一个条目:

'0  3  11  ~/.vim/hello
|4,48,3,11,1592944829,"~/.vim/hello"

The only obvious things from the above seem to be the filepath the mark is saved, ~/.vim/hello and the timestamp it was created 1592944829 .上面唯一明显的事情似乎是保存标记的文件路径~/.vim/hello和它创建的时间戳1592944829 What are the other items, and why are some of the items listed multiple times (3, 11, filename).其他项目是什么,为什么有些项目被多次列出(3、11、文件名)。

you are reading the wrong block.您正在阅读错误的内容。

In the viminfo file, search for the lines beginning with > , they are mark histories.viminfo文件中,搜索以>开头的行,它们是标记历史记录。

And there is usually comment in the file.文件中通常有注释。

For example:例如:

# History of marks within files (newest to oldest):

> /tmp/test/whatevertestfile.txt
    *   1592998167  0
    "   4   0
    ^   1   0
    .   1   0
    +   1   0
    a   4   0
    b   9   0

update更新

Oh, I just noticed you mentioned file marks in the question.哦,我刚刚注意到您在问题中提到了文件标记。 Then you are looking at the right block.然后,您正在查看正确的块。

The positions in the two lines are always the same because the write_one_filemark() function reads the same values for the two lines.两行中的位置始终相同,因为write_one_filemark() function 读取两行的相同值。

  • The first 4 is an index in the viminfo file, it indicates the mark type.4是 viminfo 文件中的索引,它表示标记类型。
  • The 48 is the ascii code of the numbered mark 0 . 48是编号标记0的 ASCII 码。
  • Then come the position + ts + filename然后是 position + ts + 文件名

If you want to know more detailed, why it is so defined and so on, you can read the related part of this file https://github.com/vim/vim/blob/master/src/viminfo.c如果想更详细的了解,为什么这么定义等等,可以阅读这个文件的相关部分https://github.com/vim/vim/blob/master/src/viminfo.c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM