sponsor Vim development Vim logo Vim Book Ad

yaifa.vim : Yet Another Indent Finder, Almost...

 script karma  Rating 44/14, Downloaded by 848    Comments, bugs, improvements  Vim wiki

created by
Israel Chauca Fuentes
 
script type
utility
 
description
NOTE: This update makes the start-up way faster, sorry for the previous behaviour.

This plug-in will automatically try to detect the kind of indentation in your file and set Vim's options to keep it that way. It recognizes three 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.

The values of 'expandtab' and 'shiftwidth' set in your vimrc will be used as the default values.

Use :YAIFAMagic to manually detect and set the indenting settings for the current file, it'll also echo the found settings.

You can set yaifa_max_lines to customize the max number of lines that will be scanned:

    let yaifa_max_lines = 4096

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
Place the file in your ~/.vim/plugin/ folder.
 

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.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: 54.196.167.69

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.
   
SourceForge.net Logo