Mercurial > vim
view runtime/indent/make.vim @ 574:25a70b1cd2da
updated for version 7.0163
author | vimboss |
---|---|
date | Tue, 06 Dec 2005 19:59:18 +0000 |
parents | f14cbd913415 |
children | 1f3b1021f002 |
line wrap: on
line source
" Vim indent file " Language: Makefile " Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se> " Latest Revision: 2005-06-29 if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetMakeIndent() setlocal indentkeys=!^F,o,O if exists("*GetMakeIndent") finish endif function s:GetStringWidth(line, str) let end = matchend(a:line, a:str) let width = 0 for c in a:line if c == "\t" let width += &ts - (width % &ts) else let width += 1 endif endfor return width endfunction function GetMakeIndent() let lnum = v:lnum - 1 if lnum == 0 return 0 endif let line = getline(lnum) if line == '' return 0 elseif line =~ '^[^ \t#:][^#:]*:\{1,2}\%([^=:]\|$\)' return indent(lnum) + &ts elseif line =~ '^\s*\h\w*\s*+\==\s*.\+\\$' return s:GetStringWidth(line, '+\==\s*') endif endfunction