[ale] indent script problems

Allan Neal allanneal at bellsouth.net
Mon Dec 6 16:47:18 EST 2004


On Mon, Dec 06, 2004 at 04:24:27PM -0500, Geoffrey wrote:
> Allan Neal wrote:
> >I got some help after a long wait on the vim list and was able to
> >solve me problem.  Thanks
> 
> Please do share the solution with the list.

" File Name: ledger.vim (indent file)
" Maintainer: Allan Neal
" Original Date: 04/12/04 10:55:20 
" Last Update: 06/12/04 14:55:12 
" Description: Indent the ledger file the in compliance with the ledger syntax
" highlighting file.  Entry is flush left and all accounts are indented one ts

" Only load of no other is loaded
if exists("b:did_indent")
	finish
endif
let b:did_indent = 1

setlocal indentexpr=LedgerIndent()

" Only define the funtion once
if exists("*LedgerIndent")
	finish
endif


function LedgerIndent()
	let lnum = prevnonblank(v:lnum - 1)
	let ind = 0
	if lnum == 0
		return 0
	endif
	if indent(lnum) != 0 && getline(v:lnum - 1) !~ '^$'
		return -1
	endif
	if getline(lnum) =~ '^\d\{1,2}\/\d\{1,2}' || getline(lnum) =~ '^\d{4}\/\d\{1,2}\/\d\{1,2}'
		let ind = ind + &sw
	endif
	return ind
endfunction

" vim:sw=4

> 
> -- 
> Until later, Geoffrey
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

-- 
 __^__                                          __^__
( ___ )----------------------------------------( ___ )
 | / | "Engineers aren't boring people,         | \ |
 | / | we just get excited about boring things" | \ |
 |___|                 --Anon                   |___|
(_____)----------------------------------------(_____)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available




More information about the Ale mailing list