从 .viminfo 文件中清除某些条件 [英] Clear certain criteria from .viminfo file

查看:36
本文介绍了从 .viminfo 文件中清除某些条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从我的 .viminfo 文件中清除某些条件?

How can I clear certain criteria from my .viminfo file?

我想清除命令行历史、文件标记、跳转列表等

I want to clear the command line history, file marks, jumplist, etc.

但是,我想保留搜索字符串历史记录.

However, I want to keep the search string history.

有没有办法做到这一点?

Is there any way to do this?

推荐答案

我能想到 3 种方法来做到这一点.

I can think of 3 ways to do this.

  1. 运行 Vim,

  1. Run Vim,

类型::set viminfo='0,:0,<0,@0,f0

  • '0 表示不会保存标记
  • :0 表示不保存命令行历史
  • <0 表示不会保存寄存器
  • @0 表示不会保存输入行历史
  • f0 表示不会保存标记
  • no % 表示不会保存缓冲区列表
  • no / 表示保存搜索历史
  • '0 means that marks will not be saved
  • :0 means that command-line history will not be saved
  • <0 means that registers will not be saved
  • @0 means that input-line history will not be saved
  • f0 means that marks will not be saved
  • no % means that the buffer list will not be saved
  • no / means that the search history will be saved

这些选项在 Vim 7.2 中是正确的,但在其他版本中可能会有所不同.有关 viminfo 字符串格式的更多详细信息,请运行 :h 'viminfo'

These options are correct in Vim 7.2, but might be different in other versions. For more details on the format of the viminfo string, run :h 'viminfo'

退出 Vim.它将保存一个新版本的 .viminfo 文件,其中只包含您想要保留的信息.

Quit Vim. It will save a new version of the .viminfo file, containing only the information you want to keep.

2.手动

  1. 在vim中打开.viminfo文件,

  1. Open the .viminfo file in vim,

:set viminfo= 关闭自动保存信息到 .viminfo 文件.如果你不这样做,Vim 会在你退出时覆盖你所有的更改,

:set viminfo= to turn off the auto-saving of info to the .viminfo file. If you don't do this, Vim will overwrite all your changes when you quit,

删除您不想要的所有内容(也许可以使用 Johnsyweb 的回答,或者只是通过手动编辑命令删除行),保存文件,然后退出 vim,

Remove everything you don't want (perhaps by using Johnsyweb's answer, or just by deleting the lines with manual edit commands), save the file, and quit vim,

3.在不同的编辑器中

不同的文本编辑器中编辑 .viminfo 文件,然后删除您不想要的所有内容,

3. In a different editor

Edit the .viminfo file in a different text editor and simply delete everything you don't want,

这篇关于从 .viminfo 文件中清除某些条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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