'vim'可以像'less'一样快地以只读模式打开大文件吗? [英] can 'vim' open a large file in read only mode as fast as 'less'?

查看:30
本文介绍了'vim'可以像'less'一样快地以只读模式打开大文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常使用'less'来浏览日志文件.但是,有时,我需要将vim用于其出色的导航功能.但是,日志文件越大,vim加载它们所花费的时间就越长.少"似乎几乎立即加载了它们.

I usually use 'less' to browse log files. But, sometimes, I need to use vim for its superior navigation facilities. But, the larger the log files, the longer it takes for vim to load them. 'less' seems to load them almost instantly.

使用'vim -R'以只读模式打开无济于事.还有其他可以快速打开vim的大文件的选项吗?请让我知道是否需要其他信息.

Opening in read-only mode using 'vim -R' doesn't help. Are there any other options using which I can open large files with vim quickly? Please let me know if any other information is needed.

推荐答案

尝试在没有插件的情况下启动 vim :

Try starting vim without plugins:

vim -u NONE

您可能还想考虑此处中概述的其他选项.

You might also want to consider other options outlined here.

或者,在打开编辑器之前,请考虑删除日志文件的某些部分.尝试使用 ack 而不是 grep . -Q 选项可使ack将模式视为文字,并且应相当快(类似于 grep -F ).

Alternatively, consider removing portions of log files before opening up in an editor. Try using ack instead of grep. The -Q option makes ack treat the pattern as a literal and should be considerably faster (similar to grep -F).

awk -Q模式巨大文件|vim-

如果您使用的是 UTF-8 语言环境,则使用 LANG = C 前缀上述命令可能会有所帮助.

Prefixing the above command with LANG=C might help if you're using UTF-8 locale.

这篇关于'vim'可以像'less'一样快地以只读模式打开大文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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