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