Take the 2-minute tour ×

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.

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.

share|improve this question

closed as off topic by Will Jun 24 '13 at 15:50


The issue is most often syntax highlighting and other filetype-specific magic eating up CPU. See vim.wikia.com/wiki/Faster_loading_of_large_files and the linked plugin. –  Benjamin Bannier Jun 24 '13 at 7:17
What superior navigation do you want exactly? less comes with a lot of Vi-like commands like /foo, ?bar, ^F, ^B, ^D, ^U… it even does marks. –  romainl Jun 24 '13 at 8:20
@honk, the link that you have provided is the same one that 'devnull' has given. Is there any other way we can suppress syntax highlighting? –  vrk001 Jun 24 '13 at 8:45
@romainl I was referring to the search related navigation using *, #, [I and %g. Even navigation on the same line when I'm explaining the log contents to a colleague viz. W, B, f, F etc. –  vrk001 Jun 24 '13 at 8:48
@Will, could you please leave some reason as to why you felt it is off topic? In the closed questions' FAQ, I feel it falls into the category : "software tools commonly used by programmers". This is a problem many of my colleagues are facing and we wished to know if there was a way out. Would it be appropriate to ask it else where? –  vrk001 Jun 25 '13 at 9:03

1 Answer 1

up vote 4 down vote accepted

Try starting vim without plugins:

vim -u NONE

You might also want to consider other options outlined here.

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 pattern huge-file | vim -

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

share|improve this answer
-u NONE prevents sourcing your ~/.vimrc. --noplugin is what prevents sourcing plugins. –  romainl Jun 24 '13 at 8:16
Niether -u NONE nor --noplugin has improved the lowest load time across several attempts which is 3.5 seconds for an 871 MB log file. Moreover, I'm getting a syntax error on the ' if ! exists' line when using the vimrc specifed in devnull's link so I couldn't use that. –  vrk001 Jun 24 '13 at 8:57
What error are you getting? What's the version of vim? –  devnull Jun 24 '13 at 9:04
@devnull, my vim version is 7.2.411. The error I am getting is E15: Invalid expression: !exists("my_auto_commands_loaded") –  vrk001 Jun 24 '13 at 9:13
Does your ~/.vimrc contain CR+LF line endings? –  devnull Jun 24 '13 at 9:19
