sponsor Vim development Vim logo Vim Book Ad

genindent.vim : Generic function for indentexpr

 script karma  Rating 13/4, Downloaded by 2054  Comments, bugs, improvements  Vim wiki

created by
moshe kamensky
 
script type
indent
 
description
This is a function meant to deal with a simple case of indentation:
The assumption is that you have blocks whose begining and end can be identified by a pattern. In this case, you just set b:indent_block_start and b:indent_block_end to these patterns, and the function returns the indent of a line based on the assumption that all lines within a block should be indented by one shiftwidth. It is also possible to ignore lines matching a certain pattern (e.g., comments) using a third variable b:indent_ignore. For an example, see the fluxbox indent file (vimscript #679).
 
install details
Put this in the plugin subdir of your favorite part in the runtimepath (e.g., ~/.vim/plugin). Alternatively, put it somewhere else and source it from an indent file where you'd like to use it.
 

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
genindent.vim 1.1 2009-07-01 6.0 moshe kamensky Fixed = to == (thanks to Kenny Root)
genindent.vim 1.0 2003-06-15 6.0 moshe kamensky Initial upload
ip used for rating: 18.217.67.16

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.
   
Vim at Github