summaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-21 22:12:41 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-21 22:12:41 +0000
commit57657d85c6c3d812e99b5e5d5161c07c66ac7dc7 (patch)
tree35b6845dc38717148718ac5cf70553b8c2cb96d8 /runtime/indent
parentfc1421eb53b17aa58b01a9c07ba2007eb4a1aa4f (diff)
downloadvim-git-57657d85c6c3d812e99b5e5d5161c07c66ac7dc7.tar.gz
updated for version 7.0e05v7.0e05
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/automake.vim4
-rw-r--r--runtime/indent/cmake.vim6
-rw-r--r--runtime/indent/config.vim4
-rw-r--r--runtime/indent/css.vim4
-rw-r--r--runtime/indent/dictconf.vim4
-rw-r--r--runtime/indent/dictdconf.vim4
-rw-r--r--runtime/indent/docbk.vim4
-rw-r--r--runtime/indent/eterm.vim4
-rw-r--r--runtime/indent/ld.vim4
-rw-r--r--runtime/indent/make.vim47
-rw-r--r--runtime/indent/python.vim2
-rw-r--r--runtime/indent/readline.vim4
-rw-r--r--runtime/indent/rst.vim4
-rw-r--r--runtime/indent/sh.vim4
-rw-r--r--runtime/indent/sml.vim6
-rw-r--r--runtime/indent/tcl.vim4
-rw-r--r--runtime/indent/xf86conf.vim4
-rw-r--r--runtime/indent/xinetd.vim4
-rw-r--r--runtime/indent/yacc.vim4
-rw-r--r--runtime/indent/zsh.vim4
20 files changed, 67 insertions, 58 deletions
diff --git a/runtime/indent/automake.vim b/runtime/indent/automake.vim
index 0f8dbadf8..28d77a814 100644
--- a/runtime/indent/automake.vim
+++ b/runtime/indent/automake.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: automake
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim
index e36937df5..a1ad832f2 100644
--- a/runtime/indent/cmake.vim
+++ b/runtime/indent/cmake.vim
@@ -56,7 +56,7 @@ fun! CMakeGetIndent(lnum)
\ or . '[^()\\#"]' . or . '\\.' . '\)*'
let cmake_indent_comment_line = '^\s*' . cmake_regex_comment
- let cmake_indent_blank_regex = '^\s*$')
+ let cmake_indent_blank_regex = '^\s*$'
let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
\ '\s*(' . cmake_regex_arguments .
\ '\(' . cmake_regex_comment . '\)\?$'
@@ -65,8 +65,8 @@ fun! CMakeGetIndent(lnum)
\ ')\s*' .
\ '\(' . cmake_regex_comment . '\)\?$'
- let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\)\s*('
- let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\)\s*('
+ let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|WHILE\)\s*('
+ let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ENDWHILE\)\s*('
" Add
if previous_line =~? cmake_indent_comment_line " Handle comments
diff --git a/runtime/indent/config.vim b/runtime/indent/config.vim
index c6c54b25f..d763db0dc 100644
--- a/runtime/indent/config.vim
+++ b/runtime/indent/config.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Autoconf configure.{ac,in} file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2006-02-11
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
" TODO: how about nested [()]'s in one line
" what's wrong with '\\\@!'?
diff --git a/runtime/indent/css.vim b/runtime/indent/css.vim
index b0560b473..8c6f114fb 100644
--- a/runtime/indent/css.vim
+++ b/runtime/indent/css.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: CSS
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-30
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/dictconf.vim b/runtime/indent/dictconf.vim
index dcaf1e152..adb096103 100644
--- a/runtime/indent/dictconf.vim
+++ b/runtime/indent/dictconf.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: dict(1) configuration file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-30
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/dictdconf.vim b/runtime/indent/dictdconf.vim
index f8f567064..235cecd34 100644
--- a/runtime/indent/dictdconf.vim
+++ b/runtime/indent/dictdconf.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: dictd(8) configuration file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-07-01
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/docbk.vim b/runtime/indent/docbk.vim
index 575b91f00..b8af5f2a1 100644
--- a/runtime/indent/docbk.vim
+++ b/runtime/indent/docbk.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: DocBook Documentation Format
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/eterm.vim b/runtime/indent/eterm.vim
index 938b94a72..730924068 100644
--- a/runtime/indent/eterm.vim
+++ b/runtime/indent/eterm.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Eterm configuration file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/ld.vim b/runtime/indent/ld.vim
index 440b106f1..e50b703b2 100644
--- a/runtime/indent/ld.vim
+++ b/runtime/indent/ld.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: ld(1) script
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-30
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/make.vim b/runtime/indent/make.vim
index 9db77f004..58504929f 100644
--- a/runtime/indent/make.vim
+++ b/runtime/indent/make.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Makefile
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
@@ -15,18 +15,9 @@ 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
+let s:rule_rx = '^[^ \t#:][^#:]*:\{1,2}\%([^=:]\|$\)'
+let s:continuation_rx = '\\$'
+let s:assignment_rx = '^\s*\h\w*\s*+\==\s*\zs.*\\$'
function GetMakeIndent()
let lnum = v:lnum - 1
@@ -35,11 +26,27 @@ function GetMakeIndent()
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*')
+ let ind = indent(lnum)
+
+ if line =~ s:rule_rx
+ return ind + &ts
+ elseif line =~ s:continuation_rx
+ while lnum > 0 && line =~ s:continuation_rx && line !~ s:assignment_rx
+ let lnum -= 1
+ let line = getline(lnum)
+ endwhile
+ if line =~ s:assignment_rx
+ call cursor(lnum, 1)
+ return search(s:assignment_rx, 'W') != 0 ? virtcol('.') - 1 : 0
+ else
+ return 0
+ endif
+ else
+ let pnum = lnum - 1
+ if pnum == 0
+ return ind
+ endif
+
+ return getline(pnum) =~ s:continuation_rx ? 0 : ind
endif
endfunction
diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim
index f268bf9e5..4b8e81bac 100644
--- a/runtime/indent/python.vim
+++ b/runtime/indent/python.vim
@@ -2,7 +2,7 @@
" Language: Python
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Original Author: David Bustos <bustos@caltech.edu>
-" Last Change: 2006 Mar 26
+" Last Change: 2006 Apr 21
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
diff --git a/runtime/indent/readline.vim b/runtime/indent/readline.vim
index 52d2a7131..94e4ea403 100644
--- a/runtime/indent/readline.vim
+++ b/runtime/indent/readline.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: readline configuration file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim
index f98e7556d..ac5e9bb5c 100644
--- a/runtime/indent/rst.vim
+++ b/runtime/indent/rst.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: reStructuredText Documentation Format
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index b6ce77459..7919c0960 100644
--- a/runtime/indent/sh.vim
+++ b/runtime/indent/sh.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Shell Script
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/sml.vim b/runtime/indent/sml.vim
index 30d3108a6..fbbb15ed8 100644
--- a/runtime/indent/sml.vim
+++ b/runtime/indent/sml.vim
@@ -130,14 +130,16 @@ function! GetSMLIndent()
elseif line =~ '^\s*else\>'
if lline !~ '^\s*\(if\|else\|then\)\>'
return s:FindPair('\<if\>', '', '\<then\>')
- else return ind
+ else
+ return ind
endif
" Match 'then' with 'if'
elseif line =~ '^\s*then\>'
if lline !~ '^\s*\(if\|else\|then\)\>'
return s:FindPair('\<if\>', '', '\<then\>')
- else return ind
+ else
+ return ind
endif
" Indent if current line begins with ']'
diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim
index 546b60daf..1b0cc16d5 100644
--- a/runtime/indent/tcl.vim
+++ b/runtime/indent/tcl.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Tcl
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-30
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/xf86conf.vim b/runtime/indent/xf86conf.vim
index f1f1c8ed5..5b2be6d3e 100644
--- a/runtime/indent/xf86conf.vim
+++ b/runtime/indent/xf86conf.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: XFree86 Configuration File
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim
index 6838163bf..398e05af9 100644
--- a/runtime/indent/xinetd.vim
+++ b/runtime/indent/xinetd.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: xinetd.conf(5) configuration file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-28
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish
diff --git a/runtime/indent/yacc.vim b/runtime/indent/yacc.vim
index 9d0798d49..d100ceb38 100644
--- a/runtime/indent/yacc.vim
+++ b/runtime/indent/yacc.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: YACC input file
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
diff --git a/runtime/indent/zsh.vim b/runtime/indent/zsh.vim
index 72b00b8c7..5bf231521 100644
--- a/runtime/indent/zsh.vim
+++ b/runtime/indent/zsh.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Zsh Shell Script
-" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
-" Latest Revision: 2005-06-29
+" Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2006-04-19
if exists("b:did_indent")
finish