Bug#519240: vim-runtime: Java annotation support for /usr/share/vim/vim72/indent/java.vim

Fredrik Jonson fredrik at myrealbox.com
Wed Mar 11 09:54:46 UTC 2009


Package: vim-runtime
Version: 2:7.2.130-1
Severity: wishlist


The following patch adds support for proper indentation of java annotations.
The defacto standard for indentations of java annotations is that the next
line is indented at the same line as the annotation itself. The patch below
implements this behaviour.

This issue should probably be forwarded upstream, but I was not sure of the
protocol for reporting debian vim versions in vim bug reports.

The original idea for the implementation was published by the user wds on
stackoverflow:

http://stackoverflow.com/questions/200932/how-do-i-make-vim-indent-java-annotations-correctly

/usr/share/vim/vim72/indent/java.vim

--- java.vim.orig2009-03-11 10:30:08.000000000 +0100
+++ java.vim2009-03-11 10:28:05.000000000 +0100
@@ -124,6 +124,12 @@
     let theIndent = indent(lnum)
   endif
 
+  let lnum = prevnonblank(v:lnum - 1)
+  let line = getline(lnum)
+  if line =~ '^\s*@.*$'
+    let theIndent = indent(lnum)
+  endif
+
   return theIndent
 endfunction

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.28-1-686 (SMP w/2 CPU cores)
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages vim-runtime depends on:
ii  dpkg                          1.14.25    Debian package management system

Versions of packages vim-runtime recommends:
ii  vim                          2:7.2.130-1 Vi IMproved - enhanced vi editor
ii  vim-gtk [vim]                2:7.2.130-1 Vi IMproved - enhanced vi editor -

vim-runtime suggests no packages.

-- no debconf information





More information about the pkg-vim-maintainers mailing list