sponsor Vim development Vim logo Vim Book Ad

yaifa : Yet another indent finder, almost...

 script karma  Rating 71/23, Downloaded by 2607  Comments, bugs, improvements  Vim wiki

created by
Israel Chauca Fuentes
script type
This plug-in will try to detect the kind of indentation used in your file and
set the indenting options to the appropriate values. It recognizes the
following types of indentation:

1. Space: Only spaces are used to indent.
2. Tab: Only tabs are used.
3. Mixed: A combination of tabs and space is used. e.g.: a tab stands for 8
    spaces, but each indentation level is 4 spaces.

In order to guess the indentation of the buffer, it looks for increments in
the indentation level and into the involved lines to see the type of
indentation and the number of spaces of the change.  The type of indentation
with the most lines is used to set the options.

If Yaifa ever guesses wrong indentation, send me immediately a mail, if
possible with the offending file, or open an issue on GitHub.

This script started as a port to VimL from Philippe Fremy's Python script
Indent Finder (vimscript#513), hence the "Almost" part of the name.
install details
Extract the files under ~/.vim

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
yaifa.tar.gz 2.1 2018-11-10 7.0 Israel Chauca Fuentes Fix some logic and add support for NeoVim
yaifa.tar.gz 2.0 2018-10-12 7.0 Israel Chauca Fuentes - Script was rewritten and it is 67% faster than previous version and more accurate.
- Added documentation.
- Renamed :YAIFAMagic to :Yaifa
- Added several configuration variables.
yaifa.vim 1.3 2010-08-17 6.0 Israel Chauca Fuentes - Add missing variable.
- Stop defining all function on every run.
yaifa.vim 1.2 2010-08-16 6.0 Israel Chauca Fuentes - Reduce max number of lines to be scanned by default, it was set too high, which made the start-up slow.
- Set 'tabstop' to 8 with 'expandtab'.
- Use 'expandtab' and 'shiftwidth' to set default indenting values.
yaifa.vim 1.1 2010-05-23 6.0 Israel Chauca Fuentes - Float calculations eliminated for better compatibility.
- Command added.
yaifa.vim 1.0 2010-05-20 6.0 Israel Chauca Fuentes Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.