Skip to content

vim-scripts/IndentConsistencyCopAutoCmds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1691

DESCRIPTION
The autocmds in this script automatically trigger the IndentConsistencyCop for
certain, configurable filetypes (such as c, cpp, html, xml, ... which
typically contain lots of indented lines) once when you load the file in Vim,
and/or on every write of the buffer.
The entire buffer will be checked for inconsistent indentation, and you will
receive a report on its findings. With this automatic background check, you'll
become aware of indentation problems before you start editing and/or when
writing. This prevents you from accidentally introducing an inconsistency with
your edits.

USAGE
Triggering happens automatically; by default, when a buffer is opened for the
first time, both the compatibility of the file's indent with the buffer
settings and its internal consistency are checked; on each subsequent save,
the latter check is repeated.
Of course, you can still manually execute the :IndentConsistencyCop command
to re-check the buffer at any time.

For very large files, the check may take a couple of seconds. You can abort
the script run with CTRL-C, like any other Vim command.

If you chose to "Ignore" any inconsistent indents in the IndentConsistencyCop
report, further automatic invocations on buffer writes are suspended. It is
assumed that you don't bother for this particular file. You can re-enable
automatic invocations by manually invoking :IndentConsistencyCop once and then
choosing an option other than "Ignore".

:IndentConsistencyCopAutoCmdsOff
:IndentConsistencyCopAutoCmdsOn
                        Disable / re-enable the autocommands. This affects all
                        existing buffers as well as any newly opened files.