[SCM] vim-scripts packaging branch, master, updated. v20091011-30-gc476b42
James Vega
jamessan at debian.org
Sun Aug 14 03:27:04 UTC 2011
The following commit has been merged in the master branch:
commit 62a7d3932f704fa76a97d3337169774a2a654dc3
Author: James Vega <jamessan at debian.org>
Date: Sun Jun 26 14:53:26 2011 -0400
Update detectindent to revision c6f6e7b
Signed-off-by: James Vega <jamessan at debian.org>
diff --git a/debian/changelog b/debian/changelog
index f1f0dd1..8d77222 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,8 @@ vim-scripts (20091012) UNRELEASED; urgency=low
- xmledit: Update to 1.9.1
+ Remove patches disabledby-xml.diff and xml-nodocs.diff, merged
upstream.
+ - detectindent: Update to upstream revision c6f6e7b
+ + Remove patch detectindent_fix.diff, merged upstream.
-- James Vega <jamessan at debian.org> Sun, 24 Jan 2010 17:10:16 -0500
diff --git a/debian/patches/detectindent_fix.diff b/debian/patches/detectindent_fix.diff
deleted file mode 100644
index 261ffb3..0000000
--- a/debian/patches/detectindent_fix.diff
+++ /dev/null
@@ -1,40 +0,0 @@
-## detectindent_fix.diff by Antonio Terceiro <terceiro at softwarelivre.org>
-
-Index: vim-scripts/plugin/detectindent.vim
-===================================================================
---- vim-scripts.orig/plugin/detectindent.vim
-+++ vim-scripts/plugin/detectindent.vim
-@@ -86,7 +86,7 @@
- if l:has_leading_tabs && ! l:has_leading_spaces
- " tabs only, no spaces
- set noexpandtab
-- if exists("g:detectindent_preferred_tabsize")
-+ if exists("g:detectindent_preferred_indent")
- let &shiftwidth = g:detectindent_preferred_indent
- let &tabstop = g:detectindent_preferred_indent
- endif
-@@ -95,6 +95,8 @@
- " spaces only, no tabs
- set expandtab
- let &shiftwidth = l:shortest_leading_spaces_run
-+ let &tabstop = l:shortest_leading_spaces_run
-+ let &softtabstop = l:shortest_leading_spaces_run
-
- elseif l:has_leading_spaces && l:has_leading_tabs
- " spaces and tabs
-@@ -109,12 +111,14 @@
- else
- let &tabstop = 8
- endif
-+ let &softtabstop = &tabstop
-
- else
- " no spaces, no tabs
-- if exists("g:detectindent_preferred_tabsize")
-+ if exists("g:detectindent_preferred_indent")
- let &shiftwidth = g:detectindent_preferred_indent
- let &tabstop = g:detectindent_preferred_indent
-+ let &softtabstop = g:detectindent_preferred_indent
- endif
- if exists("g:detectindent_preferred_expandtab")
- set expandtab
diff --git a/debian/patches/series b/debian/patches/series
index f843589..e1b1c94 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -13,7 +13,6 @@ disabledby-pythonindent.diff
sokoboan_path.diff
usagestring-dtd2vim.diff
vimplate_debian-path.diff
-detectindent_fix.diff
lbdbq-inputlist.diff
closetag-sanity.diff
lbdbq-query.diff
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 1aa055c..382f414 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -388,6 +388,7 @@ author: Ciaran McCreesh
author_url: http://www.vim.org/account/profile.php?user_id=4078
email: ciaran.mccreesh at googlemail.com
license: Vim's license [4], see below
+disabledby: let loaded_detectindent = 1
version: 1.0
script_name: plugin/snippetsEmu.vim
diff --git a/doc/detectindent.txt b/doc/detectindent.txt
index 526e695..ed7e50b 100644
--- a/doc/detectindent.txt
+++ b/doc/detectindent.txt
@@ -1,6 +1,6 @@
*detectindent.txt* The Detect Indent Plugin 1.0, Jan 04, 2005
-Author: Ciaran McCreesh <ciaranm at gentoo dot org>
+Author: Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
==============================================================================
1. Contents *detectindent* *detectindent-contents*
@@ -30,6 +30,10 @@ Author: Ciaran McCreesh <ciaranm at gentoo dot org>
:let g:detectindent_preferred_indent = 4
< in your |vimrc| file.
+ To set limit for number of lines that will be analysed set: >
+ :let g:detectindent_max_lines_to_analyse = 1024
+< in your |vimrc| file.
+
==============================================================================
3. DetectIndent ChangeLog *detectindent-changelog*
diff --git a/html/index.html b/html/index.html
index 0bc2455..1108311 100644
--- a/html/index.html
+++ b/html/index.html
@@ -50,7 +50,7 @@
<li><a href="syntax_mkd.vim.html">syntax/mkd.vim.html</a></li>
</ul>
<p>
- Page generated on Sat, 25 Jun 2011 23:47:01 -0400
+ Page generated on Sun, 26 Jun 2011 14:32:18 -0400
.
</p>
</body>
diff --git a/html/plugin_detectindent.vim.html b/html/plugin_detectindent.vim.html
index 89560f1..ea5673c 100644
--- a/html/plugin_detectindent.vim.html
+++ b/html/plugin_detectindent.vim.html
@@ -46,6 +46,19 @@
<tr>
<td><small>not logged in (<a href="/login.php">login</a>)</small></td>
</tr>
+ <tr><td>
+<small> </small>
+<form action="http://www.google.com/cse" id="cse-search-box">
+ <div>
+ <input type="hidden" name="cx" value="partner-pub-3005259998294962:bvyni59kjr1" />
+ <input type="hidden" name="ie" value="ISO-8859-1" />
+ <input type="text" name="q" size="20" />
+ <br>
+ <input type="submit" name="sa" value="Search" />
+ </div>
+</form>
+<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
+ </td></tr>
<tr>
<td><img src="/images/spacer.gif" alt="" border="0" width="1" height="1"></td>
</tr>
@@ -59,7 +72,7 @@
<td class="sidebarheader"><a href="/index.php">Home</a></td>
</tr>
<tr>
- <td class="sidebarheader"><a href="/search.php">Search</a></td>
+ <td class="sidebarheader"><a href="/search.php">Advanced search</a></td>
</tr>
<tr>
<td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
@@ -153,8 +166,14 @@
<tr>
<td class="lightbg"><b> script karma </b></td>
<td>
- Rating <b>41/16</b>,
- Downloaded by 495 </td>
+ Rating <b>94/32</b>,
+ Downloaded by 1057 </td>
+ <td class="lightbg">
+ <b> Comments, bugs, improvements </b>
+ </td>
+ <td>
+ <a href="http://vim.wikia.com/wiki/Script:1171">Vim wiki</a>
+ </td>
</tr>
</table>
<p>
@@ -167,7 +186,7 @@
<tr><td>utility</td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">description</td></tr>
-<tr><td>This script provides a command which will attempt to guess the correct indent settings for an open file, for use when there is no modeline available. Note that this is a pure vim implementation, and doesn't require any external applications or interpreters.
<br>
<br>Usage:
<br>
<br>:DetectIndent
<br>
<br>May also be used in an autocommand, for example:
<br>
<br>:autocmd BufReadPost * :DetectIndent
<br>
<br>Options:
<br>
<br>To prefer 'expandtab' to 'noexpandtab' when no detection is possible:
<br>:let g:detectindent_preferred_expandtab = 1
<br>
<br>To specify a preferred indent level when no detection is possible:
<br>:let g:detectindent_preferred_indent = 4
<br>
<br>Notes:
<br>
<br>Detection is by no means perfect. It won't work if files use especially perverse combinations of spaces and tabs, or weird tab widths. Bug reports and patches encouraged...</td></tr>
+<tr><td>This script provides a command which will attempt to guess the correct indent settings for an open file, for use when there is no modeline available. Note that this is a pure vim implementation, and doesn't require any external applications or interpreters.
<br>
<br>Usage:
<br>
<br>:DetectIndent
<br>
<br>May also be used in an autocommand, for example:
<br>
<br>:autocmd BufReadPost * :DetectIndent
<br>
<br>Options:
<br>
<br>To prefer 'expandtab' to 'noexpandtab' when no detection is possible:
<br>:let g:detectindent_preferred_expandtab = 1
<br>
<br>To specify a preferred indent level when no detection is possible:
<br>:let g:detectindent_preferred_indent = 4
<br>
<br>Notes:
<br>
<br>Detection is by no means perfect. It won't work if files use especially perverse combinations of spaces and tabs, or weird tab widths. Bug reports and patches encouraged...
<br>
<br>Keeping things up to date on vim.org is a nuisance. For the latest version, visit:
<br>
<br> <a target="_blank" href="http://github.com/ciaranm/detectindent">http://github.com/ciaranm/detectindent</A></td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">install details</td></tr>
<tr><td>Place in ~/.vim/plugin/ and ~/.vim/doc/</td></tr>
@@ -217,6 +236,7 @@ Click on the package to download.
</tr>
</table>
</td>
+
</tr>
</table>
@@ -255,7 +275,7 @@ Click on the package to download.
</td>
<td align="right" valign="top">
- <a href="http://sourceforge.net" rel="nofollow"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
+ <a href="http://sourceforge.net/projects/vim" rel="nofollow"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
</td>
<td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>
diff --git a/plugin/detectindent.vim b/plugin/detectindent.vim
index 0bc3463..4801de1 100644
--- a/plugin/detectindent.vim
+++ b/plugin/detectindent.vim
@@ -1,7 +1,7 @@
" Name: detectindent (global plugin)
" Version: 1.0
-" Author: Ciaran McCreesh <ciaranm at gentoo.org>
-" Updates: http://dev.gentoo.org/~ciaranm/vim/
+" Author: Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
+" Updates: http://github.com/ciaranm/detectindent
" Purpose: Detect file indent settings
"
" License: You may redistribute this plugin under the same terms as Vim
@@ -19,28 +19,48 @@
"
" Requirements: Untested on Vim versions below 6.2
+if exists("loaded_detectindent")
+ finish
+endif
+let loaded_detectindent = 1
+
+if !exists('g:detectindent_verbosity')
+ let g:detectindent_verbosity = 1
+endif
+
+fun! <SID>HasCStyleComments()
+ return index(["c", "cpp", "java", "javascript", "php"], &ft) != -1
+endfun
+
fun! <SID>IsCommentStart(line)
- " &comments isn't reliable
- if &ft == "c" || &ft == "cpp"
- return -1 != match(a:line, '/\*')
- else
- return 0
- endif
+ " &comments aren't reliable
+ return <SID>HasCStyleComments() && a:line =~ '/\*'
endfun
fun! <SID>IsCommentEnd(line)
- if &ft == "c" || &ft == "cpp"
- return -1 != match(a:line, '\*/')
- else
- return 0
- endif
+ return <SID>HasCStyleComments() && a:line =~ '\*/'
+endfun
+
+fun! <SID>IsCommentLine(line)
+ return <SID>HasCStyleComments() && a:line =~ '^\s\+//'
endfun
fun! <SID>DetectIndent()
let l:has_leading_tabs = 0
let l:has_leading_spaces = 0
let l:shortest_leading_spaces_run = 0
+ let l:shortest_leading_spaces_idx = 0
let l:longest_leading_spaces_run = 0
+ let l:max_lines = 1024
+ if exists("g:detectindent_max_lines_to_analyse")
+ let l:max_lines = g:detectindent_max_lines_to_analyse
+ endif
+
+ let verbose_msg = ''
+ if ! exists("b:detectindent_cursettings")
+ " remember initial values for comparison
+ let b:detectindent_cursettings = {'expandtab': &et, 'shiftwidth': &sw, 'tabstop': &ts, 'softtabstop': &sts}
+ endif
let l:idx_end = line("$")
let l:idx = 1
@@ -51,13 +71,26 @@ fun! <SID>DetectIndent()
" settings in c/c++ files especially
if <SID>IsCommentStart(l:line)
while l:idx <= l:idx_end && ! <SID>IsCommentEnd(l:line)
- let l:line = getline(l:idx)
let l:idx = l:idx + 1
+ let l:line = getline(l:idx)
endwhile
let l:idx = l:idx + 1
continue
endif
+ " Skip comment lines since they are not dependable.
+ if <SID>IsCommentLine(l:line)
+ let l:idx = l:idx + 1
+ continue
+ endif
+
+ " Skip lines that are solely whitespace, since they're less likely to
+ " be properly constructed.
+ if l:line !~ '\S'
+ let l:idx = l:idx + 1
+ continue
+ endif
+
let l:leading_char = strpart(l:line, 0, 1)
if l:leading_char == "\t"
@@ -72,6 +105,7 @@ fun! <SID>DetectIndent()
if l:shortest_leading_spaces_run == 0 ||
\ l:spaces < l:shortest_leading_spaces_run
let l:shortest_leading_spaces_run = l:spaces
+ let l:shortest_leading_spaces_idx = l:idx
endif
if l:spaces > l:longest_leading_spaces_run
let l:longest_leading_spaces_run = l:spaces
@@ -81,47 +115,86 @@ fun! <SID>DetectIndent()
endif
let l:idx = l:idx + 1
+
+ let l:max_lines = l:max_lines - 1
+
+ if l:max_lines == 0
+ let l:idx = l:idx_end + 1
+ endif
+
endwhile
if l:has_leading_tabs && ! l:has_leading_spaces
" tabs only, no spaces
- set noexpandtab
- if exists("g:detectindent_preferred_tabsize")
- let &shiftwidth = g:detectindent_preferred_indent
- let &tabstop = g:detectindent_preferred_indent
+ let l:verbose_msg = "Detected tabs only and no spaces"
+ setl noexpandtab
+ if exists("g:detectindent_preferred_indent")
+ let &l:shiftwidth = g:detectindent_preferred_indent
+ let &l:tabstop = g:detectindent_preferred_indent
endif
elseif l:has_leading_spaces && ! l:has_leading_tabs
" spaces only, no tabs
- set expandtab
- let &shiftwidth = l:shortest_leading_spaces_run
+ let l:verbose_msg = "Detected spaces only and no tabs"
+ setl expandtab
+ let &l:shiftwidth = l:shortest_leading_spaces_run
+ let &l:softtabstop = l:shortest_leading_spaces_run
elseif l:has_leading_spaces && l:has_leading_tabs
" spaces and tabs
- set noexpandtab
- let &shiftwidth = l:shortest_leading_spaces_run
+ let l:verbose_msg = "Detected spaces and tabs"
+ setl noexpandtab
+ let &l:shiftwidth = l:shortest_leading_spaces_run
" mmmm, time to guess how big tabs are
- if l:longest_leading_spaces_run < 2
- let &tabstop = 2
- elseif l:longest_leading_spaces_run < 4
- let &tabstop = 4
+ if l:longest_leading_spaces_run <= 2
+ let &l:tabstop = 2
+ elseif l:longest_leading_spaces_run <= 4
+ let &l:tabstop = 4
else
- let &tabstop = 8
+ let &l:tabstop = 8
endif
else
" no spaces, no tabs
- if exists("g:detectindent_preferred_tabsize")
- let &shiftwidth = g:detectindent_preferred_indent
- let &tabstop = g:detectindent_preferred_indent
- endif
- if exists("g:detectindent_preferred_expandtab")
- set expandtab
+ let l:verbose_msg = "Detected no spaces and no tabs"
+ if exists("g:detectindent_preferred_indent") &&
+ \ exists("g:detectindent_preferred_expandtab")
+ setl expandtab
+ let &l:shiftwidth = g:detectindent_preferred_indent
+ let &l:softtabstop = g:detectindent_preferred_indent
+ elseif exists("g:detectindent_preferred_indent")
+ setl noexpandtab
+ let &l:shiftwidth = g:detectindent_preferred_indent
+ let &l:tabstop = g:detectindent_preferred_indent
+ elseif exists("g:detectindent_preferred_expandtab")
+ setl expandtab
+ else
+ setl noexpandtab
endif
endif
+
+ if &verbose >= g:detectindent_verbosity
+ echo l:verbose_msg
+ \ ."; has_leading_tabs:" l:has_leading_tabs
+ \ .", has_leading_spaces:" l:has_leading_spaces
+ \ .", shortest_leading_spaces_run:" l:shortest_leading_spaces_run
+ \ .", shortest_leading_spaces_idx:" l:shortest_leading_spaces_idx
+ \ .", longest_leading_spaces_run:" l:longest_leading_spaces_run
+
+ let changed_msg = []
+ for [setting, oldval] in items(b:detectindent_cursettings)
+ exec 'let newval = &'.setting
+ if oldval != newval
+ let changed_msg += [ setting." changed from ".oldval." to ".newval ]
+ end
+ endfor
+ if len(changed_msg)
+ echo "Initial buffer settings changed:" join(changed_msg, ", ")
+ endif
+ endif
endfun
-command! -nargs=0 DetectIndent call <SID>DetectIndent()
+command! -bar -nargs=0 DetectIndent call <SID>DetectIndent()
--
vim-scripts packaging
More information about the pkg-vim-maintainers
mailing list