Cleanups of vim files to get them ready for submission

This commit is contained in:
Jason Turner
2010-03-31 20:11:19 +00:00
parent 43d0d6199a
commit f070575205
2 changed files with 10 additions and 16 deletions

View File

@@ -1,6 +1,6 @@
" Vim indent file
" Language: Minnow
" Maintainer: Jason Turner <jason 'at' emptycrate.com>
" Language: ChaiScript
" Maintainer: Jason Turner <lefticus 'at' gmail com>
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -8,20 +8,15 @@ if exists("b:did_indent")
endif
let b:did_indent = 1
setlocal indentexpr=GetMinnowIndent()
" To make Vim call GetMinnowIndent() when it finds '\s*end'
" on the current line ('else' is default and includes 'elseif').
setlocal indentkeys+=0=end
setlocal indentexpr=GetChaiScriptIndent()
setlocal autoindent
" Only define the function once.
if exists("*GetMinnowIndent")
if exists("*GetChaiScriptIndent")
finish
endif
function! GetMinnowIndent()
function! GetChaiScriptIndent()
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -31,7 +26,7 @@ function! GetMinnowIndent()
endif
" Add a 'shiftwidth' after lines that start a block:
" 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{'
" lines containing a {
let ind = indent(lnum)
let flag = 0
let prevline = getline(lnum)
@@ -40,14 +35,13 @@ function! GetMinnowIndent()
let flag = 1
endif
" Subtract a 'shiftwidth' after lines ending with
" 'end' when they begin with 'while', 'if', 'for', etc. too.
" Subtract a 'shiftwidth' after lines containing a { followed by a }
" to keep it balanced
if flag == 1 && prevline =~ '.*{.*}.*'
let ind = ind - &shiftwidth
endif
" Subtract a 'shiftwidth' on end, else (and elseif), until and '}'
" This is the part that requires 'indentkeys'.
" Subtract a 'shiftwidth' on lines ending with }
if getline(v:lnum) =~ '^\s*\%(}\)'
let ind = ind - &shiftwidth
endif

View File

@@ -1,6 +1,6 @@
" Vim syntax file
" Language: ChaiScript
" Maintainer: Jason Turner <jason 'at' emptycrate com>
" Maintainer: Jason Turner <lefticus 'at' gmail com>
syn case match