How do I open a file in Vim without triggering any autocmds for faster loading?
Answer
:noautocmd e {file}
Explanation
When you have heavy autocmds registered for BufRead, BufEnter, or FileType events — such as LSP clients, formatters, or syntax processors — opening a large or binary file can be slow. Prefixing :e with :noautocmd skips all autocmd processing for that operation, giving you instant access to the file.
How it works
:noautocmdis a command modifier that suppresses all autocmd events for the next command:noautocmd e {file}opens the file without firingBufRead,BufEnter,FileType, or any other autocmds- The file is loaded into the buffer, but syntax highlighting, LSP attachment, and other plugin hooks are skipped
Example
Opening a 50,000-line log file with heavy LSP autocmds:
:noautocmd e /var/log/massive.log
Instead of waiting seconds for LSP to index it, the file opens immediately. You can still navigate and search normally.
Tips
- Works with any Ex command:
:noautocmd r filereads without autocmds,:noautocmd wwrites without triggeringBufWritePreformatters - To re-apply autocmds after opening (e.g. to activate syntax):
:doautocmd BufRead - Useful in scripts when you need to edit files in bulk without triggering heavy processing on each:
:noautocmd bufdo %s/old/new/g | update - Does not permanently disable autocmds — only for the single command it modifies