From a7241f5f19fd0865ce697939c347a8c88fb507d5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 24 Jun 2008 20:39:31 +0000 Subject: updated for version 7.2a --- runtime/indent/php.vim | 6 +++--- runtime/indent/sql.vim | 2 +- runtime/indent/sqlanywhere.vim | 29 +++++++++++++++-------------- runtime/indent/vhdl.vim | 31 ++++++++++++++++--------------- 4 files changed, 35 insertions(+), 33 deletions(-) (limited to 'runtime/indent') diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 8ba3b2ea19..d73460d07d 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -2,7 +2,7 @@ " Language: PHP " Author: John Wellesz " URL: http://www.2072productions.com/vim/indent/php.vim -" Last Change: 2007 February 25th +" Last Change: 2007 Jun 24 " Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php " Version: 1.24 " @@ -310,11 +310,11 @@ function! ResetOptions() setlocal comments=s1:/*,mb:*,ex:*/,://,:# - setlocal formatoptions-=t + " setlocal formatoptions-=t setlocal formatoptions+=q setlocal formatoptions+=r setlocal formatoptions+=o - setlocal formatoptions+=w + " setlocal formatoptions+=w setlocal formatoptions+=c setlocal formatoptions+=b endif diff --git a/runtime/indent/sql.vim b/runtime/indent/sql.vim index f7cf834700..4f82b96a55 100644 --- a/runtime/indent/sql.vim +++ b/runtime/indent/sql.vim @@ -36,4 +36,4 @@ endif exec 'runtime indent/'.filename.'.vim' -" vim:sw=4:ff=unix: +" vim:sw=4: diff --git a/runtime/indent/sqlanywhere.vim b/runtime/indent/sqlanywhere.vim index c2f527ebc6..fdafb622e5 100644 --- a/runtime/indent/sqlanywhere.vim +++ b/runtime/indent/sqlanywhere.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: SQL " Maintainer: David Fishburn -" Last Change: Wed Sep 14 2005 10:21:15 PM -" Version: 1.4 +" Last Change: Mon Apr 02 2007 9:13:47 AM +" Version: 1.5 " Download: http://vim.sourceforge.net/script.php?script_id=495 " Notes: @@ -106,7 +106,7 @@ function s:CheckToIgnoreRightParan( prev_lnum, num_levels ) " if getline(".") =~ '^)' let matching_paran = searchpair('(', '', ')', 'bW', - \ 'IsColComment(line("."), col("."))') + \ 's:IsColComment(line("."), col("."))') if matching_paran < 1 " No match found @@ -165,7 +165,7 @@ function s:GetStmtStarterIndent( keyword, curr_lnum ) \ '\%(\%(\\)'. \ '\)' let matching_lnum = searchpair(stmts, '', '\\zs', 'bW', - \ 'IsColComment(line("."), col(".")) == 1') + \ 's:IsColComment(line("."), col(".")) == 1') exec 'normal! $' if matching_lnum > 0 && matching_lnum < a:curr_lnum let ind = indent(matching_lnum) @@ -177,7 +177,7 @@ function s:GetStmtStarterIndent( keyword, curr_lnum ) \ '', \ '\%(\%(\\)\|\%(\\)\)', \ 'bW', - \ 'IsColComment(line("."), col(".")) == 1') + \ 's:IsColComment(line("."), col(".")) == 1') exec 'normal! $' if matching_lnum > 0 && matching_lnum < a:curr_lnum let ind = indent(matching_lnum) @@ -191,7 +191,7 @@ endfunction " Check if the line is a comment -function IsLineComment(lnum) +function s:IsLineComment(lnum) let rc = synIDattr( \ synID(a:lnum, \ match(getline(a:lnum), '\S')+1, 0) @@ -203,7 +203,7 @@ endfunction " Check if the column is a comment -function IsColComment(lnum, cnum) +function s:IsColComment(lnum, cnum) let rc = synIDattr(synID(a:lnum, a:cnum, 0), "name") \ =~? "comment" @@ -211,8 +211,9 @@ function IsColComment(lnum, cnum) endfunction -" Check if the column is a comment -function ModuloIndent(ind) +" Instead of returning a column position, return +" an appropriate value as a factor of shiftwidth. +function s:ModuloIndent(ind) let ind = a:ind if ind > 0 @@ -235,7 +236,7 @@ function GetSQLIndent() " If the current line is a comment, leave the indent as is " Comment out this additional check since it affects the " indenting of =, and will not reindent comments as it should - " if IsLineComment(lnum) == 1 + " if s:IsLineComment(lnum) == 1 " return ind " endif @@ -246,9 +247,9 @@ function GetSQLIndent() return ind endif - if IsLineComment(prevlnum) == 1 + if s:IsLineComment(prevlnum) == 1 if getline(v:lnum) =~ '^\s*\*' - let ind = ModuloIndent(indent(prevlnum)) + let ind = s:ModuloIndent(indent(prevlnum)) return ind + 1 endif " If the previous line is a comment, then return -1 @@ -378,7 +379,7 @@ function GetSQLIndent() endif " echom 'final - indent ' . ind - return ModuloIndent(ind) + return s:ModuloIndent(ind) endfunction -" vim:sw=4:ff=unix: +" vim:sw=4: diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim index d288be4ceb..9940cc5b5e 100644 --- a/runtime/indent/vhdl.vim +++ b/runtime/indent/vhdl.vim @@ -1,8 +1,8 @@ " VHDL indent ('93 syntax) " Language: VHDL " Maintainer: Gerald Lai -" Version: 1.50 -" Last Change: 2007 Jan 29 +" Version: 1.54 +" Last Change: 2007 Aug 17 " URL: http://www.vim.org/scripts/script.php?script_id=1450 " only load this indent file when no other was loaded @@ -28,13 +28,13 @@ let s:ES = '\s*\%(--.*\)\=$' let s:NE = '\%(\ 0 ? indent(prevn) : 0 @@ -77,8 +78,8 @@ function GetVHDLindent() if curs =~ '^\s*--' let pn = curn - 1 let ps = getline(pn) - if ps =~ '--' - return stridx(ps, '--') + if curs =~ '^\s*--\s' && ps =~ '--' + return indent(pn) + stridx(substitute(ps, '^\s*', '', ''), '--') else " find nextnonblank line that is not a comment let nn = nextnonblank(curn + 1) @@ -106,14 +107,14 @@ function GetVHDLindent() if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(generic\|map\|port\)\>.*\)\@\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) " align closing ")" with opening "(" if curs =~ '^\s*)' - return stridx(prevs, '(') + return ind2 + stridx(prevs_noi, '(') endif - let m = matchend(prevs, '(\s*\ze\w') + let m = matchend(prevs_noi, '(\s*\ze\w') if m != -1 - return m + return ind2 + m else - if g:vhdl_align_genportmap - return stridx(prevs, '(') + &sw + if g:vhdl_indent_genportmap + return ind2 + stridx(prevs_noi, '(') + &sw else return ind2 + &sw endif @@ -124,8 +125,8 @@ function GetVHDLindent() " keywords: variable + "<=" without ";" ending " where: start of previous line if prevs =~? '^\s*\S\+\s*<=[^;]*'.s:ES - if g:vhdl_align_rhsassign - return matchend(prevs, '<=\s*\ze.') + if g:vhdl_indent_rhsassign + return ind2 + matchend(prevs_noi, '<=\s*\ze.') else return ind2 + &sw endif -- cgit v1.2.3