]> git.nbdom.net Git - nb.git/commitdiff
vim + git
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 17 Nov 2014 23:01:26 +0000 (00:01 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 17 Nov 2014 23:01:26 +0000 (00:01 +0100)
47 files changed:
etc/gitconfig [new file with mode: 0644]
etc/vim/HTML.zip [new file with mode: 0644]
etc/vim/autoload/template.vim [new file with mode: 0644]
etc/vim/checkscript.sh [new file with mode: 0644]
etc/vim/checkspell.sh [new file with mode: 0644]
etc/vim/choosesig.pl [new file with mode: 0644]
etc/vim/doc/NERD_commenter.txt [new file with mode: 0644]
etc/vim/doc/tags [new file with mode: 0644]
etc/vim/doc/vimplate.txt [new file with mode: 0644]
etc/vim/doc/xml-plugin.txt [new file with mode: 0644]
etc/vim/ftdetect/puppet.vim [new file with mode: 0644]
etc/vim/ftplugin/xml.vim [new file with mode: 0644]
etc/vim/plugin/NERD_commenter.vim [new file with mode: 0644]
etc/vim/plugin/calendar.vim [new file with mode: 0644]
etc/vim/plugin/vimplate.vim [new file with mode: 0644]
etc/vim/source/._ShowFunc.vim [new file with mode: 0644]
etc/vim/source/ShowFunc.vim.disable [new file with mode: 0644]
etc/vim/source/abbreviate.vim [new file with mode: 0644]
etc/vim/source/debian.vim [new file with mode: 0644]
etc/vim/source/functions.vim [new file with mode: 0644]
etc/vim/source/html.no [new file with mode: 0644]
etc/vim/source/map.vim [new file with mode: 0644]
etc/vim/source/option.vim [new file with mode: 0644]
etc/vim/source/tt.vim [new file with mode: 0644]
etc/vim/stats/let.g [new file with mode: 0644]
etc/vim/stats/let.v [new file with mode: 0644]
etc/vim/stats/set.all [new file with mode: 0644]
etc/vim/stats/setglob.all [new file with mode: 0644]
etc/vim/stats/setloc.all [new file with mode: 0644]
etc/vim/syntax/puppet.vim [new file with mode: 0644]
etc/vim/template.html [new file with mode: 0644]
etc/vim/templates/bash.tt [new file with mode: 0644]
etc/vim/templates/css.tt [new file with mode: 0644]
etc/vim/templates/daemon.tt [new file with mode: 0644]
etc/vim/templates/daemon.tt.bak [new file with mode: 0644]
etc/vim/templates/html.tt [new file with mode: 0644]
etc/vim/templates/perl.tt [new file with mode: 0644]
etc/vim/templates/php.tt [new file with mode: 0644]
etc/vim/templates/puppet.tt [new file with mode: 0644]
etc/vim/templates/sh.tt [new symlink]
etc/vim/templates/sql.tt [new file with mode: 0644]
etc/vim/view/=+usr=+share=+vim=+vim72=+doc=+options.txt= [new file with mode: 0644]
etc/vim/vim-shortcurts [new file with mode: 0644]
etc/vim/vim-shortcurts-stdin [new file with mode: 0644]
etc/vim/vim-shortcurts.new [new file with mode: 0644]
etc/vim/vim-template-0.3.0.zip [new file with mode: 0644]
etc/vim/vimplate-dump [new file with mode: 0644]

diff --git a/etc/gitconfig b/etc/gitconfig
new file mode 100644 (file)
index 0000000..e029af3
--- /dev/null
@@ -0,0 +1,8 @@
+[user]
+       name = Nicolas Boisselier
+       email = nicolas.boisselier@gmail.com
+[core]
+       pager = less -iMRF
+  editor = vim
+[credential]
+  helper = cache --timeout 3600
diff --git a/etc/vim/HTML.zip b/etc/vim/HTML.zip
new file mode 100644 (file)
index 0000000..8086411
Binary files /dev/null and b/etc/vim/HTML.zip differ
diff --git a/etc/vim/autoload/template.vim b/etc/vim/autoload/template.vim
new file mode 100644 (file)
index 0000000..ae9a207
--- /dev/null
@@ -0,0 +1,139 @@
+" Simple and flexible template engine.
+" Version: 0.3.0
+" Author : thinca <thinca+vim@gmail.com>
+" License: zlib License
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:nomodeline = 703 < v:version || (v:version == 703 && has('patch438'))
+let s:loading_template = ''
+
+" Core functions. {{{1
+function! template#load(...)
+  let empty_buffer = line('$') == 1 && strlen(getline(1)) == 0
+  let pattern = get(a:000, 0, 0)
+  let lnum = get(a:000, 1, 0)
+  let force = get(a:000, 2, 0)
+  if !force && !empty_buffer
+    return
+  endif
+  let tmpl = template#search(empty(pattern) ? expand('%:p') : pattern)
+  if tmpl == ''
+    if &verbose && !empty(pattern)
+      echohl ErrorMsg
+      echomsg 'template: Template file was not found.'
+      echohl None
+    endif
+    return
+  endif
+
+  call cursor(lnum, 1)
+  silent keepalt :.-1 read `=tmpl`
+  if empty_buffer
+    silent $ delete _
+    1
+  endif
+
+  let loading_pre = s:loading_template
+  let s:loading_template = tmpl
+
+  if getline('.') =~ '^:'
+    let [save_reg, save_reg_type] = [getreg('"'), getregtype('"')]
+    silent .;/^[^:]\|^$\|^:\s*fini\%[sh]\>/-1 delete "
+    if getline('.') =~# ':\s*fini\%[sh]\>'
+      delete _
+    endif
+
+    let code = @"
+    call setreg('"', save_reg, save_reg_type)
+
+    let temp = tmpl . '.vim'
+    if glob(temp) != ''
+      let temp = tempname()
+    endif
+
+    call writefile(split(code, "\n"), temp)
+    try
+      if s:nomodeline
+        doautocmd <nomodeline> User plugin-template-preexec
+      else
+        doautocmd User plugin-template-preexec
+      endif
+      source `=temp`
+    catch
+      echoerr v:exception
+    finally
+      call delete(temp)
+    endtry
+  endif
+  if s:nomodeline
+    doautocmd <nomodeline> User plugin-template-loaded
+  else
+    doautocmd User plugin-template-loaded
+  endif
+
+  let s:loading_template = loading_pre
+endfunction
+
+function! template#search(pattern)
+  if !exists('g:template_basedir') || empty(a:pattern)
+    return ''
+  endif
+  " Matching from tail.
+  let target = s:reverse(s:to_slash_path(a:pattern))
+
+  let longest = ['', 0]  " ['template file name', match length]
+  for i in split(globpath(g:template_basedir, g:template_files), "\n")
+    let i = s:to_slash_path(i)
+    if isdirectory(i) || i !~ g:template_free_pattern
+      continue
+    endif
+    " Make a pattern such as the following.
+    " From: 'path/to/a_FREE_file.vim' (FREE is a free pattern.)
+    " To:   '^\Vmiv.elif_\(\.\{-}\)_a\%[/ot/htap]'
+    " TODO: cache?
+    let l = map(split(i, g:template_free_pattern),
+      \ 's:reverse(escape(v:val, "\\"))')
+    let [head, rest] = matchlist(l[0], '\v(.{-})(/.*)')[1:2]
+    let l[0] = head . '\%[' . substitute(rest, '[][]', '[\0]', 'g') . ']'
+    let matched = matchlist(target, '^\V' . join(reverse(l), '\(\.\{-}\)'))
+    let len = len(matched) ?
+      \ strlen(matched[0]) - strlen(join(matched[1:], '')) : 0
+    if longest[1] < len
+      let longest = [i, len]
+    endif
+  endfor
+  return longest[0]
+endfunction
+
+function! template#loading()
+  return s:loading_template
+endfunction
+
+
+" Misc functions. {{{1
+" Return the reversed string.
+function! s:reverse(str)
+  return join(reverse(split(a:str, '\zs')), '')
+endfunction
+
+" Unify pass separator to a slash.
+function! s:to_slash_path(path)
+  if has('win16') || has('win32') || has('win64')
+    return substitute(a:path, '\\', '/', 'g')
+  endif
+  return a:path
+endfunction
+
+" Complete function for :TemplateLoad
+function! template#complete(lead, cmd, pos)
+  let lead = escape(matchstr(a:cmd, 'T\%[emplateLoad]!\?\s\+\zs.*$'), '\')
+  let pat = '[/\\][^/\\]*' . g:template_free_pattern
+  let list = map(filter(split(globpath(g:template_basedir, g:template_files),
+    \ "\n"), '!isdirectory(v:val)'), 'v:val[match(v:val, pat):]')
+  return filter(list, 'v:val =~ "^\\V" . lead')
+endfunction
+
+
+let &cpo = s:save_cpo
diff --git a/etc/vim/checkscript.sh b/etc/vim/checkscript.sh
new file mode 100644 (file)
index 0000000..0326b84
--- /dev/null
@@ -0,0 +1,55 @@
+#!/bin/bash
+f=$1
+
+if [ -z "$f" ]; then
+       echo -e "Usage: $0 FILE\nCheck syntaxe of a document";
+       exit -1;
+fi
+
+ext=`echo $f|sed 's/^.*\.\(.*\)$/\1/'`
+php="php5 --define error_reporting=22519 --define display_errors=1 --define log_errors=1 --define html_errors=1" # E_ALL & ~E_NOTICE & ~E_DEPRECATED
+#php="php5 --define error_reporting=8192 --define display_errors=1" # E_ALL & ~E_NOTICE & E_DEPRECATED
+#php="php5 ";
+case "$ext" in
+       pp) exec puppet parser validate $f;;
+       pm|pl) exec perl -w -c $f;;
+       htm|html|xhtm) exec xmllint --noout --html $f;;
+       xml|sgml) exec xmllint --noout $f;;
+       php|inc)
+               exec $php -f $f
+       ;;
+esac
+case "$f" in
+       *named.conf) exec /usr/sbin/named-checkconf $f;;
+       *httpd2*)
+               httpd=`which httpd2 2>/dev/null`;
+               [ -z $httpd ] && httpd=`which apache2 2>/dev/null`;
+               exec $httpd -d `dirname $f` -t -f `basename $f`;
+       ;;
+       *httpd[\.-]*)
+               httpd=`which httpd 2>/dev/null`;
+               [ -z $httpd ] && httpd=`which apache 2>/dev/null`;
+               [ -z $httpd ] && httpd=`which httpd2 2>/dev/null`;
+               exec $httpd -d `dirname $f` -t -f `basename $f`;
+       ;;
+esac
+
+head=`head -c 100 $f`
+case "$head" in
+       \#!*/perl*)exec perl -w -c $f;;
+esac;
+
+file=`file $f`
+case "$file" in
+       *XML*document*) exec xmllint --noout $f;;
+       *SGML*document*) exec xmllint --noout $f;;
+       *HTML*document*) exec xmllint --noout --html $f;;
+       *perl*executable*)exec perl -w -c $f;;
+       *perl*modules*) exec perl -w -c $f;;
+       *[pP][hH][pP]*script*) exec $php -f $f;;
+       *[Bb]ourne*shell*script*) exec sh -x $f;;
+       *bash*executable*) exec sh -x $f;;
+esac;
+
+echo "Nothing to do with this file: $file: $ext!"
+exit 1
diff --git a/etc/vim/checkspell.sh b/etc/vim/checkspell.sh
new file mode 100644 (file)
index 0000000..c4c3d2e
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+# NB 12.03.04 nicolasboisselier@free.fr
+
+if [ -z "$@" ]; then
+       echo -e "Usage: $0 FILES\nVerifie l'orthographe d'un document."
+       exit -1;
+fi
+
+while [ "$1" ]; do
+       file=`file $1`
+       cmd=""
+       case "$file" in
+               *XML*document*) cmd="aspell -c --dont-backup --mode=sgml";;
+               *HTML*document*) cmd="aspell -c --dont-backup --mode=sgml";;
+               *SGML*document*) cmd="aspell -c --dont-backup --mode=sgml";;
+               *ASCII*mail*) cmd="aspell -c --dont-backup --mode=email";;
+               *text*) cmd="aspell -c --dont-backup";;
+       esac;
+
+       if [ "$cmd" ]; then
+               $cmd $1
+       else
+               echo "Rien à faire avec ce type de fichier: $file: $ext!"
+       fi
+       shift
+done
+
+exit
diff --git a/etc/vim/choosesig.pl b/etc/vim/choosesig.pl
new file mode 100644 (file)
index 0000000..0b23774
--- /dev/null
@@ -0,0 +1,134 @@
+#!/usr/bin/perl
+##############################################################################
+#
+# NB 09.10.03
+#
+# script pour macro mutt: choisie un template dans ~/.signature pour changer
+# l'envoyeur d'un mail
+#
+##############################################################################
+use strict qw (subs vars refs);
+
+my $file = shift @ARGV;
+my $dir = $ENV{HOME} . "/.signature";
+
+opendir(D,$dir) || die "$dir: $!";
+
+my @sig = sort grep(!/^\./,readdir(D));
+close D;
+
+my $i = -1;
+print "Choissisez une signature:\n",map { $i++; "[$i] $_\n" } @sig;
+
+$i = "Z";
+$i = <>;
+exit if !defined($i) or $i eq "" or $i !~ /^\d+$/ or $i>=scalar(@sig);
+
+my $f = "$dir/$sig[$i]";
+
+# on charge la signature
+open(F,$f) || die "$f: $!";
+my $sig = join('',<F>);
+close F;
+
+# on extrait l'email de la signature
+$sig =~ s/^From\s*:\s*(.*?)\s*[\r\n]//;
+my $me = $1 || "";
+my $from = $me; $from =~ s/^.*<(.*?)>.*$/$1/;
+$sig = "-- \n$sig" unless $sig =~ /^--\s*\n/;
+
+# NB 22.10.06 
+#my @allmail;
+#for (@sig) {
+#      $_ = "$dir/$_";
+#      open(F,$_) or die "$_: $!";
+#      $_ = <F>;
+#      s/\s+$//;
+#      if (/^From\s*:\s*(.*?)\s*$/) {
+#              $_ = $1 and push(@allmail,$_);
+#              s/^.*<(.*?)>.*$/$1/ and push(@allmail,$_);
+#              s/['"]/$1/g and push(@allmail,$_);
+#      }
+#      close F;
+#}
+#die @allmail;
+
+# lecture du mail
+my (@mail,$mail);
+#my $lsig = 0;
+open(F,$file) || die "$file: $!";
+$i = 0;
+
+while ($mail = <F>) {
+
+       unless ($i) {
+
+               # on est dans l'entete
+               if ($mail =~ /^\s$/) {
+                       # fin de l'entete
+                       $i = 1;
+                       next;
+               }
+
+               $mail =~ /^Cc\s*:/ and $mail =~ s/[^,:]*$from[^,:]*//g;
+               if ($mail =~ /^From\s*:/) { $i=2; next; }
+
+       }
+
+       # NB 04.11.03 on supprime toutes les signatures dans l'email
+       if (1 and $mail =~ /^[> ]*--+\s*$/) {
+               $mail = <F> while ($mail !~ /^[> ]*\s*$/);
+               next;
+       }
+
+       #$lsig = $. if $mail =~ /^--\s*$/;      # signature trouve
+       # NB 14.10.06 destinataire vide ????
+       $mail =~ /^(From|Cc|Bcc|To)\s*:/
+               and $mail =~ s/"" <>,?//g
+               and $mail =~ /^\s*$/ and next;
+       $mail = &sup_me($me,$mail);
+
+       push(@mail,$mail);
+}
+close F;
+
+# on supprime la derniere ligne si vide
+pop(@mail) if $mail[$#mail||0] =~ /^\s*$/;
+
+# noise
+@mail = grep { !/^(From|To|Cc): (['"]([^'"<>]+)?['"] )<>\s*$/ } @mail;
+
+open(F,">$file") || die "$file: $!";
+$_ = join('',@mail);
+
+s/(To: .*?)\nCc: +(contact|admin)\@izideal.com/$1\nCc: izideal/;
+
+print F "From: $me\n",$_,"\n$sig";
+
+close F;
+
+sub sup_me {
+#------------------------------------------------------------------------------
+# NB 16.06.05 
+#------------------------------------------------------------------------------
+my ($me,$mail,$simple) = @_;
+#warn $me;
+       #$mail =~ s/[^:,;]*$me\s*[:,;]?//gi; return $mail;
+       $mail =~ s/, *$me//gi;
+       $mail =~ s/$me *,//gi;
+       $mail =~ s/ *$me *//gi;
+#      $mail =~ s/ *$me//gi;
+#      $mail =~ s/$me *//gi;
+return $mail if $simple;
+       $me =~ s/"/'/g;
+       $mail = &sup_me($me,$mail,1);
+       $me =~ s/["']//g;
+       $mail = &sup_me($me,$mail,1);
+#return $mail;
+       $me =~ s/^.*<([^>]+)>.*$/$1/g;
+#      print "$me\n";
+       $mail = &sup_me($me,$mail,1);
+return $mail
+}
+
+exit;
diff --git a/etc/vim/doc/NERD_commenter.txt b/etc/vim/doc/NERD_commenter.txt
new file mode 100644 (file)
index 0000000..d79d278
--- /dev/null
@@ -0,0 +1,991 @@
+*NERD_commenter.txt*         Plugin for commenting code
+
+
+                        NERD COMMENTER REFERENCE MANUAL~
+
+
+
+
+
+==============================================================================
+CONTENTS                                               *NERDCommenterContents*
+
+    1.Intro...................................|NERDCommenter|
+    2.Functionality provided..................|NERDComFunctionality|
+        2.1 Functionality Summary.............|NERDComFunctionalitySummary|
+        2.2 Functionality Details.............|NERDComFunctionalityDetails|
+            2.2.1 Comment map.................|NERDComComment|
+            2.2.2 Nested comment map..........|NERDComNestedComment|
+            2.2.3 Toggle comment map..........|NERDComToggleComment|
+            2.2.4 Minimal comment map.........|NERDComMinimalComment|
+            2.2.5 Invert comment map..........|NERDComInvertComment|
+            2.2.6 Sexy comment map............|NERDComSexyComment|
+            2.2.7 Yank comment map............|NERDComYankComment|
+            2.2.8 Comment to EOL map..........|NERDComEOLComment|
+            2.2.9 Append com to line map......|NERDComAppendComment|
+            2.2.10 Insert comment map.........|NERDComInsertComment|
+            2.2.11 Use alternate delims map...|NERDComAltDelim|
+            2.2.12 Comment aligned maps.......|NERDComAlignedComment|
+            2.2.13 Uncomment line map.........|NERDComUncommentLine|
+        2.3 Supported filetypes...............|NERDComFiletypes|
+        2.4 Sexy Comments.....................|NERDComSexyComments|
+        2.5 The NERDComment function..........|NERDComNERDComment|
+    3.Options.................................|NERDComOptions|
+        3.1 Options summary...................|NERDComOptionsSummary|
+        3.2 Options details...................|NERDComOptionsDetails|
+        3.3 Default delimiter Options.........|NERDComDefaultDelims|
+    4. Customising key mappings...............|NERDComMappings|
+    5. Issues with the script.................|NERDComIssues|
+        5.1 Delimiter detection heuristics....|NERDComHeuristics|
+        5.2 Nesting issues....................|NERDComNesting|
+    6.About..     ............................|NERDComAbout|
+    7.Changelog...............................|NERDComChangelog|
+    8.Credits.................................|NERDComCredits|
+    9.License.................................|NERDComLicense|
+
+==============================================================================
+1. Intro                                                       *NERDCommenter*
+
+The NERD commenter provides many different commenting operations and styles
+which are invoked via key mappings and a menu. These operations are available
+for most filetypes.
+
+There are also options that allow to tweak the commenting engine to your
+taste.
+
+==============================================================================
+2. Functionality provided                               *NERDComFunctionality*
+
+------------------------------------------------------------------------------
+2.1 Functionality summary                        *NERDComFunctionalitySummary*
+
+The following key mappings are provided by default (there is also a menu
+with items corresponding to all the mappings below):
+
+[count],cc |NERDComComment|
+Comment out the current line or text selected in visual mode.
+
+
+[count],cn |NERDComNestedComment|
+Same as ,cc but forces nesting.
+
+
+[count],c<space> |NERDComToggleComment|
+Toggles the comment state of the selected line(s). If the topmost selected
+line is commented, all selected lines are uncommented and vice versa.
+
+
+[count],cm |NERDComMinimalComment|
+Comments the given lines using only one set of multipart delimiters.
+
+
+[count],ci |NERDComInvertComment|
+Toggles the comment state of the selected line(s) individually.
+
+
+[count],cs |NERDComSexyComment|
+Comments out the selected lines ``sexily''
+
+
+[count],cy |NERDComYankComment|
+Same as ,cc except that the commented line(s) are yanked first.
+
+
+,c$ |NERDComEOLComment|
+Comments the current line from the cursor to the end of line.
+
+
+,cA |NERDComAppendComment|
+Adds comment delimiters to the end of line and goes into insert mode between
+them.
+
+
+|NERDComInsertComment|
+Adds comment delimiters at the current cursor position and inserts between.
+Disabled by default.
+
+
+,ca |NERDComAltDelim|
+Switches to the alternative set of delimiters.
+
+
+[count],cl
+[count],cb    |NERDComAlignedComment|
+Same as |NERDComComment| except that the delimiters are aligned down the
+left side (,cl) or both sides (,cb).
+
+
+[count],cu |NERDComUncommentLine|
+Uncomments the selected line(s).
+
+------------------------------------------------------------------------------
+2.2 Functionality details                        *NERDComFunctionalityDetails*
+
+------------------------------------------------------------------------------
+2.2.1 Comment map                                             *NERDComComment*
+
+Default mapping: [count],cc
+Mapped to: <plug>NERDCommenterComment
+Applicable modes: normal visual visual-line visual-block.
+
+
+Comments out the current line. If multiple lines are selected in visual-line
+mode, they are all commented out.  If some text is selected in visual or
+visual-block mode then the script will try to comment out the exact text that
+is selected using multi-part delimiters if they are available.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+------------------------------------------------------------------------------
+2.2.2 Nested comment map                                *NERDComNestedComment*
+
+Default mapping: [count],cn
+Mapped to: <plug>NERDCommenterNest
+Applicable modes: normal visual visual-line visual-block.
+
+Performs nested commenting.  Works the same as ,cc except that if a line is
+already commented then it will be commented again.
+
+If |'NERDUsePlaceHolders'| is set then the previous comment delimiters will
+be replaced by place-holder delimiters if needed.  Otherwise the nested
+comment will only be added if the current commenting delimiters have no right
+delimiter (to avoid syntax errors)
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+Related options:
+|'NERDDefaultNesting'|
+
+------------------------------------------------------------------------------
+2.2.3 Toggle comment map                                *NERDComToggleComment*
+
+Default mapping: [count],c<space>
+Mapped to: <plug>NERDCommenterToggle
+Applicable modes: normal visual-line.
+
+Toggles commenting of the lines selected. The behaviour of this mapping
+depends on whether the first line selected is commented or not.  If so, all
+selected lines are uncommented and vice versa.
+
+With this mapping, a line is only considered to be commented if it starts with
+a left delimiter.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+------------------------------------------------------------------------------
+2.2.4 Minimal comment map                              *NERDComMinimalComment*
+
+Default mapping: [count],cm
+Mapped to: <plug>NERDCommenterMinimal
+Applicable modes: normal visual-line.
+
+Comments the selected lines using one set of multipart delimiters if possible.
+
+For example: if you are programming in c and you select 5 lines and press ,cm
+then a '/*' will be placed at the start of the top line and a '*/' will be
+placed at the end of the last line.
+
+Sets of multipart comment delimiters that are between the top and bottom
+selected lines are replaced with place holders (see |'NERDLPlace'|) if
+|'NERDUsePlaceHolders'| is set for the current filetype. If it is not, then
+the comment will be aborted if place holders are required to prevent illegal
+syntax.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+------------------------------------------------------------------------------
+2.2.5 Invert comment map                                *NERDComInvertComment*
+
+Default mapping: ,ci
+Mapped to: <plug>NERDCommenterInvert
+Applicable modes: normal visual-line.
+
+Inverts the commented state of each selected line. If the a selected line is
+commented then it is uncommented and vice versa. Each line is examined and
+commented/uncommented individually.
+
+With this mapping, a line is only considered to be commented if it starts with
+a left delimiter.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+------------------------------------------------------------------------------
+2.2.6 Sexy comment map                                    *NERDComSexyComment*
+
+Default mapping: [count],cs
+Mapped to: <plug>NERDCommenterSexy
+Applicable modes: normal, visual-line.
+
+Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for
+a description of what sexy comments are. Can only be done on filetypes for
+which there is at least one set of multipart comment delimiters specified.
+
+Sexy comments cannot be nested and lines inside a sexy comment cannot be
+commented again.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+Related options:
+|'NERDCompactSexyComs'|
+
+------------------------------------------------------------------------------
+2.2.7 Yank comment map                                    *NERDComYankComment*
+
+Default mapping: [count],cy
+Mapped to: <plug>NERDCommenterYank
+Applicable modes: normal visual visual-line visual-block.
+
+Same as ,cc except that it yanks the line(s) that are commented first.
+
+------------------------------------------------------------------------------
+2.2.8 Comment to EOL map                                   *NERDComEOLComment*
+
+Default mapping: ,c$
+Mapped to: <plug>NERDCommenterToEOL
+Applicable modes: normal.
+
+Comments the current line from the current cursor position up to the end of
+the line.
+
+------------------------------------------------------------------------------
+2.2.9 Append com to line map                            *NERDComAppendComment*
+
+Default mapping: ,cA
+Mapped to: <plug>NERDCommenterAppend
+Applicable modes: normal.
+
+Appends comment delimiters to the end of the current line and goes
+to insert mode between the new delimiters.
+
+------------------------------------------------------------------------------
+2.2.10 Insert comment map                               *NERDComInsertComment*
+
+Default mapping: disabled by default.
+Map it to: <plug>NERDCommenterInInsert
+Applicable modes: insert.
+
+Adds comment delimiters at the current cursor position and inserts
+between them.
+
+NOTE: prior to version 2.1.17 this was mapped to ctrl-c. To restore this
+mapping add >
+    let NERDComInsertMap='<c-c>'
+<
+to your vimrc.
+
+------------------------------------------------------------------------------
+2.2.11 Use alternate delims map                              *NERDComAltDelim*
+
+Default mapping: ,ca
+Mapped to: <plug>NERDCommenterAltDelims
+Applicable modes: normal.
+
+Changes to the alternative commenting style if one is available. For example,
+if the user is editing a c++ file using // comments and they hit ,ca
+then they will be switched over to /**/ comments.
+
+See also |NERDComDefaultDelims|
+
+------------------------------------------------------------------------------
+2.2.12 Comment aligned maps                            *NERDComAlignedComment*
+
+Default mappings: [count],cl   [count],cb
+Mapped to: <plug>NERDCommenterAlignLeft
+           <plug>NERDCommenterAlignBoth
+Applicable modes: normal visual-line.
+
+Same as ,cc except that the comment delimiters are aligned on the left side or
+both sides respectively. These comments are always nested if the line(s) are
+already commented.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+------------------------------------------------------------------------------
+2.2.13 Uncomment line map                               *NERDComUncommentLine*
+
+Default mapping: [count],cu
+Mapped to: <plug>NERDCommenterUncomment
+Applicable modes: normal visual visual-line visual-block.
+
+Uncomments the current line. If multiple lines are selected in
+visual mode then they are all uncommented.
+
+When uncommenting, if the line contains multiple sets of delimiters then the
+``outtermost'' pair of delimiters will be removed.
+
+The script uses a set of heurisics to distinguish ``real'' delimiters from
+``fake'' ones when uncommenting. See |NERDComIssues| for details.
+
+If a [count] is given in normal mode, the mapping works as though that many
+lines were selected in visual-line mode.
+
+Related  options:
+|'NERDRemoveAltComs'|
+|'NERDRemoveExtraSpaces'|
+
+------------------------------------------------------------------------------
+2.3 Supported filetypes                                     *NERDComFiletypes*
+
+Filetypes that can be commented by this plugin:
+abaqus abc acedb ada ahdl amiga aml ampl ant apache apachestyle asm68k asm asn
+aspvbs atlas autohotkey autoit automake ave awk basic b bc bdf bib bindzone
+bst btm caos catalog c cfg cg ch changelog cl clean clipper cmake conf config
+context cpp crontab cs csc csp css cterm cupl csv cvs dcl debchangelog
+debcontrol debsources def diff django docbk dns dosbatch dosini dot dracula
+dsl dtd dtml dylan ecd eiffel elf elmfilt erlang eruby eterm expect exports
+fetchmail fgl focexec form fortran foxpro fstab fvwm fx gdb gdmo geek
+gentoo-package-keywords' gentoo-package-mask' gentoo-package-use' gnuplot
+gtkrc haskell hb h help hercules hog html htmldjango htmlos ia64 icon idlang
+idl indent inform inittab ishd iss ist jam java javascript jess jgraph
+jproperties jproperties jsp kconfig kix kscript lace lex lftp lifelines lilo
+lisp lite lotos lout lprolog lscript lss lua lynx m4 mail make maple masm
+master matlab mel mf mib mma model moduala.  modula2 modula3 monk mush muttrc
+named nasm nastran natural ncf netdict netrw nqc nroff nsis objc ocaml occam
+omlet omnimark openroad opl ora otl ox pascal passwd pcap pccts perl pfmain
+php phtml pic pike pilrc pine plaintex plm plsql po postscr pov povini ppd
+ppwiz procmail progress prolog psf ptcap python python qf radiance ratpoison r
+rc readline rebol registry remind rexx robots rpl rtf ruby sa samba sas sass
+sather scheme scilab screen scsh sdl sed selectbuf sgml sgmldecl sgmllnx sh
+sicad simula sinda skill slang sl slrnrc sm smarty smil smith sml snnsnet
+snnspat snnsres snobol4 spec specman spice sql sqlforms sqlj sqr squid st stp
+strace svn systemverilog tads taglist tags tak tasm tcl terminfo tex text
+plaintex texinfo texmf tf tidy tli trasys tsalt tsscl tssgm uc uil vb verilog
+verilog_systemverilog vgrindefs vhdl vim viminfo virata vo_base vrml vsejcl
+webmacro wget winbatch wml wvdial xdefaults xf86conf xhtml xkb xmath xml
+xmodmap xpm2 xpm xslt yacc yaml z8a
+
+If a language is not in the list of hardcoded supported filetypes then the
+&commentstring vim option is used.
+
+------------------------------------------------------------------------------
+2.4 Sexy Comments                                        *NERDComSexyComments*
+These are comments that use one set of multipart comment delimiters as well as
+one other marker symbol. For example: >
+    /*
+     * This is a c style sexy comment
+     * So there!
+     */
+
+    /* This is a c style sexy comment
+     * So there!
+     * But this one is ``compact'' style */
+<
+Here the multipart delimiters are /* and */ and the marker is *.
+
+------------------------------------------------------------------------------
+2.5 The NERDComment function                             *NERDComNERDComment*
+
+All of the NERD commenter mappings and menu items invoke a single function
+which delegates the commenting work to other functions. This function is
+public and has the prototype: >
+    function! NERDComment(isVisual, type)
+<
+The arguments to this function are simple:
+    - isVisual: if you wish to do any kind of visual comment then set this to
+      1 and the function will use the '< and '> marks to find the comment
+      boundries. If set to 0 then the function will operate on the current
+      line.
+    - type: is used to specify what type of commenting operation is to be
+      performed, and it can be one of the following: "sexy", "invert",
+      "minimal", "toggle", "alignLeft", "alignBoth", "norm", "nested",
+      "toEOL", "append", "insert", "uncomment", "yank"
+
+For example, if you typed >
+    :call NERDComment(1, 'sexy')
+<
+then the script would do a sexy comment on the last visual selection.
+
+
+==============================================================================
+3. Options                                                    *NERDComOptions*
+
+------------------------------------------------------------------------------
+3.1 Options summary                                    *NERDComOptionsSummary*
+
+|'loaded_nerd_comments'|              Turns off the script.
+|'NERDAllowAnyVisualDelims'|          Allows multipart alternative delims to
+                                      be used when commenting in
+                                      visual/visual-block mode.
+|'NERDBlockComIgnoreEmpty'|           Forces right delims to be placed when
+                                      doing visual-block comments.
+|'NERDCommentWholeLinesInVMode'|      Changes behaviour of visual comments.
+|'NERDCreateDefaultMappings'|         Turn the default mappings on/off.
+|'NERDDefaultNesting'|                Tells the script to use nested comments
+                                      by default.
+|'NERDMenuMode'|                      Specifies how the NERD commenter menu
+                                      will appear (if at all).
+|'NERDLPlace'|                        Specifies what to use as the left
+                                      delimiter placeholder when nesting
+                                      comments.
+|'NERDUsePlaceHolders'|               Specifies which filetypes may use
+                                      placeholders when nesting comments.
+|'NERDRemoveAltComs'|                 Tells the script whether to remove
+                                      alternative comment delimiters when
+                                      uncommenting.
+|'NERDRemoveExtraSpaces'|             Tells the script to always remove the
+                                      extra spaces when uncommenting
+                                      (regardless of whether NERDSpaceDelims
+                                      is set)
+|'NERDRPlace'|                        Specifies what to use as the right
+                                      delimiter placeholder when nesting
+                                      comments.
+|'NERDSpaceDelims'|                   Specifies whether to add extra spaces
+                                      around delimiters when commenting, and
+                                      whether to remove them when
+                                      uncommenting.
+|'NERDCompactSexyComs'|               Specifies whether to use the compact
+                                      style sexy comments.
+
+------------------------------------------------------------------------------
+3.3 Options details                                    *NERDComOptionsDetails*
+
+To enable any of the below options you should put the given line in your
+~/.vimrc
+
+                                                       *'loaded_nerd_comments'*
+If this script is driving you insane you can turn it off by setting this
+option >
+    let loaded_nerd_comments=1
+<
+------------------------------------------------------------------------------
+                                                    *'NERDAllowAnyVisualDelims'*
+Values: 0 or 1.
+Default: 1.
+
+If set to 1 then, when doing a visual or visual-block comment (but not a
+visual-line comment), the script will choose the right delimiters to use for
+the comment. This means either using the current delimiters if they are
+multipart or using the alternative delimiters if THEY are multipart.  For
+example if we are editing the following java code: >
+    float foo = 1221;
+    float bar = 324;
+    System.out.println(foo * bar);
+<
+If we are using // comments and select the "foo" and "bar" in visual-block
+mode, as shown left below (where '|'s are used to represent the visual-block
+boundary), and comment it then the script will use the alternative delims as
+shown on the right: >
+
+    float |foo| = 1221;                   float /*foo*/ = 1221;
+    float |bar| = 324;                    float /*bar*/ = 324;
+    System.out.println(foo * bar);        System.out.println(foo * bar);
+<
+------------------------------------------------------------------------------
+                                                     *'NERDBlockComIgnoreEmpty'*
+Values: 0 or 1.
+Default: 1.
+
+This option  affects visual-block mode commenting. If this option is turned
+on, lines that begin outside the right boundary of the selection block will be
+ignored.
+
+For example, if you are commenting this chunk of c code in visual-block mode
+(where the '|'s are used to represent the visual-block boundary) >
+    #include <sys/types.h>
+    #include <unistd.h>
+    #include <stdio.h>
+   |int| main(){
+   |   | printf("SUCK THIS\n");
+   |   | while(1){
+   |   |     fork();
+   |   | }
+   |}  |
+<
+If NERDBlockComIgnoreEmpty=0 then this code will become: >
+    #include <sys/types.h>
+    #include <unistd.h>
+    #include <stdio.h>
+    /*int*/ main(){
+    /*   */ printf("SUCK THIS\n");
+    /*   */ while(1){
+    /*   */     fork();
+    /*   */ }
+    /*}  */
+<
+Otherwise, the code block would become: >
+    #include <sys/types.h>
+    #include <unistd.h>
+    #include <stdio.h>
+    /*int*/ main(){
+    printf("SUCK THIS\n");
+    while(1){
+        fork();
+    }
+    /*}  */
+<
+------------------------------------------------------------------------------
+                                                *'NERDCommentWholeLinesInVMode'*
+Values: 0, 1 or 2.
+Default: 0.
+
+By default the script tries to comment out exactly what is selected in visual
+mode (v). For example if you select and comment the following c code (using |
+to represent the visual boundary): >
+    in|t foo = 3;
+    int bar =| 9;
+    int baz = foo + bar;
+<
+This will result in: >
+    in/*t foo = 3;*/
+    /*int bar =*/ 9;
+    int baz = foo + bar;
+<
+But some people prefer it if the whole lines are commented like: >
+    /*int foo = 3;*/
+    /*int bar = 9;*/
+    int baz = foo + bar;
+<
+If you prefer the second option then stick this line in your vimrc: >
+    let NERDCommentWholeLinesInVMode=1
+<
+
+If the filetype you are editing only has no multipart delimiters (for example
+a shell script) and you hadnt set this option then the above would become >
+    in#t foo = 3;
+    #int bar = 9;
+<
+(where # is the comment delimiter) as this is the closest the script can
+come to commenting out exactly what was selected. If you prefer for whole
+lines to be commented out when there is no multipart delimiters but the EXACT
+text that was selected to be commented out if there IS multipart delimiters
+then stick the following line in your vimrc: >
+    let NERDCommentWholeLinesInVMode=2
+<
+
+Note that this option does not affect the behaviour of commenting in
+|visual-block| mode.
+
+------------------------------------------------------------------------------
+                                                *'NERDCreateDefaultMappings'*
+Values: 0 or 1.
+Default: 1.
+
+If set to 0, none of the default mappings will be created.
+
+See also |NERDComMappings|.
+
+------------------------------------------------------------------------------
+                                                           *'NERDRemoveAltComs'*
+Values: 0 or 1.
+Default: 1.
+
+When uncommenting a line (for a filetype with an alternative commenting style)
+this option tells the script whether to look for, and remove, comment
+delimiters of the alternative style.
+
+For example, if you are editing a c++ file using // style comments and you go
+,cu on this line: >
+    /* This is a c++ comment baby! */
+<
+It will not be uncommented if the NERDRemoveAltComs is set to 0.
+
+------------------------------------------------------------------------------
+                                                       *'NERDRemoveExtraSpaces'*
+Values: 0 or 1.
+Default: 1.
+
+By default, the NERD commenter will remove spaces around comment delimiters if
+either:
+1. |'NERDSpaceDelims'| is set to 1.
+2. NERDRemoveExtraSpaces is set to 1.
+
+This means that if we have the following lines in a c code file: >
+    /* int foo = 5; */
+    /* int bar = 10; */
+    int baz = foo + bar
+<
+If either of the above conditions hold then if these lines are uncommented
+they will become: >
+    int foo = 5;
+    int bar = 10;
+    int baz = foo + bar
+<
+Otherwise they would become: >
+     int foo = 5;
+     int bar = 10;
+    int baz = foo + bar
+<
+If you want the spaces to be removed only if |'NERDSpaceDelims'| is set then
+set NERDRemoveExtraSpaces to 0.
+
+------------------------------------------------------------------------------
+                                                                  *'NERDLPlace'*
+                                                                  *'NERDRPlace'*
+Values: arbitrary string.
+Default:
+    NERDLPlace: "[>"
+    NERDRPlace: "<]"
+
+These options are used to control the strings used as place-holder delimiters.
+Place holder delimiters are used when performing nested commenting when the
+filetype supports commenting styles with both left and right delimiters.
+To set these options use lines like: >
+    let NERDLPlace="FOO"
+    let NERDRPlace="BAR"
+<
+Following the above example, if we have line of c code: >
+    /* int horse */
+<
+and we comment it with ,cn it will be changed to: >
+    /*FOO int horse BAR*/
+<
+When we uncomment this line it will go back to what it was.
+
+------------------------------------------------------------------------------
+                                                                *'NERDMenuMode'*
+Values: 0, 1, 2, 3.
+Default: 3
+
+This option can take 4 values:
+    "0": Turns the menu off.
+    "1": Turns the 'comment' menu on with no menu shortcut.
+    "2": Turns the 'comment 'menu on with <alt>-c as the shortcut.
+    "3": Turns the 'Plugin -> comment' menu on with <alt>-c as the shortcut.
+
+------------------------------------------------------------------------------
+                                                         *'NERDUsePlaceHolders'*
+Values: 0 or 1.
+Default 1.
+
+This option is used to specify whether place-holder delimiters should be used
+when creating a nested comment.
+
+------------------------------------------------------------------------------
+                                                             *'NERDSpaceDelims'*
+Values: 0 or 1.
+Default 0.
+
+Some people prefer a space after the left delimiter and before the right
+delimiter like this: >
+    /* int foo=2; */
+<
+as opposed to this: >
+    /*int foo=2;*/
+<
+If you want spaces to be added then set NERDSpaceDelims to 1 in your vimrc.
+
+See also |'NERDRemoveExtraSpaces'|.
+
+------------------------------------------------------------------------------
+                                                         *'NERDCompactSexyComs'*
+Values: 0 or 1.
+Default 0.
+
+Some people may want their sexy comments to be like this: >
+    /* Hi There!
+     * This is a sexy comment
+     * in c */
+<
+As opposed to like this: >
+    /*
+     * Hi There!
+     * This is a sexy comment
+     * in c
+     */
+<
+If this option is set to 1 then the top style will be used.
+
+------------------------------------------------------------------------------
+                                                          *'NERDDefaultNesting'*
+Values: 0 or 1.
+Default 1.
+
+When this option is set to 1, comments are nested automatically. That is, if
+you hit ,cc on a line that is already commented it will be commented again
+
+------------------------------------------------------------------------------
+3.3 Default delimiter customisation                     *NERDComDefaultDelims*
+
+If you want the NERD commenter to use the alternative delimiters for a
+specific filetype by default then put a line of this form into your vimrc: >
+    let NERD_<filetype>_alt_style=1
+<
+Example: java uses // style comments by default, but you want it to default to
+/* */ style comments instead. You would put this line in your vimrc: >
+    let NERD_java_alt_style=1
+<
+
+See |NERDComAltDelim| for switching commenting styles at runtime.
+
+==============================================================================
+4. Key mapping customisation                                *NERDComMappings*
+
+To change a mapping just map another key combo to the internal <plug> mapping.
+For example, to remap the |NERDComComment| mapping to ",omg" you would put
+this line in your vimrc: >
+    map ,omg <plug>NERDCommenterComment
+<
+This will stop the corresponding default mappings from being created.
+
+See the help for the mapping in question to see which <plug> mapping to
+map to.
+
+See also |'NERDCreateDefaultMappings'|.
+
+==============================================================================
+5. Issues with the script                                      *NERDComIssues*
+
+
+------------------------------------------------------------------------------
+5.1 Delimiter detection heuristics                         *NERDComHeuristics*
+
+Heuristics are used to distinguish the real comment delimiters
+
+Because we have comment mappings that place delimiters in the middle of lines,
+removing comment delimiters is a bit tricky. This is because if comment
+delimiters appear in a line doesnt mean they really ARE delimiters. For
+example, Java uses // comments but the line >
+    System.out.println("//");
+<
+clearly contains no real comment delimiters.
+
+To distinguish between ``real'' comment delimiters and ``fake'' ones we use a
+set of heuristics. For example, one such heuristic states that any comment
+delimiter that has an odd number of non-escaped " characters both preceding
+and following it on the line is not a comment because it is probably part of a
+string. These heuristics, while usually pretty accurate, will not work for all
+cases.
+
+------------------------------------------------------------------------------
+5.2 Nesting issues                                            *NERDComNesting*
+
+If we have some line of code like this: >
+    /*int foo */ = /*5 + 9;*/
+<
+This will not be uncommented legally. The NERD commenter will remove the
+"outter most" delimiters so the line will become: >
+    int foo */ = /*5 + 9;
+<
+which almost certainly will not be what you want. Nested sets of comments will
+uncomment fine though. Eg: >
+    /*int/* foo =*/ 5 + 9;*/
+<
+will become: >
+    int/* foo =*/ 5 + 9;
+<
+(Note that in the above examples I have deliberately not used place holders
+for simplicity)
+
+==============================================================================
+6. About                                                        *NERDComAbout*
+
+The author of the NERD commenter is Martyzillatron --- the half robot, half
+dinosaur bastard son of Megatron and Godzilla. He enjoys destroying
+metropolises and eating tourist busses.
+
+Drop him a line at martin_grenfell at msn.com. He would love to hear from you.
+its a lonely life being the worlds premier terror machine. How would you feel
+if your face looked like a toaster and a t-rex put together? :(
+
+The latest stable versions can be found at
+    http://www.vim.org/scripts/script.php?script_id=1218
+
+The latest dev versions are on github
+    http://github.com/scrooloose/nerdcommenter
+
+==============================================================================
+8. Changelog                                                *NERDComChangelog*
+
+2.2.2
+    - remove the NERDShutup option and the message is suppresses, this makes
+      the plugin silently rely on &commentstring for unknown filetypes.
+    - add support for dhcpd, limits, ntp, resolv, rgb, sysctl, udevconf and
+      udevrules. Thanks to Thilo Six.
+    - match filetypes case insensitively
+    - add support for mp (metapost), thanks to Andrey Skvortsov.
+    - add support for htmlcheetah, thanks to Simon Hengel.
+    - add support for javacc, thanks to Matt Tolton.
+    - make <%# %> the default delims for eruby, thanks to tpope.
+    - add support for javascript.jquery, thanks to Ivan Devat.
+    - add support for cucumber and pdf. Fix sass and railslog delims,
+      thanks to tpope
+
+2.2.1
+    - add support for newlisp and clojure, thanks to Matthew Lee Hinman.
+    - fix automake comments, thanks to Elias Pipping
+    - make haml comments default to -# with / as the alternative delimiter,
+      thanks to tpope
+    - add support for actionscript and processing thanks to Edwin Benavides
+    - add support for ps1 (powershell), thanks to Jason Mills
+    - add support for hostsaccess, thanks to Thomas Rowe
+    - add support for CVScommit
+    - add support for asciidoc, git and gitrebase. Thanks to Simon Ruderich.
+    - use # for gitcommit comments, thanks to Simon Ruderich.
+    - add support for mako and genshi, thanks to Keitheis.
+    - add support for conkyrc, thanks to David
+    - add support for SVNannotate, thanks to Miguel Jaque Barbero.
+    - add support for sieve, thanks to Stefan Walk
+    - add support for objj, thanks to Adam Thorsen.
+
+2.2.0
+    - rewrote the mappings system to be more "standard".
+      - removed all the mapping options. Now, mappings to <plug> mappings are
+        used
+      - see :help NERDComMappings, and :help NERDCreateDefaultMappings for
+        more info
+    - remove "prepend comments" and "right aligned comments".
+    - add support for applescript, calbire, man, SVNcommit, potwiki, txt2tags and SVNinfo.
+      Thanks to nicothakis, timberke, sgronblo, mntnoe, Bernhard Grotz, John
+      O'Shea, François and Giacomo Mariani respectively.
+    - bugfix for haskell delimiters. Thanks to mntnoe.
+2.1.18
+    - add support for llvm. Thanks to nicothakis.
+    - add support for xquery. Thanks to Phillip Kovalev.
+2.1.17
+    - fixed haskell delimiters (hackily). Thanks to Elias Pipping.
+    - add support for mailcap. Thanks to Pascal Brueckner.
+    - add support for stata. Thanks to Jerónimo Carballo.
+    - applied a patch from ewfalor to fix an error in the help file with the
+      NERDMapleader doc
+    - disable the insert mode ctrl-c mapping by default, see :help
+      NERDComInsertComment if you wish to restore it
+
+==============================================================================
+8. Credits                                                    *NERDComCredits*
+
+Thanks to the follow people for suggestions and patches:
+
+Nick Brettell
+Matthew Hawkins
+Mathieu Clabaut
+Greg Searle
+Nguyen
+Litchi
+Jorge Scandaliaris
+Shufeng Zheng
+Martin Stubenschrott
+Markus Erlmann
+Brent Rice
+Richard Willis
+Igor Prischepoff
+Harry
+David Bourgeois
+Eike Von Seggern
+Torsten Blix
+Alexander Bosecke
+Stefano Zacchiroli
+Norick Chen
+Joseph Barker
+Gary Church
+Tim Carey-Smith
+Markus Klinik
+Anders
+Seth Mason
+James Hales
+Heptite
+Cheng Fang
+Yongwei Wu
+David Miani
+Jeremy Hinegardner
+Marco
+Ingo Karkat
+Zhang Shuhan
+tpope
+Ben Schmidt
+David Fishburn
+Erik Falor
+JaGoTerr
+Elias Pipping
+mntnoe
+Mark S.
+
+
+Thanks to the following people for sending me new filetypes to support:
+
+The hackers                         The filetypes~
+Sam R                               verilog
+Jonathan                            Derque context, plaintext and mail
+Vigil                               fetchmail
+Michael Brunner                     kconfig
+Antono Vasiljev                     netdict
+Melissa Reid                        omlet
+Ilia N Ternovich                    quickfix
+John O'Shea                         RTF, SVNcommitlog and vcscommit, SVNCommit
+Anders                              occam
+Mark Woodward                       csv
+fREW                                gentoo-package-mask,
+                                    gentoo-package-keywords,
+                                    gentoo-package-use, and vo_base
+Alexey                              verilog_systemverilog, systemverilog
+Lizendir                            fstab
+Michael Böhler                      autoit, autohotkey and docbk
+Aaron Small                         cmake
+Ramiro                              htmldjango and django
+Stefano Zacchiroli                  debcontrol, debchangelog, mkd
+Alex Tarkovsky                      ebuild and eclass
+Jorge Rodrigues                     gams
+Rainer Müller                       Objective C
+Jason Mills                         Groovy, ps1
+Normandie Azucena                   vera
+Florian Apolloner                   ldif
+David Fishburn                      lookupfile
+Niels Aan de Brugh                  rst
+Don Hatlestad                       ahk
+Christophe Benz                     Desktop and xsd
+Eyolf Østrem                        lilypond, bbx and lytex
+Ingo Karkat                         dosbatch
+Nicolas Weber                       markdown, objcpp
+tinoucas                            gentoo-conf-d
+Greg Weber                          D, haml
+Bruce Sherrod                       velocity
+timberke                            cobol, calibre
+Aaron Schaefer                      factor
+Mr X                                asterisk, mplayerconf
+Kuchma Michael                      plsql
+Brett Warneke                       spectre
+Pipp                                lhaskell
+Renald Buter                        scala
+Vladimir Lomov                      asymptote
+Marco                               mrxvtrc, aap
+nicothakis                          SVNAnnotate, CVSAnnotate, SVKAnnotate,
+                                    SVNdiff, gitAnnotate, gitdiff, dtrace
+                                    llvm, applescript
+Chen Xing                           Wikipedia
+Jacobo Diaz                         dakota, patran
+Li Jin                              gentoo-env-d, gentoo-init-d,
+                                    gentoo-make-conf, grub, modconf, sudoers
+SpookeyPeanut                       rib
+Greg Jandl                          pyrex/cython
+Christophe Benz                     services, gitcommit
+A Pontus                            vimperator
+Stromnov                            slice, bzr
+Martin Kustermann                   pamconf
+Indriði Einarsson                   mason
+Chris                               map
+Krzysztof A. Adamski                group
+Pascal Brueckner                    mailcap
+Jerónimo Carballo                   stata
+Phillip Kovalev                     xquery
+Bernhard Grotz                      potwiki
+sgronblo                            man
+François                            txt2tags
+Giacomo Mariani                     SVNinfo
+Matthew Lee Hinman                  newlisp, clojure
+Elias Pipping                       automake
+Edwin Benavides                     actionscript, processing
+Thomas Rowe                         hostsaccess
+Simon Ruderich                      asciidoc, git, gitcommit, gitrebase
+Keitheis                            mako, genshi
+David                               conkyrc
+Miguel Jaque Barbero                SVNannotate
+Stefan Walk                         sieve
+Adam Thorsen                        objj
+Thilo Six                           dhcpd, limits, ntp, resolv, rgb, sysctl,
+                                    udevconf, udevrules
+Andrey Skvortsov                    mp
+Simon Hengel                        htmlcheetah
+Matt Tolton                         javacc
+Ivan Devat                          javascript.jquery
+tpope                               cucumber,pdf
+==============================================================================
+9. License                                                    *NERDComLicense*
+
+The NERD commenter is released under the wtfpl.
+See http://sam.zoy.org/wtfpl/COPYING.
diff --git a/etc/vim/doc/tags b/etc/vim/doc/tags
new file mode 100644 (file)
index 0000000..0c92c9c
--- /dev/null
@@ -0,0 +1,63 @@
+'NERDAllowAnyVisualDelims'     NERD_commenter.txt      /*'NERDAllowAnyVisualDelims'*
+'NERDBlockComIgnoreEmpty'      NERD_commenter.txt      /*'NERDBlockComIgnoreEmpty'*
+'NERDCommentWholeLinesInVMode' NERD_commenter.txt      /*'NERDCommentWholeLinesInVMode'*
+'NERDCompactSexyComs'  NERD_commenter.txt      /*'NERDCompactSexyComs'*
+'NERDCreateDefaultMappings'    NERD_commenter.txt      /*'NERDCreateDefaultMappings'*
+'NERDDefaultNesting'   NERD_commenter.txt      /*'NERDDefaultNesting'*
+'NERDLPlace'   NERD_commenter.txt      /*'NERDLPlace'*
+'NERDMenuMode' NERD_commenter.txt      /*'NERDMenuMode'*
+'NERDRPlace'   NERD_commenter.txt      /*'NERDRPlace'*
+'NERDRemoveAltComs'    NERD_commenter.txt      /*'NERDRemoveAltComs'*
+'NERDRemoveExtraSpaces'        NERD_commenter.txt      /*'NERDRemoveExtraSpaces'*
+'NERDSpaceDelims'      NERD_commenter.txt      /*'NERDSpaceDelims'*
+'NERDUsePlaceHolders'  NERD_commenter.txt      /*'NERDUsePlaceHolders'*
+'loaded_nerd_comments' NERD_commenter.txt      /*'loaded_nerd_comments'*
+NERDComAbout   NERD_commenter.txt      /*NERDComAbout*
+NERDComAlignedComment  NERD_commenter.txt      /*NERDComAlignedComment*
+NERDComAltDelim        NERD_commenter.txt      /*NERDComAltDelim*
+NERDComAppendComment   NERD_commenter.txt      /*NERDComAppendComment*
+NERDComChangelog       NERD_commenter.txt      /*NERDComChangelog*
+NERDComComment NERD_commenter.txt      /*NERDComComment*
+NERDComCredits NERD_commenter.txt      /*NERDComCredits*
+NERDComDefaultDelims   NERD_commenter.txt      /*NERDComDefaultDelims*
+NERDComEOLComment      NERD_commenter.txt      /*NERDComEOLComment*
+NERDComFiletypes       NERD_commenter.txt      /*NERDComFiletypes*
+NERDComFunctionality   NERD_commenter.txt      /*NERDComFunctionality*
+NERDComFunctionalityDetails    NERD_commenter.txt      /*NERDComFunctionalityDetails*
+NERDComFunctionalitySummary    NERD_commenter.txt      /*NERDComFunctionalitySummary*
+NERDComHeuristics      NERD_commenter.txt      /*NERDComHeuristics*
+NERDComInsertComment   NERD_commenter.txt      /*NERDComInsertComment*
+NERDComInvertComment   NERD_commenter.txt      /*NERDComInvertComment*
+NERDComIssues  NERD_commenter.txt      /*NERDComIssues*
+NERDComLicense NERD_commenter.txt      /*NERDComLicense*
+NERDComMappings        NERD_commenter.txt      /*NERDComMappings*
+NERDComMinimalComment  NERD_commenter.txt      /*NERDComMinimalComment*
+NERDComNERDComment     NERD_commenter.txt      /*NERDComNERDComment*
+NERDComNestedComment   NERD_commenter.txt      /*NERDComNestedComment*
+NERDComNesting NERD_commenter.txt      /*NERDComNesting*
+NERDComOptions NERD_commenter.txt      /*NERDComOptions*
+NERDComOptionsDetails  NERD_commenter.txt      /*NERDComOptionsDetails*
+NERDComOptionsSummary  NERD_commenter.txt      /*NERDComOptionsSummary*
+NERDComSexyComment     NERD_commenter.txt      /*NERDComSexyComment*
+NERDComSexyComments    NERD_commenter.txt      /*NERDComSexyComments*
+NERDComToggleComment   NERD_commenter.txt      /*NERDComToggleComment*
+NERDComUncommentLine   NERD_commenter.txt      /*NERDComUncommentLine*
+NERDComYankComment     NERD_commenter.txt      /*NERDComYankComment*
+NERDCommenter  NERD_commenter.txt      /*NERDCommenter*
+NERDCommenterContents  NERD_commenter.txt      /*NERDCommenterContents*
+NERD_commenter.txt     NERD_commenter.txt      /*NERD_commenter.txt*
+int/   NERD_commenter.txt      /*int\/*
+vimplate       vimplate.txt    /*vimplate*
+vimplate-contents      vimplate.txt    /*vimplate-contents*
+vimplate-description   vimplate.txt    /*vimplate-description*
+vimplate-documentation vimplate.txt    /*vimplate-documentation*
+vimplate-example       vimplate.txt    /*vimplate-example*
+vimplate-installation  vimplate.txt    /*vimplate-installation*
+vimplate-requirements  vimplate.txt    /*vimplate-requirements*
+vimplate-subroutines   vimplate.txt    /*vimplate-subroutines*
+vimplate-usage vimplate.txt    /*vimplate-usage*
+xml-plugin-callbacks   xml-plugin.txt  /*xml-plugin-callbacks*
+xml-plugin-html        xml-plugin.txt  /*xml-plugin-html*
+xml-plugin-mappings    xml-plugin.txt  /*xml-plugin-mappings*
+xml-plugin-settings    xml-plugin.txt  /*xml-plugin-settings*
+xml-plugin.txt xml-plugin.txt  /*xml-plugin.txt*
diff --git a/etc/vim/doc/vimplate.txt b/etc/vim/doc/vimplate.txt
new file mode 100644 (file)
index 0000000..4fcd721
--- /dev/null
@@ -0,0 +1,350 @@
+*vimplate*   vimplate - vim template   (example for C++, Perl, LaTeX and make)
+
+Author:      Urs Stotz <stotz@gmx.ch>
+Last change: 2005 August 20
+
+==============================================================================
+1. Contents                                              *vimplate-contents*
+===========
+ 1. Contents.................: |vimplate-contents|
+ 2. Description..............: |vimplate-description|
+ 3. Usage....................: |vimplate-usage|
+ 4. Subroutines..............: |vimplate-subroutines|
+ 5. Example..................: |vimplate-example|
+ 6. Requirements.............: |vimplate-requirements|
+ 7. Documentation............: |vimplate-documentation|
+
+==============================================================================
+2. Description                                        *vimplate-description*
+==============
+Vimplate provides an extensible and powerful template processing system.
+It is based on Perl and Template-Toolkit.
+You can create templates for program code, makefiles, letters, html pages,
+latex etc. As example vimplate contains templates for C++, LaTeX, Perl
+and Makefile.
+With vimplate you can write templates which interact with the user.
+For themes are the functions choice() and input().
+You can choose different locale for the function date() and locale().
+You can write your own perl code directly in the templates.
+
+In case you find my template useful,
+or have suggestions for improvements, please let me know.
+
+If you write a new template,
+and  would like me to add it to the vimplate package
+please send it to: stotz@gmx.ch
+
+==============================================================================
+3. Usage                                                    *vimplate-usage*
+========
+Usage:
+  :Vimplate <template> [options]
+    choice <template> whit <TAB> (command line completion is supported).
+    With <TAB> all templates are listed.
+    [options]
+      -user|u=<username>
+        Use the information form user <username> while parsing templates.
+      -dir|d=<templatedir>
+        Search templatefiles in <templatedir>.
+
+==============================================================================
+4. Subroutines                                         *vimplate-subroutines*
+==============
+  locale()                  for locale please see: man locale
+  [% loc=locale() %]        get the current locale
+                              and write it to the variable loc
+  [% locale('C') %]         set global the current locale to C
+  [% locale('de_DE') %]     set global the current locale to de_DE
+  date()                    for date please see: man date
+  [% date('%c') %]          print the current date
+                              with the current locale setting
+  [% date('de_DE', '%c') %] print the current date with the locale de_DE
+  input()
+  [% var=input() %]         read input from user
+                              and write it to the variable var
+  choice()
+  [% day=choice('day:', 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa') %]
+                            let the user choice between different values
+                            and write it to the variable day
+
+  please try :Vimplate Test
+
+==============================================================================
+5. Example                                                *vimplate-example*
+==========
+
+Example:
+  the template letter.tt:
+    ________________________________________________________
+    [%
+       sex=choice('sex: ', 'female', 'male')
+       name=input('name: ')
+       location=input('your location: ')
+    -%]
+                       [% ucfirst(location) %], [% date('C', '%b %d, %Y') %]
+
+    Dear [% IF sex=='female'; 'Ms'; ELSE; 'Mr'; END %] [% ucfirst(name) %]
+
+    ...
+
+    Sincerely
+
+    [% user.firstname %] [% user.lastname %]
+    ________________________________________________________
+
+  run vim:
+    :Vimplate letter
+    sex: 
+      0) female
+      1) male
+    0
+    name: Meier
+    your location: Olten
+
+  your input was: 
+    :Vimplate letter<CR>0<CR>Meier<CR>Olten<CR>
+
+  this will produce this letter:
+    ________________________________________________________
+                                      Olten, Jul 11, 2005
+
+    Dear Ms Meier
+
+    ...
+
+    Sincerely
+
+    Urs Stotz
+    ________________________________________________________
+
+Example:
+  the template hpp-default.tt:
+    ________________________________________________________
+    [% classname=input('Class name: ')
+       doxygen=choice('with Doxygen comments: ', 'no', 'yes')
+    -%]
+    #ifndef [% uc(classname) %]_HPP
+    #define [% uc(classname) %]_HPP
+
+    [% IF doxygen=='yes' -%]
+    /**
+     * @brief [% classname %] ... short description ...
+     * @author [% user.firstname %] [% user.lastname %] <[% user.mail %]>
+     * @date [% date('%Y-%m-%d') %]
+     * ... description ...
+     */
+
+    [% END -%]
+    class [% classname %]
+    {
+      public:
+    [% IF doxygen=='yes' -%]
+
+        /**
+         * Default constructor
+         */
+    [% END -%]
+        [% classname %]();
+    [% IF doxygen=='yes' -%]
+
+        /**
+         * Copy constructor
+         * @param other reference on object to copy
+         */
+    [% END -%]
+        [% classname %](const [% classname %]& other);
+    [% IF doxygen=='yes' -%]
+
+        /** 
+         * Assignment operator
+         * @param other reference on object to copy
+         * @return reference on initialisated object
+         */
+    [% END -%]
+        [% classname %]& operator=(const [% classname %]& other);
+    [% IF doxygen=='yes' -%]
+    
+        /**
+         * Destructor
+         */
+    [% END -%]
+        virtual ~[% classname %]();
+    
+      private:
+    [% IF doxygen=='yes' -%]
+    
+        /**
+         * Base initialisation should be called
+         * at beginning of each constructor
+         */
+    [% END -%]
+        void init();
+    [% IF doxygen=='yes' -%]
+
+    /**
+     * Method to copy each member (deep copy)
+     * @param other reference on object to copy
+     */
+    [% END -%]
+        void init(const [% classname %]& other);
+    };
+
+    #endif /* #ifndef [% uc(classname) %]_HPP */
+    ________________________________________________________
+
+  run vim:
+    :Vimplate hpp-default
+    Class name: Parent
+    with Doxygen comments: 
+      0) no
+      1) yes
+    1
+
+  your input was: 
+    :Vimplate hpp-default<CR>Parent<CR>1<CR>
+
+  this will produce this c++ include file:
+    ________________________________________________________
+    #ifndef PARENT_HPP
+    #define PARENT_HPP
+
+    /**
+     * @brief Parent ... short description ...
+     * @author Urs Stotz <stotz@gmx.ch>
+     * @date 2005-07-18
+     * ... description ...
+     */
+
+    class Parent
+    {
+      public:
+
+        /**
+         * Default constructor
+         */
+        Parent();
+
+        /**
+         * Copy constructor
+         * @param other reference on object to copy
+         */
+        Parent(const Parent& other);
+
+        /** 
+         * Assignment operator
+         * @param other reference on object to copy
+         * @return reference on initialisated object
+         */
+        Parent& operator=(const Parent& other);
+
+        /**
+         * Destructor
+         */
+        virtual ~Parent();
+
+      private:
+
+        /**
+         * Base initialisation should be called
+         * at beginning of each constructor
+         */
+        void init();
+
+        /**
+         * Method to copy each member (deep copy)
+         * @param other reference on object to copy
+         */
+        void init(const Parent& other);
+    };
+
+    #endif /* #ifndef PARENT_HPP */
+    ________________________________________________________
+
+==============================================================================
+6. Requirements                                      *vimplate-requirements*
+===============
+  Perl
+    http://www.perl.org
+    Windows users:
+      http://www.activestate.com/Products/ActivePerl
+  Template-Toolkit
+    http://search.cpan.org/~abw/Template-Toolkit-2.14
+    or apt-get install libtemplate-perl
+    or perl -MCPAN -e"install Template"
+    Windows users:
+      ppm install
+        http://openinteract.sourceforge.net/ppmpackages/AppConfig.ppd
+      ppm install
+        http://openinteract.sourceforge.net/ppmpackages/Template-Toolkit.ppd
+
+==============================================================================
+7. Documentation                                    *vimplate-documentation*
+================
+Documentation:
+  - http://www.template-toolkit.org/docs.html
+  - http://perldoc.perl.org/perl.html
+
+Todo:
+  - better exception handling
+  - write more templates
+
+License:
+  This program is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License, version 2, as published
+  by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+
+  A copy of the GNU GPL is available as /usr/share/common-licenses/GPL-2
+  on Debian systems, or on the World Wide Web at
+  http://www.gnu.org/copyleft/gpl.html
+  You can also obtain it by writing to the Free Software Foundation, Inc.,
+  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+Copyright:
+  Copyright (c) 2005, Urs Stotz <stotz@gmx.ch>
+
+Version:
+  vimplate 0.2.3
+
+==============================================================================
+8. Installation                                      *vimplate-installation*
+===============
+Depends:
+  Perl:
+    http://www.perl.org
+  Template-Toolkit:
+    http://search.cpan.org/~abw/Template-Toolkit-2.14
+
+Suggests:
+  TT2 syntax:
+    http://www.vim.org/scripts/script.php?script_id=830
+
+Installation steps:
+  1. change to your $HOME/.vim directory
+       (on windows: set the variable HOME 
+         set HOME=c:\vim)
+  2. untar vimplate.tar.gz: gzip -dc vimplate.tar.gz |tar xpvf -
+  3. move the vimplate into your preferred directory
+      for example in $HOME/bin or /usr/local/bin
+  4. move the directory Template with the example templates
+      to the place that you prefer
+  5. edit your $HOME/.vimrc and set the variable Vimplate to
+      to the place where vimplate is located
+      for example let Vimplate = "$HOME/bin/vimplate"
+        (on windows: let Vimplate = "$HOME/bin/vimplate.cmd" )
+  6. run vimplate to create your configuration file $HOME/.vimplaterc
+      for example $HOME/bin/vimplate -createconfig
+        (on windows: $HOME/bin/vimplate.cmd -createconfig" )
+  7. edit your $HOME/.vimplaterc
+       (on windows: $HOME/_vimplaterc)
+  8. change to the $HOME/.vim/doc directory,
+      start Vim and run the ":helptags ." command to process the
+      taglist help file. (see: |helptags| )
+  9. happy vimplating
+==============================================================================
+
+vim:tw=78:ts=2:ft=help
diff --git a/etc/vim/doc/xml-plugin.txt b/etc/vim/doc/xml-plugin.txt
new file mode 100644 (file)
index 0000000..31c22bc
--- /dev/null
@@ -0,0 +1,226 @@
+*xml-plugin.txt*  Help edit XML and SGML documents.                   v1.84
+
+                                   XML Edit      ~
+
+A filetype plugin to help edit XML and SGML documents.
+
+This script provides some convenience when editing XML (and some SGML
+including HTML) formated documents. It allows you to jump to the beginning
+or end of the tag block your cursor is in. '%' will jump between '<' and '>'
+within the tag your cursor is in. When in insert mode and you finish a tag
+(pressing '>') the tag will be completed. If you press '>' twice it will
+complete the tag and place the cursor in the middle of the tags on it's own
+line (helps with nested tags).
+
+Usage: Place this file into your ftplugin directory. To add html support
+Sym-link or copy this file to html.vim in your ftplugin directory. To activte
+the script place 'filetype plugin on' in your |.vimrc| file. See |ftplugins|
+for more information on this topic.
+
+If the file edited is of type "html" and "xml_use_html" is  defined then the
+following tags will not auto complete:
+<img>, <input>, <param>, <frame>, <br>, <hr>, <meta>, <link>, <base>, <area>
+
+If the file edited is of type 'html' and 'xml_use_xhtml' is defined the above
+tags will autocomplete the xml closing staying xhtml compatable.
+ex. <hr> becomes <hr /> (see |xml-plugin-settings|)
+
+NOTE: If you used the VIM 5.x version of this file (xmledit.vim) you'll need
+to comment out the section where you called it. It is no longer used in the
+VIM 6.x version. 
+
+Known Bugs      ~
+
+- This script will modify registers ". and "x; register "" will be restored.
+- < & > marks inside of a CDATA section are interpreted as actual XML tags
+  even if unmatched.
+- Although the script can handle leading spaces such as < tag></ tag> it is
+  illegal XML syntax and considered very bad form.
+- Placing a literal `>' in an attribute value will auto complete dispite that
+  the start tag isn't finished. This is poor XML anyway you should use
+  &gt; instead.
+- The matching algorithm can handle illegal tag characters where as the tag
+  completion algorithm can not.
+
+------------------------------------------------------------------------------
+                                                         *xml-plugin-mappings*
+Mappings      ~
+
+<LocalLeader> is a setting in VIM that depicts a prefix for scripts and
+plugins to use. By default this is the backslash key `\'. See |mapleader|
+for details.
+
+<LocalLeader><Space>
+        Normal or Insert - Continue editing after the ending tag. This
+        option requires xml_jump_string to be set to function. When a tag
+        is completed it will append the xml_jump_string. Once this mapping
+        is ran it will delete the next xml_jump_string pattern to the right
+        of the curser and delete it leaving you in insert mode to continue
+        editing.
+
+<LocalLeader>w
+        Normal - Will clear the entire file of left over xml_jump_string garbage.
+        * This will also happen automatically when you save the file. *
+
+<LocalLeader>x
+        Visual - Place a custom XML tag to suround the selected text. You
+        need to have selected text in visual mode before you can use this
+        mapping. See |visual-mode| for details.
+
+<LocalLeader>.   or      <LocalLeader>>
+        Insert - Place a literal '>' without parsing tag.
+
+<LocalLeader>5   or      <LocalLeader>%
+        Normal or Visual - Jump to the begining or end tag.
+
+<LocalLeader>d
+        Normal - Deletes the surrounding tags from the cursor. >
+            <tag1>outter <tag2>inner text</tag2> text</tag1>
+                    ^
+<       Turns to: >
+            outter <tag2>inner text</tag2> text
+            ^
+<
+
+------------------------------------------------------------------------------
+                                                         *xml-plugin-settings*
+Options      ~
+
+(All options must be placed in your |.vimrc| prior to the |ftplugin|
+command.)
+
+xml_tag_completion_map
+        Use this setting to change the default mapping to auto complete a
+        tag. By default typing a literal `>' will cause the tag your editing
+        to auto complete; pressing twice will auto nest the tag. By using
+        this setting the `>' will be a literal `>' and you must use the new
+        mapping to perform auto completion and auto nesting. For example if
+        you wanted Control-L to perform auto completion inmstead of typing a
+        `>' place the following into your .vimrc: >
+            let xml_tag_completion_map = "<C-l>"
+<
+xml_no_auto_nesting
+        This turns off the auto nesting feature. After a completion is made
+        and another `>' is typed xml-edit automatically will break the tag
+        accross multiple lines and indent the curser to make creating nested
+        tqags easier. This feature turns it off. Enter the following in your
+        .vimrc: >
+            let xml_no_auto_nesting = 1
+<
+xml_use_xhtml
+        When editing HTML this will auto close the short tags to make valid
+        XML like <hr /> and <br />. Enter the following in your vimrc to
+        turn this option on: >
+            let xml_use_xhtml = 1
+<
+xml_no_html
+        This turns off the support for HTML specific tags. Place this in your
+        .vimrc: >
+            let xml_no_html = 1
+<
+xml_jump_string
+        This turns off the support for continuing edits after an ending tag.
+        xml_jump_string can be any string how ever a simple character will
+        suffice. Pick a character or small string that is unique and will
+        not interfer with your normal editing. See the <LocalLeader>Space
+        mapping for more.
+        .vimrc: >
+            let xml_jump_string = "`"
+<
+------------------------------------------------------------------------------
+                                                        *xml-plugin-callbacks*
+Callback Functions      ~
+
+A callback function is a function used to customize features on a per tag
+basis. For example say you wish to have a default set of attributs when you
+type an empty tag like this:
+    You type: <tag>
+    You get:  <tag default="attributes"></tag>
+
+This is for any script programmers who wish to add xml-plugin support to
+there own filetype plugins.
+
+Callback functions recive one attribute variable which is the tag name. The
+all must return either a string or the number zero. If it returns a string
+the plugin will place the string in the proper location. If it is a zero the
+plugin will ignore and continue as if no callback existed.
+
+The following are implemented callback functions:
+
+HtmlAttribCallback
+        This is used to add default attributes to html tag. It is intended
+        for HTML files only.
+
+XmlAttribCallback
+        This is a generic callback for xml tags intended to add attributes.
+
+                                                             *xml-plugin-html*
+Callback Example      ~
+
+The following is an example of using XmlAttribCallback in your .vimrc
+>
+        function XmlAttribCallback (xml_tag)
+            if a:xml_tag ==? "my-xml-tag"
+                return "attributes=\"my xml attributes\""
+            else
+                return 0
+            endif
+        endfunction
+<
+The following is a sample html.vim file type plugin you could use:
+>
+  " Vim script file                                       vim600:fdm=marker:
+  " FileType:   HTML
+  " Maintainer: Devin Weaver <vim (at) tritarget.com>
+  " Location:   http://www.vim.org/scripts/script.php?script_id=301
+
+  " This is a wrapper script to add extra html support to xml documents.
+  " Original script can be seen in xml-plugin documentation.
+
+  " Only do this when not done yet for this buffer
+  if exists("b:did_ftplugin")
+    finish
+  endif
+  " Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability.
+
+  let b:html_mode = 1
+
+  if !exists("*HtmlAttribCallback")
+  function HtmlAttribCallback( xml_tag )
+      if a:xml_tag ==? "table"
+          return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\""
+      elseif a:xml_tag ==? "link"
+          return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\""
+      elseif a:xml_tag ==? "body"
+          return "bgcolor=\"white\""
+      elseif a:xml_tag ==? "frame"
+          return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize"
+      elseif a:xml_tag ==? "frameset"
+          return "rows=\"0,*\" cols=\"*,0\" border=\"0\""
+      elseif a:xml_tag ==? "img"
+          return "src=\"\" width=\"0\" height=\"0\" border=\"0\" alt=\"\""
+      elseif a:xml_tag ==? "a"
+          if has("browse")
+              " Look up a file to fill the href. Used in local relative file
+              " links. typeing your own href before closing the tag with `>'
+              " will override this.
+              let cwd = getcwd()
+              let cwd = substitute (cwd, "\\", "/", "g")
+              let href = browse (0, "Link to href...", getcwd(), "")
+              let href = substitute (href, cwd . "/", "", "")
+              let href = substitute (href, " ", "%20", "g")
+          else
+              let href = ""
+          endif
+          return "href=\"" . href . "\""
+      else
+          return 0
+      endif
+  endfunction
+  endif
+
+  " On to loading xml.vim
+  runtime ftplugin/xml.vim
+<
+
+ vim:tw=78:ts=8:ft=help:norl:
diff --git a/etc/vim/ftdetect/puppet.vim b/etc/vim/ftdetect/puppet.vim
new file mode 100644 (file)
index 0000000..c9d15ea
--- /dev/null
@@ -0,0 +1,2 @@
+" detect puppet filetype
+au BufRead,BufNewFile *.pp              set filetype=puppet
diff --git a/etc/vim/ftplugin/xml.vim b/etc/vim/ftplugin/xml.vim
new file mode 100644 (file)
index 0000000..eab13f7
--- /dev/null
@@ -0,0 +1,940 @@
+" Vim script file                                           vim600:fdm=marker:
+" FileType:     XML
+" Author:       Devin Weaver <suki (at) tritarget.com> 
+" Maintainer:   Devin Weaver <suki (at) tritarget.com>
+" Last Change:  Tue Apr 07 11:12:08 EDT 2009
+" Version:      1.84
+" Location:     http://www.vim.org/scripts/script.php?script_id=301
+" Licence:      This program is free software; you can redistribute it
+"               and/or modify it under the terms of the GNU General Public
+"               License.  See http://www.gnu.org/copyleft/gpl.txt
+" Credits:      Brad Phelan <bphelan (at) mathworks.co.uk> for completing
+"                 tag matching and visual tag completion.
+"               Ma, Xiangjiang <Xiangjiang.Ma (at) broadvision.com> for
+"                 pointing out VIM 6.0 map <buffer> feature.
+"               Luc Hermitte <hermitte (at) free.fr> for testing the self
+"                 install documentation code and providing good bug fixes.
+"               Guo-Peng Wen for the self install documentation code.
+"               Shawn Boles <ickybots (at) gmail.com> for fixing the
+"                 <Leader>x cancelation bug. 
+"               Martijn van der Kwast <mvdkwast@gmx.net> for patching
+"                 problems with multi-languages (XML and PHP).
+
+" This script provides some convenience when editing XML (and some SGML)
+" formated documents.
+
+" Section: Documentation 
+" ----------------------
+"
+" Documentation should be available by ":help xml-plugin" command, once the
+" script has been copied in you .vim/plugin directory.
+"
+" You still can read the documentation at the end of this file. Locate it by
+" searching the "xml-plugin" string (and set ft=help to have
+" appropriate syntaxic coloration). 
+
+" Note: If you used the 5.x version of this file (xmledit.vim) you'll need to
+" comment out the section where you called it since it is no longer used in
+" version 6.x. 
+
+" TODO: Revamp ParseTag to pull appart a tag a rebuild it properly.
+" a tag like: <  test  nowrap  testatt=foo   >
+" should be fixed to: <test nowrap="nowrap" testatt="foo"></test>
+
+"==============================================================================
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin") || exists("loaded_xml_ftplugin")
+  finish
+endif
+" sboles, init these variables so vim doesn't complain on wrap cancel
+let b:last_wrap_tag_used = ""
+let b:last_wrap_atts_used = ""
+
+" WrapTag -> Places an XML tag around a visual selection.            {{{1
+" Brad Phelan: Wrap the argument in an XML tag
+" Added nice GUI support to the dialogs. 
+" Rewrote function to implement new algorythem that addresses several bugs.
+if !exists("*s:WrapTag") 
+function s:WrapTag(text)
+    if (line(".") < line("'<"))
+        let insert_cmd = "o"
+    elseif (col(".") < col("'<"))
+        let insert_cmd = "a"
+    else
+        let insert_cmd = "i"
+    endif
+    if strlen(a:text) > 10
+        let input_text = strpart(a:text, 0, 10) . '...'
+    else
+        let input_text = a:text
+    endif
+    let wraptag = inputdialog('Tag to wrap "' . input_text . '" : ')
+    if strlen(wraptag)==0
+        if strlen(b:last_wrap_tag_used)==0
+            undo
+            return
+        endif
+        let wraptag = b:last_wrap_tag_used
+        let atts = b:last_wrap_atts_used
+    else
+        let atts = inputdialog('Attributes in <' . wraptag . '> : ')
+    endif
+    if (visualmode() ==# 'V')
+        let text = strpart(a:text,0,strlen(a:text)-1)
+        if (insert_cmd ==# "o")
+            let eol_cmd = ""
+        else
+            let eol_cmd = "\<Cr>"
+        endif
+    else
+        let text = a:text
+        let eol_cmd = ""
+    endif
+    if strlen(atts)==0
+        let text = "<".wraptag.">".text."</".wraptag.">"
+        let b:last_wrap_tag_used = wraptag
+        let b:last_wrap_atts_used = ""
+    else
+        let text = "<".wraptag." ".atts.">".text."</".wraptag.">"
+        let b:last_wrap_tag_used = wraptag
+        let b:last_wrap_atts_used = atts
+    endif
+    execute "normal! ".insert_cmd.text.eol_cmd
+endfunction
+endif
+
+" NewFileXML -> Inserts <?xml?> at top of new file.                  {{{1
+if !exists("*s:NewFileXML")
+function s:NewFileXML( )
+    " Where is g:did_xhtmlcf_inits defined?
+    if &filetype == 'docbk' || &filetype == 'xml' || (!exists ("g:did_xhtmlcf_inits") && exists ("g:xml_use_xhtml") && (&filetype == 'html' || &filetype == 'xhtml'))
+        if append (0, '<?xml version="1.0"?>')
+            normal! G
+        endif
+    endif
+endfunction
+endif
+
+
+" Callback -> Checks for tag callbacks and executes them.            {{{1
+if !exists("*s:Callback")
+function s:Callback( xml_tag, isHtml )
+    let text = 0
+    if a:isHtml == 1 && exists ("*HtmlAttribCallback")
+        let text = HtmlAttribCallback (a:xml_tag)
+    elseif exists ("*XmlAttribCallback")
+        let text = XmlAttribCallback (a:xml_tag)
+    endif       
+    if text != '0'
+        execute "normal! i " . text ."\<Esc>l"
+    endif
+endfunction
+endif
+
+
+" IsParsableTag -> Check to see if the tag is a real tag.            {{{1
+if !exists("*s:IsParsableTag")
+function s:IsParsableTag( tag )
+    " The "Should I parse?" flag.
+    let parse = 1
+
+    " make sure a:tag has a proper tag in it and is not a instruction or end tag.
+    if a:tag !~ '^<[[:alnum:]_:\-].*>$'
+        let parse = 0
+    endif
+
+    " make sure this tag isn't already closed.
+    if strpart (a:tag, strlen (a:tag) - 2, 1) == '/'
+        let parse = 0
+    endif
+    
+    return parse
+endfunction
+endif
+
+
+" ParseTag -> The major work hourse for tag completion.              {{{1
+if !exists("*s:ParseTag")
+function s:ParseTag( )
+    " Save registers
+    let old_reg_save = @"
+    let old_save_x   = @x
+
+    if (!exists("g:xml_no_auto_nesting") && strpart (getline ("."), col (".") - 2, 2) == '>>')
+        let multi_line = 1
+        execute "normal! \"xX"
+    else
+        let multi_line = 0
+    endif
+
+    let @" = ""
+    execute "normal! \"xy%%"
+    let ltag = @"
+    if (&filetype == 'html' || &filetype == 'xhtml') && (!exists ("g:xml_no_html"))
+        let html_mode = 1
+        let ltag = substitute (ltag, '[^[:graph:]]\+', ' ', 'g')
+        let ltag = substitute (ltag, '<\s*\([^[:alnum:]_:\-[:blank:]]\=\)\s*\([[:alnum:]_:\-]\+\)\>', '<\1\2', '')
+    else
+        let html_mode = 0
+    endif
+
+    if <SID>IsParsableTag (ltag)
+        " find the break between tag name and atributes (or closing of tag)
+        let index = matchend (ltag, '[[:alnum:]_:\-]\+')
+
+        let tag_name = strpart (ltag, 1, index - 1)
+        if strpart (ltag, index) =~ '[^/>[:blank:]]'
+            let has_attrib = 1
+        else
+            let has_attrib = 0
+        endif
+
+        " That's (index - 1) + 2, 2 for the '</' and 1 for the extra character the
+        " while includes (the '>' is ignored because <Esc> puts the curser on top
+        " of the '>'
+        let index = index + 2
+
+        " print out the end tag and place the cursor back were it left off
+        if html_mode && tag_name =~? '^\(img\|input\|param\|frame\|br\|hr\|meta\|link\|base\|area\)$'
+            if has_attrib == 0
+                call <SID>Callback (tag_name, html_mode)
+            endif
+            if exists ("g:xml_use_xhtml")
+                execute "normal! i /\<Esc>l"
+            endif
+        else
+            if multi_line
+                " Can't use \<Tab> because that indents 'tabstop' not 'shiftwidth'
+                " Also >> doesn't shift on an empty line hence the temporary char 'x'
+                let com_save = &comments
+                set comments-=n:>
+                execute "normal! a\<Cr>\<Cr>\<Esc>kAx\<Esc>>>$\"xx"
+                execute "set comments=" . substitute(com_save, " ", "\\\\ ", "g")
+            else
+                if has_attrib == 0
+                    call <SID>Callback (tag_name, html_mode)
+                endif
+                if exists("g:xml_jump_string")
+                    let index = index + strlen(g:xml_jump_string)
+                    let jump_char = g:xml_jump_string
+                    call <SID>InitEditFromJump()
+                else
+                    let jump_char = ""
+                endif
+                execute "normal! a</" . tag_name . ">" . jump_char . "\<Esc>" . index . "h"
+            endif
+        endif
+    endif
+
+    " restore registers
+    let @" = old_reg_save
+    let @x = old_save_x
+
+    if multi_line
+        startinsert!
+    else
+        execute "normal! l"
+        startinsert
+    endif
+endfunction
+endif
+
+
+" ParseTag2 -> Experimental function to replace ParseTag             {{{1
+"if !exists("*s:ParseTag2")
+"function s:ParseTag2( )
+    " My thought is to pull the tag out and reformat it to a normalized tag
+    " and put it back.
+"endfunction
+"endif
+
+
+" BuildTagName -> Grabs the tag's name for tag matching.             {{{1
+if !exists("*s:BuildTagName")
+function s:BuildTagName( )
+  "First check to see if we Are allready on the end of the tag. The / search
+  "forwards command will jump to the next tag otherwise
+
+  " Store contents of register x in a variable
+  let b:xreg = @x 
+
+  exec "normal! v\"xy"
+  if @x=='>'
+     " Don't do anything
+  else
+     exec "normal! />/\<Cr>"
+  endif
+
+  " Now we head back to the < to reach the beginning.
+  exec "normal! ?<?\<Cr>"
+
+  " Capture the tag (a > will be catured by the /$/ match)
+  exec "normal! v/\\s\\|$/\<Cr>\"xy"
+
+  " We need to strip off any junk at the end.
+  let @x=strpart(@x, 0, match(@x, "[[:blank:]>\<C-J>]"))
+
+  "remove <, >
+  let @x=substitute(@x,'^<\|>$','','')
+
+  " remove spaces.
+  let @x=substitute(@x,'/\s*','/', '')
+  let @x=substitute(@x,'^\s*','', '')
+
+  " Swap @x and b:xreg
+  let temp = @x
+  let @x = b:xreg
+  let b:xreg = temp
+endfunction
+endif
+
+" TagMatch1 -> First step in tag matching.                           {{{1 
+" Brad Phelan: First step in tag matching.
+if !exists("*s:TagMatch1")
+function s:TagMatch1()
+  " Save registers
+  let old_reg_save = @"
+
+  "Drop a marker here just in case we have a mismatched tag and
+  "wish to return (:mark looses column position)
+  normal! mz
+
+  call <SID>BuildTagName()
+
+  "Check to see if it is an end tag. If it is place a 1 in endtag
+  if match(b:xreg, '^/')==-1
+    let endtag = 0
+  else
+    let endtag = 1  
+  endif
+
+ " Extract the tag from the whole tag block
+ " eg if the block =
+ "   tag attrib1=blah attrib2=blah
+ " we will end up with 
+ "   tag
+ " with no trailing or leading spaces
+ let b:xreg=substitute(b:xreg,'^/','','g')
+
+ " Make sure the tag is valid.
+ " Malformed tags could be <?xml ?>, <![CDATA[]]>, etc.
+ if match(b:xreg,'^[[:alnum:]_:\-]') != -1
+     " Pass the tag to the matching 
+     " routine
+     call <SID>TagMatch2(b:xreg, endtag)
+ endif
+ " Restore registers
+ let @" = old_reg_save
+endfunction
+endif
+
+
+" TagMatch2 -> Second step in tag matching.                          {{{1
+" Brad Phelan: Second step in tag matching.
+if !exists("*s:TagMatch2")
+function s:TagMatch2(tag,endtag)
+  let match_type=''
+
+  " Build the pattern for searching for XML tags based
+  " on the 'tag' type passed into the function.
+  " Note we search forwards for end tags and
+  " backwards for start tags
+  if a:endtag==0
+     "let nextMatch='normal /\(<\s*' . a:tag . '\(\s\+.\{-}\)*>\)\|\(<\/' . a:tag . '\s*>\)'
+     let match_type = '/'
+  else
+     "let nextMatch='normal ?\(<\s*' . a:tag . '\(\s\+.\{-}\)*>\)\|\(<\/' . a:tag . '\s*>\)'
+     let match_type = '?'
+  endif
+
+  if a:endtag==0
+     let stk = 1 
+  else
+     let stk = 1
+  end
+
+ " wrapscan must be turned on. We'll recored the value and reset it afterward.
+ " We have it on because if we don't we'll get a nasty error if the search hits
+ " BOF or EOF.
+ let wrapval = &wrapscan
+ let &wrapscan = 1
+
+  "Get the current location of the cursor so we can 
+  "detect if we wrap on ourselves
+  let lpos = line(".")
+  let cpos = col(".")
+
+  if a:endtag==0
+      " If we are trying to find a start tag
+      " then decrement when we find a start tag
+      let iter = 1
+  else
+      " If we are trying to find an end tag
+      " then increment when we find a start tag
+      let iter = -1
+  endif
+
+  "Loop until stk == 0. 
+  while 1 
+     " exec search.
+     " Make sure to avoid />$/ as well as /\s$/ and /$/.
+     exec "normal! " . match_type . '<\s*\/*\s*' . a:tag . '\([[:blank:]>]\|$\)' . "\<Cr>"
+
+     " Check to see if our match makes sence.
+     if a:endtag == 0
+         if line(".") < lpos
+             call <SID>MisMatchedTag (0, a:tag)
+             break
+         elseif line(".") == lpos && col(".") <= cpos
+             call <SID>MisMatchedTag (1, a:tag)
+             break
+         endif
+     else
+         if line(".") > lpos
+             call <SID>MisMatchedTag (2, '/'.a:tag)
+             break
+         elseif line(".") == lpos && col(".") >= cpos
+             call <SID>MisMatchedTag (3, '/'.a:tag)
+             break
+         endif
+     endif
+
+     call <SID>BuildTagName()
+
+     if match(b:xreg,'^/')==-1
+        " Found start tag
+        let stk = stk + iter 
+     else
+        " Found end tag
+        let stk = stk - iter
+     endif
+
+     if stk == 0
+        break
+     endif    
+  endwhile
+
+  let &wrapscan = wrapval
+endfunction
+endif
+
+" MisMatchedTag -> What to do if a tag is mismatched.                {{{1
+if !exists("*s:MisMatchedTag")
+function s:MisMatchedTag( id, tag )
+    "Jump back to our formor spot
+    normal! `z
+    normal zz
+    echohl WarningMsg
+    " For debugging
+    "echo "Mismatched tag " . a:id . ": <" . a:tag . ">"
+    " For release
+    echo "Mismatched tag <" . a:tag . ">"
+    echohl None
+endfunction
+endif
+
+" DeleteTag -> Deletes surrounding tags from cursor.                 {{{1
+" Modifies mark z
+if !exists("*s:DeleteTag")
+function s:DeleteTag( )
+    if strpart (getline ("."), col (".") - 1, 1) == "<"
+        normal! l
+    endif
+    if search ("<[^\/]", "bW") == 0
+        return
+    endif
+    normal! mz
+    normal \5
+    normal! d%`zd%
+endfunction
+endif
+
+" VisualTag -> Selects Tag body in a visual selection.                {{{1
+" Modifies mark z
+if !exists("*s:VisualTag")
+function s:VisualTag( ) 
+    if strpart (getline ("."), col (".") - 1, 1) == "<"
+        normal! l
+    endif
+    if search ("<[^\/]", "bW") == 0
+        return
+    endif
+    normal! mz
+    normal \5
+    normal! %
+    exe "normal! " . visualmode()
+    normal! `z
+endfunction
+endif
+" InsertGt -> close tags only if the cursor is in a HTML or XML context {{{1
+" Else continue editing
+if !exists("*s:InsertGt")
+function s:InsertGt( )
+  let save_matchpairs = &matchpairs
+  set matchpairs-=<:>
+  execute "normal! a>"
+  execute "set matchpairs=" . save_matchpairs
+  " When the current char is text within a tag it will not proccess as a
+  " syntax'ed element and return nothing below. Since the multi line wrap
+  " feture relies on using the '>' char as text within a tag we must use the
+  " char prior to establish if it is valid html/xml
+  if (getline('.')[col('.') - 1] == '>')
+    let char_syn=synIDattr(synID(line("."), col(".") - 1, 1), "name")
+  endif
+  if -1 == match(char_syn, "xmlProcessing") && (0 == match(char_syn, 'html') || 0 == match(char_syn, 'xml') || 0 == match(char_syn, 'docbk'))
+    call <SID>ParseTag()
+  else
+    if col(".") == col("$") - 1
+      startinsert!
+    else 
+      execute "normal! l"
+      startinsert
+    endif
+  endif
+endfunction
+endif
+
+" InitEditFromJump -> Set some needed autocommands and syntax highlights for EditFromJump. {{{1
+if !exists("*s:InitEditFromJump")
+function s:InitEditFromJump( )
+    " Add a syntax highlight for the xml_jump_string.
+    execute "syntax match Error /\\V" . g:xml_jump_string . "/"
+endfunction
+endif
+
+" ClearJumpMarks -> Clean out extranious left over xml_jump_string garbage. {{{1
+if !exists("*s:ClearJumpMarks")
+function s:ClearJumpMarks( )
+    if exists("g:xml_jump_string")
+       if g:xml_jump_string != ""
+           execute ":%s/" . g:xml_jump_string . "//ge"
+       endif
+    endif
+endfunction
+endif
+
+" EditFromJump -> Jump to the end of the tag and continue editing. {{{1
+" g:xml_jump_string must be set.
+if !exists("*s:EditFromJump")
+function s:EditFromJump( )
+    if exists("g:xml_jump_string")
+        if g:xml_jump_string != ""
+            let foo = search(g:xml_jump_string, 'csW') " Moves cursor by default
+            execute "normal! " . strlen(g:xml_jump_string) . "x"
+            if col(".") == col("$") - 1
+                startinsert!
+            else
+                startinsert
+            endif
+        endif
+    else
+        echohl WarningMsg
+        echo "Function disabled. xml_jump_string not defined."
+        echohl None
+    endif
+endfunction
+endif
+
+" Section: Doc installation {{{1
+" Function: s:XmlInstallDocumentation(full_name, revision)              {{{2
+"   Install help documentation.
+" Arguments:
+"   full_name: Full name of this vim plugin script, including path name.
+"   revision:  Revision of the vim script. #version# mark in the document file
+"              will be replaced with this string with 'v' prefix.
+" Return:
+"   1 if new document installed, 0 otherwise.
+" Note: Cleaned and generalized by guo-peng Wen
+"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+function! s:XmlInstallDocumentation(full_name, revision)
+    " Name of the document path based on the system we use:
+    if (has("unix"))
+        " On UNIX like system, using forward slash:
+        let l:slash_char = '/'
+        let l:mkdir_cmd  = ':silent !mkdir -p '
+    else
+        " On M$ system, use backslash. Also mkdir syntax is different.
+        " This should only work on W2K and up.
+        let l:slash_char = '\'
+        let l:mkdir_cmd  = ':silent !mkdir '
+    endif
+
+    let l:doc_path = l:slash_char . 'doc'
+    "let l:doc_home = l:slash_char . '.vim' . l:slash_char . 'doc'
+
+    " Figure out document path based on full name of this script:
+    let l:vim_plugin_path = fnamemodify(a:full_name, ':h')
+    "let l:vim_doc_path   = fnamemodify(a:full_name, ':h:h') . l:doc_path
+    let l:vim_doc_path    = matchstr(l:vim_plugin_path, 
+            \ '.\{-}\ze\%(\%(ft\)\=plugin\|macros\)') . l:doc_path
+    if (!(filewritable(l:vim_doc_path) == 2))
+        echomsg "Doc path: " . l:vim_doc_path
+        execute l:mkdir_cmd . l:vim_doc_path
+        if (!(filewritable(l:vim_doc_path) == 2))
+            " Try a default configuration in user home:
+            "let l:vim_doc_path = expand("~") . l:doc_home
+            let l:vim_doc_path = matchstr(&rtp,
+                  \ escape($HOME, '\') .'[/\\]\%(\.vim\|vimfiles\)')
+            if (!(filewritable(l:vim_doc_path) == 2))
+                execute l:mkdir_cmd . l:vim_doc_path
+                if (!(filewritable(l:vim_doc_path) == 2))
+                    " Put a warning:
+                    echomsg "Unable to open documentation directory"
+                    echomsg " type :help add-local-help for more informations."
+                    return 0
+                endif
+            endif
+        endif
+    endif
+
+    " Exit if we have problem to access the document directory:
+    if (!isdirectory(l:vim_plugin_path)
+        \ || !isdirectory(l:vim_doc_path)
+        \ || filewritable(l:vim_doc_path) != 2)
+        return 0
+    endif
+
+    " Full name of script and documentation file:
+    let l:script_name = 'xml.vim'
+    let l:doc_name    = 'xml-plugin.txt'
+    let l:plugin_file = l:vim_plugin_path . l:slash_char . l:script_name
+    let l:doc_file    = l:vim_doc_path    . l:slash_char . l:doc_name
+
+    " Bail out if document file is still up to date:
+    if (filereadable(l:doc_file)  &&
+        \ getftime(l:plugin_file) < getftime(l:doc_file))
+        return 0
+    endif
+
+    " Prepare window position restoring command:
+    if (strlen(@%))
+        let l:go_back = 'b ' . bufnr("%")
+    else
+        let l:go_back = 'enew!'
+    endif
+
+    " Create a new buffer & read in the plugin file (me):
+    setl nomodeline
+    exe 'enew!'
+    exe 'r ' . l:plugin_file
+
+    setl modeline
+    let l:buf = bufnr("%")
+    setl noswapfile modifiable
+
+    norm zR
+    norm gg
+
+    " Delete from first line to a line starts with
+    " === START_DOC
+    1,/^=\{3,}\s\+START_DOC\C/ d
+
+    " Delete from a line starts with
+    " === END_DOC
+    " to the end of the documents:
+    /^=\{3,}\s\+END_DOC\C/,$ d
+
+    " Remove fold marks:
+    % s/{\{3}[1-9]/    /
+
+    " Add modeline for help doc: the modeline string is mangled intentionally
+    " to avoid it be recognized by VIM:
+    call append(line('$'), '')
+    call append(line('$'), ' v' . 'im:tw=78:ts=8:ft=help:norl:')
+
+    " Replace revision:
+    exe "normal :1,5s/#version#/ v" . a:revision . "/\<CR>"
+
+    " Save the help document:
+    exe 'w! ' . l:doc_file
+    exe l:go_back
+    exe 'bw ' . l:buf
+
+    " Build help tags:
+    exe 'helptags ' . l:vim_doc_path
+
+    return 1
+endfunction
+" }}}2
+
+" Mappings and Settings.                                             {{{1
+" This makes the '%' jump between the start and end of a single tag.
+setlocal matchpairs+=<:>
+setlocal commentstring=<!--%s-->
+
+" Have this as an escape incase you want a literal '>' not to run the
+" ParseTag function.
+if !exists("g:xml_tag_completion_map")
+    inoremap <buffer> <LocalLeader>. >
+    inoremap <buffer> <LocalLeader>> >
+endif
+
+" Jump between the beggining and end tags.
+nnoremap <buffer> <LocalLeader>5 :call <SID>TagMatch1()<Cr>
+nnoremap <buffer> <LocalLeader>% :call <SID>TagMatch1()<Cr>
+vnoremap <buffer> <LocalLeader>5 <Esc>:call <SID>VisualTag()<Cr>
+vnoremap <buffer> <LocalLeader>% <Esc>:call <SID>VisualTag()<Cr>
+
+" Wrap selection in XML tag
+vnoremap <buffer> <LocalLeader>x "xx:call <SID>WrapTag(@x)<Cr>
+nnoremap <buffer> <LocalLeader>d :call <SID>DeleteTag()<Cr>
+
+" Parse the tag after pressing the close '>'.
+if !exists("g:xml_tag_completion_map")
+    " inoremap <buffer> > ><Esc>:call <SID>ParseTag()<Cr>
+    inoremap <buffer> > <Esc>:call <SID>InsertGt()<Cr>
+else
+    execute "inoremap <buffer> " . g:xml_tag_completion_map . " <Esc>:call <SID>InsertGt()<Cr>"
+endif
+
+nnoremap <buffer> <LocalLeader><Space> :call <SID>EditFromJump()<Cr>
+inoremap <buffer> <LocalLeader><Space> <Esc>:call <SID>EditFromJump()<Cr>
+" Clear out all left over xml_jump_string garbage
+nnoremap <buffer> <LocalLeader>w :call <SID>ClearJumpMarks()<Cr>
+" The syntax files clear out any predefined syntax definitions. Recreate
+" this when ever a xml_jump_string is created. (in ParseTag)
+
+augroup xml
+    au!
+    au BufNewFile * call <SID>NewFileXML()
+    " Remove left over garbage from xml_jump_string on file save.
+    au BufWritePre <buffer> call <SID>ClearJumpMarks()
+augroup END
+"}}}1
+finish
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Section: Documentation content                                          {{{1
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+=== START_DOC
+*xml-plugin.txt*  Help edit XML and SGML documents.                  #version#
+
+                                   XML Edit {{{2 ~
+
+A filetype plugin to help edit XML and SGML documents.
+
+This script provides some convenience when editing XML (and some SGML
+including HTML) formated documents. It allows you to jump to the beginning
+or end of the tag block your cursor is in. '%' will jump between '<' and '>'
+within the tag your cursor is in. When in insert mode and you finish a tag
+(pressing '>') the tag will be completed. If you press '>' twice it will
+complete the tag and place the cursor in the middle of the tags on it's own
+line (helps with nested tags).
+
+Usage: Place this file into your ftplugin directory. To add html support
+Sym-link or copy this file to html.vim in your ftplugin directory. To activte
+the script place 'filetype plugin on' in your |.vimrc| file. See |ftplugins|
+for more information on this topic.
+
+If the file edited is of type "html" and "xml_use_html" is  defined then the
+following tags will not auto complete:
+<img>, <input>, <param>, <frame>, <br>, <hr>, <meta>, <link>, <base>, <area>
+
+If the file edited is of type 'html' and 'xml_use_xhtml' is defined the above
+tags will autocomplete the xml closing staying xhtml compatable.
+ex. <hr> becomes <hr /> (see |xml-plugin-settings|)
+
+NOTE: If you used the VIM 5.x version of this file (xmledit.vim) you'll need
+to comment out the section where you called it. It is no longer used in the
+VIM 6.x version. 
+
+Known Bugs {{{2 ~
+
+- This script will modify registers ". and "x; register "" will be restored.
+- < & > marks inside of a CDATA section are interpreted as actual XML tags
+  even if unmatched.
+- Although the script can handle leading spaces such as < tag></ tag> it is
+  illegal XML syntax and considered very bad form.
+- Placing a literal `>' in an attribute value will auto complete dispite that
+  the start tag isn't finished. This is poor XML anyway you should use
+  &gt; instead.
+- The matching algorithm can handle illegal tag characters where as the tag
+  completion algorithm can not.
+
+------------------------------------------------------------------------------
+                                                         *xml-plugin-mappings*
+Mappings {{{2 ~
+
+<LocalLeader> is a setting in VIM that depicts a prefix for scripts and
+plugins to use. By default this is the backslash key `\'. See |mapleader|
+for details.
+
+<LocalLeader><Space>
+        Normal or Insert - Continue editing after the ending tag. This
+        option requires xml_jump_string to be set to function. When a tag
+        is completed it will append the xml_jump_string. Once this mapping
+        is ran it will delete the next xml_jump_string pattern to the right
+        of the curser and delete it leaving you in insert mode to continue
+        editing.
+
+<LocalLeader>w
+        Normal - Will clear the entire file of left over xml_jump_string garbage.
+        * This will also happen automatically when you save the file. *
+
+<LocalLeader>x
+        Visual - Place a custom XML tag to suround the selected text. You
+        need to have selected text in visual mode before you can use this
+        mapping. See |visual-mode| for details.
+
+<LocalLeader>.   or      <LocalLeader>>
+        Insert - Place a literal '>' without parsing tag.
+
+<LocalLeader>5   or      <LocalLeader>%
+        Normal or Visual - Jump to the begining or end tag.
+
+<LocalLeader>d
+        Normal - Deletes the surrounding tags from the cursor. >
+            <tag1>outter <tag2>inner text</tag2> text</tag1>
+                    ^
+<       Turns to: >
+            outter <tag2>inner text</tag2> text
+            ^
+<
+
+------------------------------------------------------------------------------
+                                                         *xml-plugin-settings*
+Options {{{2 ~
+
+(All options must be placed in your |.vimrc| prior to the |ftplugin|
+command.)
+
+xml_tag_completion_map
+        Use this setting to change the default mapping to auto complete a
+        tag. By default typing a literal `>' will cause the tag your editing
+        to auto complete; pressing twice will auto nest the tag. By using
+        this setting the `>' will be a literal `>' and you must use the new
+        mapping to perform auto completion and auto nesting. For example if
+        you wanted Control-L to perform auto completion inmstead of typing a
+        `>' place the following into your .vimrc: >
+            let xml_tag_completion_map = "<C-l>"
+<
+xml_no_auto_nesting
+        This turns off the auto nesting feature. After a completion is made
+        and another `>' is typed xml-edit automatically will break the tag
+        accross multiple lines and indent the curser to make creating nested
+        tqags easier. This feature turns it off. Enter the following in your
+        .vimrc: >
+            let xml_no_auto_nesting = 1
+<
+xml_use_xhtml
+        When editing HTML this will auto close the short tags to make valid
+        XML like <hr /> and <br />. Enter the following in your vimrc to
+        turn this option on: >
+            let xml_use_xhtml = 1
+<
+xml_no_html
+        This turns off the support for HTML specific tags. Place this in your
+        .vimrc: >
+            let xml_no_html = 1
+<
+xml_jump_string
+        This turns off the support for continuing edits after an ending tag.
+        xml_jump_string can be any string how ever a simple character will
+        suffice. Pick a character or small string that is unique and will
+        not interfer with your normal editing. See the <LocalLeader>Space
+        mapping for more.
+        .vimrc: >
+            let xml_jump_string = "`"
+<
+------------------------------------------------------------------------------
+                                                        *xml-plugin-callbacks*
+Callback Functions {{{2 ~
+
+A callback function is a function used to customize features on a per tag
+basis. For example say you wish to have a default set of attributs when you
+type an empty tag like this:
+    You type: <tag>
+    You get:  <tag default="attributes"></tag>
+
+This is for any script programmers who wish to add xml-plugin support to
+there own filetype plugins.
+
+Callback functions recive one attribute variable which is the tag name. The
+all must return either a string or the number zero. If it returns a string
+the plugin will place the string in the proper location. If it is a zero the
+plugin will ignore and continue as if no callback existed.
+
+The following are implemented callback functions:
+
+HtmlAttribCallback
+        This is used to add default attributes to html tag. It is intended
+        for HTML files only.
+
+XmlAttribCallback
+        This is a generic callback for xml tags intended to add attributes.
+
+                                                             *xml-plugin-html*
+Callback Example {{{2 ~
+
+The following is an example of using XmlAttribCallback in your .vimrc
+>
+        function XmlAttribCallback (xml_tag)
+            if a:xml_tag ==? "my-xml-tag"
+                return "attributes=\"my xml attributes\""
+            else
+                return 0
+            endif
+        endfunction
+<
+The following is a sample html.vim file type plugin you could use:
+>
+  " Vim script file                                       vim600:fdm=marker:
+  " FileType:   HTML
+  " Maintainer: Devin Weaver <vim (at) tritarget.com>
+  " Location:   http://www.vim.org/scripts/script.php?script_id=301
+
+  " This is a wrapper script to add extra html support to xml documents.
+  " Original script can be seen in xml-plugin documentation.
+
+  " Only do this when not done yet for this buffer
+  if exists("b:did_ftplugin")
+    finish
+  endif
+  " Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability.
+
+  let b:html_mode = 1
+
+  if !exists("*HtmlAttribCallback")
+  function HtmlAttribCallback( xml_tag )
+      if a:xml_tag ==? "table"
+          return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\""
+      elseif a:xml_tag ==? "link"
+          return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\""
+      elseif a:xml_tag ==? "body"
+          return "bgcolor=\"white\""
+      elseif a:xml_tag ==? "frame"
+          return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize"
+      elseif a:xml_tag ==? "frameset"
+          return "rows=\"0,*\" cols=\"*,0\" border=\"0\""
+      elseif a:xml_tag ==? "img"
+          return "src=\"\" width=\"0\" height=\"0\" border=\"0\" alt=\"\""
+      elseif a:xml_tag ==? "a"
+          if has("browse")
+              " Look up a file to fill the href. Used in local relative file
+              " links. typeing your own href before closing the tag with `>'
+              " will override this.
+              let cwd = getcwd()
+              let cwd = substitute (cwd, "\\", "/", "g")
+              let href = browse (0, "Link to href...", getcwd(), "")
+              let href = substitute (href, cwd . "/", "", "")
+              let href = substitute (href, " ", "%20", "g")
+          else
+              let href = ""
+          endif
+          return "href=\"" . href . "\""
+      else
+          return 0
+      endif
+  endfunction
+  endif
+
+  " On to loading xml.vim
+  runtime ftplugin/xml.vim
+<
+=== END_DOC
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" vim: set tabstop=8 shiftwidth=4 softtabstop=4 smartindent
+" vim600: set foldmethod=marker smarttab fileencoding=iso-8859-15 
diff --git a/etc/vim/plugin/NERD_commenter.vim b/etc/vim/plugin/NERD_commenter.vim
new file mode 100644 (file)
index 0000000..18a348f
--- /dev/null
@@ -0,0 +1,3132 @@
+" ============================================================================
+" File:        NERD_commenter.vim
+" Description: vim global plugin that provides easy code commenting
+" Maintainer:  Martin Grenfell <martin_grenfell at msn dot com>
+" Version:     2.2.2
+" Last Change: 30th March, 2008
+" License:     This program is free software. It comes without any warranty,
+"              to the extent permitted by applicable law. You can redistribute
+"              it and/or modify it under the terms of the Do What The Fuck You
+"              Want To Public License, Version 2, as published by Sam Hocevar.
+"              See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+" ============================================================================
+
+" Section: script init stuff {{{1
+if exists("loaded_nerd_comments")
+    finish
+endif
+if v:version < 700
+    echoerr "NERDCommenter: this plugin requires vim >= 7. DOWNLOAD IT! You'll thank me later!"
+    finish
+endif
+let loaded_nerd_comments = 1
+
+" Function: s:InitVariable() function {{{2
+" This function is used to initialise a given variable to a given value. The
+" variable is only initialised if it does not exist prior
+"
+" Args:
+"   -var: the name of the var to be initialised
+"   -value: the value to initialise var to
+"
+" Returns:
+"   1 if the var is set, 0 otherwise
+function s:InitVariable(var, value)
+    if !exists(a:var)
+        exec 'let ' . a:var . ' = ' . "'" . a:value . "'"
+        return 1
+    endif
+    return 0
+endfunction
+
+" Section: space string init{{{2
+" When putting spaces after the left delim and before the right we use
+" s:spaceStr for the space char. This way we can make it add anything after
+" the left and before the right by modifying this variable
+let s:spaceStr = ' '
+let s:lenSpaceStr = strlen(s:spaceStr)
+
+" Section: variable init calls {{{2
+call s:InitVariable("g:NERDAllowAnyVisualDelims", 1)
+call s:InitVariable("g:NERDBlockComIgnoreEmpty", 0)
+call s:InitVariable("g:NERDCommentWholeLinesInVMode", 0)
+call s:InitVariable("g:NERDCompactSexyComs", 0)
+call s:InitVariable("g:NERDCreateDefaultMappings", 1)
+call s:InitVariable("g:NERDDefaultNesting", 1)
+call s:InitVariable("g:NERDMenuMode", 3)
+call s:InitVariable("g:NERDLPlace", "[>")
+call s:InitVariable("g:NERDUsePlaceHolders", 1)
+call s:InitVariable("g:NERDRemoveAltComs", 1)
+call s:InitVariable("g:NERDRemoveExtraSpaces", 1)
+call s:InitVariable("g:NERDRPlace", "<]")
+call s:InitVariable("g:NERDSpaceDelims", 0)
+call s:InitVariable("g:NERDDelimiterRequests", 1)
+
+
+
+let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\"
+
+" Section: Comment mapping functions, autocommands and commands {{{1
+" ============================================================================
+" Section: Comment enabler autocommands {{{2
+" ============================================================================
+
+augroup commentEnablers
+
+    "if the user enters a buffer or reads a buffer then we gotta set up
+    "the comment delimiters for that new filetype
+    autocmd BufEnter,BufRead * :call s:SetUpForNewFiletype(&filetype, 0)
+
+    "if the filetype of a buffer changes, force the script to reset the
+    "delims for the buffer
+    autocmd Filetype * :call s:SetUpForNewFiletype(&filetype, 1)
+augroup END
+
+
+" Function: s:SetUpForNewFiletype(filetype) function {{{2
+" This function is responsible for setting up buffer scoped variables for the
+" given filetype.
+"
+" These variables include the comment delimiters for the given filetype and calls
+" MapDelimiters or MapDelimitersWithAlternative passing in these delimiters.
+"
+" Args:
+"   -filetype: the filetype to set delimiters for
+"   -forceReset: 1 if the delimiters should be reset if they have already be
+"    set for this buffer.
+"
+function s:SetUpForNewFiletype(filetype, forceReset)
+    "if we have already set the delimiters for this buffer then dont go thru
+    "it again
+    if !a:forceReset && exists("b:NERDLeft") && b:NERDLeft != ''
+        return
+    endif
+
+    let b:NERDSexyComMarker = ''
+
+    "check the filetype against all known filetypes to see if we have
+    "hardcoded the comment delimiters to use
+    if a:filetype ==? ""
+        call s:MapDelimiters('', '')
+    elseif a:filetype ==? "aap"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "abc"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "acedb"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "actionscript"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "ada"
+        call s:MapDelimitersWithAlternative('--','', '--  ', '')
+    elseif a:filetype ==? "ahdl"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "ahk"
+        call s:MapDelimitersWithAlternative(';', '', '/*', '*/')
+    elseif a:filetype ==? "amiga"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "aml"
+        call s:MapDelimiters('/*', '')
+    elseif a:filetype ==? "ampl"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "apache"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "apachestyle"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "asciidoc"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "applescript"
+        call s:MapDelimitersWithAlternative('--', '', '(*', '*)')
+    elseif a:filetype ==? "asm68k"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "asm"
+        call s:MapDelimitersWithAlternative(';', '', '#', '')
+    elseif a:filetype ==? "asn"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "aspvbs"
+        call s:MapDelimiters('''', '')
+    elseif a:filetype ==? "asterisk"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "asy"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "atlas"
+        call s:MapDelimiters('C','$')
+    elseif a:filetype ==? "autohotkey"
+        call s:MapDelimiters(';','')
+    elseif a:filetype ==? "autoit"
+        call s:MapDelimiters(';','')
+    elseif a:filetype ==? "ave"
+        call s:MapDelimiters("'",'')
+    elseif a:filetype ==? "awk"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "basic"
+        call s:MapDelimitersWithAlternative("'",'', 'REM ', '')
+    elseif a:filetype ==? "bbx"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "bc"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "bib"
+        call s:MapDelimiters('%','')
+    elseif a:filetype ==? "bindzone"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "bst"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "btm"
+        call s:MapDelimiters('::', '')
+    elseif a:filetype ==? "caos"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "calibre"
+        call s:MapDelimiters('//','')
+    elseif a:filetype ==? "catalog"
+        call s:MapDelimiters('--','--')
+    elseif a:filetype ==? "c"
+        call s:MapDelimitersWithAlternative('/*','*/', '//', '')
+    elseif a:filetype ==? "cfg"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "cg"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "ch"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "cl"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "clean"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "clipper"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "clojure"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "cmake"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "conkyrc"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "cpp"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "crontab"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "cs"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "csp"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "cterm"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "cucumber"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "cvs"
+        call s:MapDelimiters('CVS:','')
+    elseif a:filetype ==? "d"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "dcl"
+        call s:MapDelimiters('$!', '')
+    elseif a:filetype ==? "dakota"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "debcontrol"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "debsources"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "def"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "desktop"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "dhcpd"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "diff"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "django"
+        call s:MapDelimitersWithAlternative('<!--','-->', '{#', '#}')
+    elseif a:filetype ==? "docbk"
+        call s:MapDelimiters('<!--', '-->')
+    elseif a:filetype ==? "dns"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "dosbatch"
+        call s:MapDelimitersWithAlternative('REM ','', '::', '')
+    elseif a:filetype ==? "dosini"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "dot"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "dracula"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "dsl"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "dtml"
+        call s:MapDelimiters('<dtml-comment>','</dtml-comment>')
+    elseif a:filetype ==? "dylan"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? 'ebuild'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "ecd"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? 'eclass'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "eiffel"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "elf"
+        call s:MapDelimiters("'", '')
+    elseif a:filetype ==? "elmfilt"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "erlang"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "eruby"
+        call s:MapDelimitersWithAlternative('<%#', '%>', '<!--', '-->')
+    elseif a:filetype ==? "expect"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "exports"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "factor"
+        call s:MapDelimitersWithAlternative('! ', '', '!# ', '')
+    elseif a:filetype ==? "fgl"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "focexec"
+        call s:MapDelimiters('-*', '')
+    elseif a:filetype ==? "form"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "foxpro"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "fstab"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "fvwm"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "fx"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "gams"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "gdb"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "gdmo"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "geek"
+        call s:MapDelimiters('GEEK_COMMENT:', '')
+    elseif a:filetype ==? "genshi"
+        call s:MapDelimitersWithAlternative('<!--','-->', '{#', '#}')
+    elseif a:filetype ==? "gentoo-conf-d"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "gentoo-env-d"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "gentoo-init-d"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "gentoo-make-conf"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? 'gentoo-package-keywords'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? 'gentoo-package-mask'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? 'gentoo-package-use'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? 'gitcommit'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? 'gitconfig'
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? 'gitrebase'
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "gnuplot"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "groovy"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "gtkrc"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "haskell"
+        call s:MapDelimitersWithAlternative('{-','-}', '--', '')
+    elseif a:filetype ==? "hb"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "h"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "haml"
+        call s:MapDelimitersWithAlternative('-#', '', '/', '')
+    elseif a:filetype ==? "hercules"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "hog"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "hostsaccess"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "htmlcheetah"
+        call s:MapDelimiters('##','')
+    elseif a:filetype ==? "htmldjango"
+        call s:MapDelimitersWithAlternative('<!--','-->', '{#', '#}')
+    elseif a:filetype ==? "htmlos"
+        call s:MapDelimiters('#','/#')
+    elseif a:filetype ==? "ia64"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "icon"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "idlang"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "idl"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "inform"
+        call s:MapDelimiters('!', '')
+    elseif a:filetype ==? "inittab"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "ishd"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "iss"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "ist"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "java"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "javacc"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "javascript"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype == "javascript.jquery"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "jess"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "jgraph"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "jproperties"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "jsp"
+        call s:MapDelimiters('<%--', '--%>')
+    elseif a:filetype ==? "kix"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "kscript"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "lace"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "ldif"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "lilo"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "lilypond"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "liquid"
+        call s:MapDelimiters('{%', '%}')
+    elseif a:filetype ==? "lisp"
+        call s:MapDelimitersWithAlternative(';','', '#|', '|#')
+    elseif a:filetype ==? "llvm"
+        call s:MapDelimiters(';','')
+    elseif a:filetype ==? "lotos"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "lout"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "lprolog"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "lscript"
+        call s:MapDelimiters("'", '')
+    elseif a:filetype ==? "lss"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "lua"
+        call s:MapDelimitersWithAlternative('--','', '--[[', ']]')
+    elseif a:filetype ==? "lynx"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "lytex"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "mail"
+        call s:MapDelimiters('> ','')
+    elseif a:filetype ==? "mako"
+        call s:MapDelimiters('##', '')
+    elseif a:filetype ==? "man"
+        call s:MapDelimiters('."', '')
+    elseif a:filetype ==? "map"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "maple"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "markdown"
+        call s:MapDelimiters('<!--', '-->')
+    elseif a:filetype ==? "masm"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "mason"
+        call s:MapDelimiters('<% #', '%>')
+    elseif a:filetype ==? "master"
+        call s:MapDelimiters('$', '')
+    elseif a:filetype ==? "matlab"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "mel"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "mib"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "mkd"
+        call s:MapDelimiters('>', '')
+    elseif a:filetype ==? "mma"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "model"
+        call s:MapDelimiters('$','$')
+    elseif a:filetype =~ "moduala."
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "modula2"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "modula3"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "monk"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "mush"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "named"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "nasm"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "nastran"
+        call s:MapDelimiters('$', '')
+    elseif a:filetype ==? "natural"
+        call s:MapDelimiters('/*', '')
+    elseif a:filetype ==? "ncf"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "newlisp"
+        call s:MapDelimiters(';','')
+    elseif a:filetype ==? "nroff"
+        call s:MapDelimiters('\"', '')
+    elseif a:filetype ==? "nsis"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "ntp"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "objc"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "objcpp"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "objj"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "ocaml"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "occam"
+        call s:MapDelimiters('--','')
+    elseif a:filetype ==? "omlet"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "omnimark"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "openroad"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "opl"
+        call s:MapDelimiters("REM", "")
+    elseif a:filetype ==? "ora"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "ox"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "pascal"
+        call s:MapDelimitersWithAlternative('{','}', '(*', '*)')
+    elseif a:filetype ==? "patran"
+        call s:MapDelimitersWithAlternative('$','','/*', '*/')
+    elseif a:filetype ==? "pcap"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "pccts"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "pdf"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "pfmain"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "php"
+        call s:MapDelimitersWithAlternative('//','','/*', '*/')
+    elseif a:filetype ==? "pic"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "pike"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "pilrc"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "pine"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "plm"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "plsql"
+        call s:MapDelimitersWithAlternative('--', '', '/*', '*/')
+    elseif a:filetype ==? "po"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "postscr"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "pov"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "povini"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "ppd"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "ppwiz"
+        call s:MapDelimiters(';;', '')
+    elseif a:filetype ==? "processing"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "prolog"
+        call s:MapDelimitersWithAlternative('%','','/*','*/')
+    elseif a:filetype ==? "ps1"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "psf"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "ptcap"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "radiance"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "ratpoison"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "r"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "rc"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "rebol"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "registry"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "remind"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "resolv"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "rgb"
+        call s:MapDelimiters('!', '')
+    elseif a:filetype ==? "rib"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "robots"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "sa"
+        call s:MapDelimiters('--','')
+    elseif a:filetype ==? "samba"
+        call s:MapDelimitersWithAlternative(';','', '#', '')
+    elseif a:filetype ==? "sass"
+        call s:MapDelimitersWithAlternative('//','', '/*', '')
+    elseif a:filetype ==? "sather"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "scala"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "scilab"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "scsh"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "sed"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "sgmldecl"
+        call s:MapDelimiters('--','--')
+    elseif a:filetype ==? "sgmllnx"
+        call s:MapDelimiters('<!--','-->')
+    elseif a:filetype ==? "sicad"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "simula"
+        call s:MapDelimitersWithAlternative('%', '', '--', '')
+    elseif a:filetype ==? "sinda"
+        call s:MapDelimiters('$', '')
+    elseif a:filetype ==? "skill"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "slang"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "slice"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "slrnrc"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "sm"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "smarty"
+        call s:MapDelimiters('{*', '*}')
+    elseif a:filetype ==? "smil"
+        call s:MapDelimiters('<!','>')
+    elseif a:filetype ==? "smith"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "sml"
+        call s:MapDelimiters('(*','*)')
+    elseif a:filetype ==? "snnsnet"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "snnspat"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "snnsres"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "snobol4"
+        call s:MapDelimiters('*', '')
+    elseif a:filetype ==? "spec"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "specman"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "spectre"
+        call s:MapDelimitersWithAlternative('//', '', '*', '')
+    elseif a:filetype ==? "spice"
+        call s:MapDelimiters('$', '')
+    elseif a:filetype ==? "sql"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "sqlforms"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "sqlj"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "sqr"
+        call s:MapDelimiters('!', '')
+    elseif a:filetype ==? "squid"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "st"
+        call s:MapDelimiters('"','')
+    elseif a:filetype ==? "stp"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "systemverilog"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "tads"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "tags"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "tak"
+        call s:MapDelimiters('$', '')
+    elseif a:filetype ==? "tasm"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "tcl"
+        call s:MapDelimiters('#','')
+    elseif a:filetype ==? "texinfo"
+        call s:MapDelimiters("@c ", "")
+    elseif a:filetype ==? "texmf"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "tf"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "tidy"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "tli"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "trasys"
+        call s:MapDelimiters("$", "")
+    elseif a:filetype ==? "tsalt"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "tsscl"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "tssgm"
+        call s:MapDelimiters("comment = '","'")
+    elseif a:filetype ==? "txt2tags"
+        call s:MapDelimiters('%','')
+    elseif a:filetype ==? "uc"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "uil"
+        call s:MapDelimiters('!', '')
+    elseif a:filetype ==? "vb"
+        call s:MapDelimiters("'","")
+    elseif a:filetype ==? "velocity"
+        call s:MapDelimitersWithAlternative("##","", '#*', '*#')
+    elseif a:filetype ==? "vera"
+        call s:MapDelimitersWithAlternative('/*','*/','//','')
+    elseif a:filetype ==? "verilog"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "verilog_systemverilog"
+        call s:MapDelimitersWithAlternative('//','', '/*','*/')
+    elseif a:filetype ==? "vgrindefs"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "vhdl"
+        call s:MapDelimiters('--', '')
+    elseif a:filetype ==? "vimperator"
+        call s:MapDelimiters('"','')
+    elseif a:filetype ==? "virata"
+        call s:MapDelimiters('%', '')
+    elseif a:filetype ==? "vrml"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "vsejcl"
+        call s:MapDelimiters('/*', '')
+    elseif a:filetype ==? "webmacro"
+        call s:MapDelimiters('##', '')
+    elseif a:filetype ==? "wget"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "Wikipedia"
+        call s:MapDelimiters('<!--','-->')
+    elseif a:filetype ==? "winbatch"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "wml"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "wvdial"
+        call s:MapDelimiters(';', '')
+    elseif a:filetype ==? "xdefaults"
+        call s:MapDelimiters('!', '')
+    elseif a:filetype ==? "xkb"
+        call s:MapDelimiters('//', '')
+    elseif a:filetype ==? "xmath"
+        call s:MapDelimiters('#', '')
+    elseif a:filetype ==? "xpm2"
+        call s:MapDelimiters('!', '')
+    elseif a:filetype ==? "xquery"
+        call s:MapDelimiters('(:',':)')
+    elseif a:filetype ==? "z8a"
+        call s:MapDelimiters(';', '')
+
+    else
+
+        "extract the delims from &commentstring
+        let left= substitute(&commentstring, '\([^ \t]*\)\s*%s.*', '\1', '')
+        let right= substitute(&commentstring, '.*%s\s*\(.*\)', '\1', 'g')
+        call s:MapDelimiters(left,right)
+
+    endif
+endfunction
+
+" Function: s:MapDelimiters(left, right) function {{{2
+" This function is a wrapper for s:MapDelimiters(left, right, leftAlt, rightAlt, useAlt) and is called when there
+" is no alternative comment delimiters for the current filetype
+"
+" Args:
+"   -left: the left comment delimiter
+"   -right: the right comment delimiter
+function s:MapDelimiters(left, right)
+    call s:MapDelimitersWithAlternative(a:left, a:right, "", "")
+endfunction
+
+" Function: s:MapDelimitersWithAlternative(left, right, leftAlt, rightAlt) function {{{2
+" this function sets up the comment delimiter buffer variables
+"
+" Args:
+"   -left:  the string defining the comment start delimiter
+"   -right: the string defining the comment end delimiter
+"   -leftAlt:  the string for the alternative comment style defining the comment start delimiter
+"   -rightAlt: the string for the alternative comment style defining the comment end delimiter
+function s:MapDelimitersWithAlternative(left, right, leftAlt, rightAlt)
+    if !exists('g:NERD_' . &filetype . '_alt_style')
+        let b:NERDLeft = a:left
+        let b:NERDRight = a:right
+        let b:NERDLeftAlt = a:leftAlt
+        let b:NERDRightAlt = a:rightAlt
+    else
+        let b:NERDLeft = a:leftAlt
+        let b:NERDRight = a:rightAlt
+        let b:NERDLeftAlt = a:left
+        let b:NERDRightAlt = a:right
+    endif
+endfunction
+
+" Function: s:SwitchToAlternativeDelimiters(printMsgs) function {{{2
+" This function is used to swap the delimiters that are being used to the
+" alternative delimiters for that filetype. For example, if a c++ file is
+" being edited and // comments are being used, after this function is called
+" /**/ comments will be used.
+"
+" Args:
+"   -printMsgs: if this is 1 then a message is echoed to the user telling them
+"    if this function changed the delimiters or not
+function s:SwitchToAlternativeDelimiters(printMsgs)
+    "if both of the alternative delimiters are empty then there is no
+    "alternative comment style so bail out
+    if b:NERDLeftAlt == "" && b:NERDRightAlt == ""
+        if a:printMsgs
+            call s:NerdEcho("Cannot use alternative delimiters, none are specified", 0)
+        endif
+        return 0
+    endif
+
+    "save the current delimiters
+    let tempLeft = b:NERDLeft
+    let tempRight = b:NERDRight
+
+    "swap current delimiters for alternative
+    let b:NERDLeft = b:NERDLeftAlt
+    let b:NERDRight = b:NERDRightAlt
+
+    "set the previously current delimiters to be the new alternative ones
+    let b:NERDLeftAlt = tempLeft
+    let b:NERDRightAlt = tempRight
+
+    "tell the user what comment delimiters they are now using
+    if a:printMsgs
+        let leftNoEsc = b:NERDLeft
+        let rightNoEsc = b:NERDRight
+        call s:NerdEcho("Now using " . leftNoEsc . " " . rightNoEsc . " to delimit comments", 1)
+    endif
+
+    return 1
+endfunction
+
+" Section: Comment delimiter add/removal functions {{{1
+" ============================================================================
+" Function: s:AppendCommentToLine(){{{2
+" This function appends comment delimiters at the EOL and places the cursor in
+" position to start typing the comment
+function s:AppendCommentToLine()
+    let left = s:GetLeft(0,1,0)
+    let right = s:GetRight(0,1,0)
+
+    " get the len of the right delim
+    let lenRight = strlen(right)
+
+    let isLineEmpty = strlen(getline(".")) == 0
+    let insOrApp = (isLineEmpty==1 ? 'i' : 'A')
+
+    "stick the delimiters down at the end of the line. We have to format the
+    "comment with spaces as appropriate
+    execute ":normal! " . insOrApp . (isLineEmpty ? '' : ' ') . left . right . " "
+
+    " if there is a right delimiter then we gotta move the cursor left
+    " by the len of the right delimiter so we insert between the delimiters
+    if lenRight > 0
+        let leftMoveAmount = lenRight
+        execute ":normal! " . leftMoveAmount . "h"
+    endif
+    startinsert
+endfunction
+
+" Function: s:CommentBlock(top, bottom, lSide, rSide, forceNested ) {{{2
+" This function is used to comment out a region of code. This region is
+" specified as a bounding box by arguments to the function.
+"
+" Args:
+"   -top: the line number for the top line of code in the region
+"   -bottom: the line number for the bottom line of code in the region
+"   -lSide: the column number for the left most column in the region
+"   -rSide: the column number for the right most column in the region
+"   -forceNested: a flag indicating whether comments should be nested
+function s:CommentBlock(top, bottom, lSide, rSide, forceNested )
+    " we need to create local copies of these arguments so we can modify them
+    let top = a:top
+    let bottom = a:bottom
+    let lSide = a:lSide
+    let rSide = a:rSide
+
+    "if the top or bottom line starts with tabs we have to adjust the left and
+    "right boundaries so that they are set as though the tabs were spaces
+    let topline = getline(top)
+    let bottomline = getline(bottom)
+    if s:HasLeadingTabs(topline, bottomline)
+
+        "find out how many tabs are in the top line and adjust the left
+        "boundary accordingly
+        let numTabs = s:NumberOfLeadingTabs(topline)
+        if lSide < numTabs
+            let lSide = &ts * lSide
+        else
+            let lSide = (lSide - numTabs) + (&ts * numTabs)
+        endif
+
+        "find out how many tabs are in the bottom line and adjust the right
+        "boundary accordingly
+        let numTabs = s:NumberOfLeadingTabs(bottomline)
+        let rSide = (rSide - numTabs) + (&ts * numTabs)
+    endif
+
+    "we must check that bottom IS actually below top, if it is not then we
+    "swap top and bottom. Similarly for left and right.
+    if bottom < top
+        let temp = top
+        let top = bottom
+        let bottom = top
+    endif
+    if rSide < lSide
+        let temp = lSide
+        let lSide = rSide
+        let rSide = temp
+    endif
+
+    "if the current delimiters arent multipart then we will switch to the
+    "alternative delims (if THEY are) as the comment will be better and more
+    "accurate with multipart delims
+    let switchedDelims = 0
+    if !s:Multipart() && g:NERDAllowAnyVisualDelims && s:AltMultipart()
+        let switchedDelims = 1
+        call s:SwitchToAlternativeDelimiters(0)
+    endif
+
+    "start the commenting from the top and keep commenting till we reach the
+    "bottom
+    let currentLine=top
+    while currentLine <= bottom
+
+        "check if we are allowed to comment this line
+        if s:CanCommentLine(a:forceNested, currentLine)
+
+            "convert the leading tabs into spaces
+            let theLine = getline(currentLine)
+            let lineHasLeadTabs = s:HasLeadingTabs(theLine)
+            if lineHasLeadTabs
+                let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+            endif
+
+            "dont comment lines that begin after the right boundary of the
+            "block unless the user has specified to do so
+            if theLine !~ '^ \{' . rSide . '\}' || !g:NERDBlockComIgnoreEmpty
+
+                "attempt to place the cursor in on the left of the boundary box,
+                "then check if we were successful, if not then we cant comment this
+                "line
+                call setline(currentLine, theLine)
+                if s:CanPlaceCursor(currentLine, lSide)
+
+                    let leftSpaced = s:GetLeft(0,1,0)
+                    let rightSpaced = s:GetRight(0,1,0)
+
+                    "stick the left delimiter down
+                    let theLine = strpart(theLine, 0, lSide-1) . leftSpaced . strpart(theLine, lSide-1)
+
+                    if s:Multipart()
+                        "stick the right delimiter down
+                        let theLine = strpart(theLine, 0, rSide+strlen(leftSpaced)) . rightSpaced . strpart(theLine, rSide+strlen(leftSpaced))
+
+                        let firstLeftDelim = s:FindDelimiterIndex(b:NERDLeft, theLine)
+                        let lastRightDelim = s:LastIndexOfDelim(b:NERDRight, theLine)
+
+                        if firstLeftDelim != -1 && lastRightDelim != -1
+                            let searchStr = strpart(theLine, 0, lastRightDelim)
+                            let searchStr = strpart(searchStr, firstLeftDelim+strlen(b:NERDLeft))
+
+                            "replace the outter most delims in searchStr with
+                            "place-holders
+                            let theLineWithPlaceHolders = s:ReplaceDelims(b:NERDLeft, b:NERDRight, g:NERDLPlace, g:NERDRPlace, searchStr)
+
+                            "add the right delimiter onto the line
+                            let theLine = strpart(theLine, 0, firstLeftDelim+strlen(b:NERDLeft)) . theLineWithPlaceHolders . strpart(theLine, lastRightDelim)
+                        endif
+                    endif
+                endif
+            endif
+
+            "restore tabs if needed
+            if lineHasLeadTabs
+                let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+            endif
+
+            call setline(currentLine, theLine)
+        endif
+
+        let currentLine = currentLine + 1
+    endwhile
+
+    "if we switched delims then we gotta go back to what they were before
+    if switchedDelims == 1
+        call s:SwitchToAlternativeDelimiters(0)
+    endif
+endfunction
+
+" Function: s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) {{{2
+" This function comments a range of lines.
+"
+" Args:
+"   -forceNested: a flag indicating whether the called is requesting the comment
+"    to be nested if need be
+"   -align: should be "left" or "both" or "none"
+"   -firstLine/lastLine: the top and bottom lines to comment
+function s:CommentLines(forceNested, align, firstLine, lastLine)
+    " we need to get the left and right indexes of the leftmost char in the
+    " block of of lines and the right most char so that we can do alignment of
+    " the delimiters if the user has specified
+    let leftAlignIndx = s:LeftMostIndx(a:forceNested, 0, a:firstLine, a:lastLine)
+    let rightAlignIndx = s:RightMostIndx(a:forceNested, 0, a:firstLine, a:lastLine)
+
+    " gotta add the length of the left delimiter onto the rightAlignIndx cos
+    " we'll be adding a left delim to the line
+    let rightAlignIndx = rightAlignIndx + strlen(s:GetLeft(0,1,0))
+
+    " now we actually comment the lines. Do it line by line
+    let currentLine = a:firstLine
+    while currentLine <= a:lastLine
+
+        " get the next line, check commentability and convert spaces to tabs
+        let theLine = getline(currentLine)
+        let lineHasLeadingTabs = s:HasLeadingTabs(theLine)
+        let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+        if s:CanCommentLine(a:forceNested, currentLine)
+            "if the user has specified forceNesting then we check to see if we
+            "need to switch delimiters for place-holders
+            if a:forceNested && g:NERDUsePlaceHolders
+                let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
+            endif
+
+            " find out if the line is commented using normal delims and/or
+            " alternate ones
+            let isCommented = s:IsCommented(b:NERDLeft, b:NERDRight, theLine) || s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine)
+
+            " check if we can comment this line
+            if !isCommented || g:NERDUsePlaceHolders || s:Multipart()
+                if a:align == "left" || a:align == "both"
+                    let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx)
+                else
+                    let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine)
+                endif
+                if a:align == "both"
+                    let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx)
+                else
+                    let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine)
+                endif
+            endif
+        endif
+
+        " restore leading tabs if appropriate
+        if lineHasLeadingTabs
+            let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+        endif
+
+        " we are done with this line
+        call setline(currentLine, theLine)
+        let currentLine = currentLine + 1
+    endwhile
+
+endfunction
+
+" Function: s:CommentLinesMinimal(firstLine, lastLine) {{{2
+" This function comments a range of lines in a minimal style. I
+"
+" Args:
+"   -firstLine/lastLine: the top and bottom lines to comment
+function s:CommentLinesMinimal(firstLine, lastLine)
+    "check that minimal comments can be done on this filetype
+    if !s:HasMultipartDelims()
+        throw 'NERDCommenter.Delimiters exception: Minimal comments can only be used for filetypes that have multipart delimiters'
+    endif
+
+    "if we need to use place holders for the comment, make sure they are
+    "enabled for this filetype
+    if !g:NERDUsePlaceHolders && s:DoesBlockHaveMultipartDelim(a:firstLine, a:lastLine)
+        throw 'NERDCommenter.Settings exception: Placeoholders are required but disabled.'
+    endif
+
+    "get the left and right delims to smack on
+    let left = s:GetSexyComLeft(g:NERDSpaceDelims,0)
+    let right = s:GetSexyComRight(g:NERDSpaceDelims,0)
+
+    "make sure all multipart delims on the lines are replaced with
+    "placeholders to prevent illegal syntax
+    let currentLine = a:firstLine
+    while(currentLine <= a:lastLine)
+        let theLine = getline(currentLine)
+        let theLine = s:ReplaceDelims(left, right, g:NERDLPlace, g:NERDRPlace, theLine)
+        call setline(currentLine, theLine)
+        let currentLine = currentLine + 1
+    endwhile
+
+    "add the delim to the top line
+    let theLine = getline(a:firstLine)
+    let lineHasLeadingTabs = s:HasLeadingTabs(theLine)
+    let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+    let theLine = s:AddLeftDelim(left, theLine)
+    if lineHasLeadingTabs
+        let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+    endif
+    call setline(a:firstLine, theLine)
+
+    "add the delim to the bottom line
+    let theLine = getline(a:lastLine)
+    let lineHasLeadingTabs = s:HasLeadingTabs(theLine)
+    let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+    let theLine = s:AddRightDelim(right, theLine)
+    if lineHasLeadingTabs
+        let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+    endif
+    call setline(a:lastLine, theLine)
+endfunction
+
+" Function: s:CommentLinesSexy(topline, bottomline) function {{{2
+" This function is used to comment lines in the 'Sexy' style. eg in c:
+" /*
+"  * This is a sexy comment
+"  */
+" Args:
+"   -topline: the line num of the top line in the sexy comment
+"   -bottomline: the line num of the bottom line in the sexy comment
+function s:CommentLinesSexy(topline, bottomline)
+    let left = s:GetSexyComLeft(0, 0)
+    let right = s:GetSexyComRight(0, 0)
+
+    "check if we can do a sexy comment with the available delimiters
+    if left == -1 || right == -1
+        throw 'NERDCommenter.Delimiters exception: cannot perform sexy comments with available delimiters.'
+    endif
+
+    "make sure the lines arent already commented sexually
+    if !s:CanSexyCommentLines(a:topline, a:bottomline)
+        throw 'NERDCommenter.Nesting exception: cannot nest sexy comments'
+    endif
+
+
+    let sexyComMarker = s:GetSexyComMarker(0,0)
+    let sexyComMarkerSpaced = s:GetSexyComMarker(1,0)
+
+
+    " we jam the comment as far to the right as possible
+    let leftAlignIndx = s:LeftMostIndx(1, 1, a:topline, a:bottomline)
+
+    "check if we should use the compact style i.e that the left/right
+    "delimiters should appear on the first and last lines of the code and not
+    "on separate lines above/below the first/last lines of code
+    if g:NERDCompactSexyComs
+        let spaceString = (g:NERDSpaceDelims ? s:spaceStr : '')
+
+        "comment the top line
+        let theLine = getline(a:topline)
+        let lineHasTabs = s:HasLeadingTabs(theLine)
+        if lineHasTabs
+            let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+        endif
+        let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
+        let theLine = s:AddLeftDelimAligned(left . spaceString, theLine, leftAlignIndx)
+        if lineHasTabs
+            let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+        endif
+        call setline(a:topline, theLine)
+
+        "comment the bottom line
+        if a:bottomline != a:topline
+            let theLine = getline(a:bottomline)
+            let lineHasTabs = s:HasLeadingTabs(theLine)
+            if lineHasTabs
+                let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+            endif
+            let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
+        endif
+        let theLine = s:AddRightDelim(spaceString . right, theLine)
+        if lineHasTabs
+            let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+        endif
+        call setline(a:bottomline, theLine)
+    else
+
+        " add the left delimiter one line above the lines that are to be commented
+        call cursor(a:topline, 1)
+        execute 'normal! O'
+        call setline(a:topline, repeat(' ', leftAlignIndx) . left )
+
+        " add the right delimiter after bottom line (we have to add 1 cos we moved
+        " the lines down when we added the left delim
+        call cursor(a:bottomline+1, 1)
+        execute 'normal! o'
+        call setline(a:bottomline+2, repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right )
+
+    endif
+
+    " go thru each line adding the sexyComMarker marker to the start of each
+    " line in the appropriate place to align them with the comment delims
+    let currentLine = a:topline+1
+    while currentLine <= a:bottomline + !g:NERDCompactSexyComs
+        " get the line and convert the tabs to spaces
+        let theLine = getline(currentLine)
+        let lineHasTabs = s:HasLeadingTabs(theLine)
+        if lineHasTabs
+            let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+        endif
+
+        let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
+
+        " add the sexyComMarker
+        let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . sexyComMarkerSpaced . strpart(theLine, leftAlignIndx)
+
+        if lineHasTabs
+            let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+        endif
+
+
+        " set the line and move onto the next one
+        call setline(currentLine, theLine)
+        let currentLine = currentLine + 1
+    endwhile
+
+endfunction
+
+" Function: s:CommentLinesToggle(forceNested, firstLine, lastLine) {{{2
+" Applies "toggle" commenting to the given range of lines
+"
+" Args:
+"   -forceNested: a flag indicating whether the called is requesting the comment
+"    to be nested if need be
+"   -firstLine/lastLine: the top and bottom lines to comment
+function s:CommentLinesToggle(forceNested, firstLine, lastLine)
+    let currentLine = a:firstLine
+    while currentLine <= a:lastLine
+
+        " get the next line, check commentability and convert spaces to tabs
+        let theLine = getline(currentLine)
+        let lineHasLeadingTabs = s:HasLeadingTabs(theLine)
+        let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+        if s:CanToggleCommentLine(a:forceNested, currentLine)
+
+            "if the user has specified forceNesting then we check to see if we
+            "need to switch delimiters for place-holders
+            if g:NERDUsePlaceHolders
+                let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine)
+            endif
+
+            let theLine = s:AddLeftDelim(s:GetLeft(0, 1, 0), theLine)
+            let theLine = s:AddRightDelim(s:GetRight(0, 1, 0), theLine)
+        endif
+
+        " restore leading tabs if appropriate
+        if lineHasLeadingTabs
+            let theLine = s:ConvertLeadingSpacesToTabs(theLine)
+        endif
+
+        " we are done with this line
+        call setline(currentLine, theLine)
+        let currentLine = currentLine + 1
+    endwhile
+
+endfunction
+
+" Function: s:CommentRegion(topline, topCol, bottomLine, bottomCol) function {{{2
+" This function comments chunks of text selected in visual mode.
+" It will comment exactly the text that they have selected.
+" Args:
+"   -topLine: the line num of the top line in the sexy comment
+"   -topCol: top left col for this comment
+"   -bottomline: the line num of the bottom line in the sexy comment
+"   -bottomCol: the bottom right col for this comment
+"   -forceNested: whether the caller wants comments to be nested if the
+"    line(s) are already commented
+function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested)
+
+    "switch delims (if we can) if the current set isnt multipart
+    let switchedDelims = 0
+    if !s:Multipart() && s:AltMultipart() && !g:NERDAllowAnyVisualDelims
+        let switchedDelims = 1
+        call s:SwitchToAlternativeDelimiters(0)
+    endif
+
+    "if there is only one line in the comment then just do it
+    if a:topLine == a:bottomLine
+        call s:CommentBlock(a:topLine, a:bottomLine, a:topCol, a:bottomCol, a:forceNested)
+
+    "there are multiple lines in the comment
+    else
+        "comment the top line
+        call s:CommentBlock(a:topLine, a:topLine, a:topCol, strlen(getline(a:topLine)), a:forceNested)
+
+        "comment out all the lines in the middle of the comment
+        let topOfRange = a:topLine+1
+        let bottomOfRange = a:bottomLine-1
+        if topOfRange <= bottomOfRange
+            call s:CommentLines(a:forceNested, "none", topOfRange, bottomOfRange)
+        endif
+
+        "comment the bottom line
+        let bottom = getline(a:bottomLine)
+        let numLeadingSpacesTabs = strlen(substitute(bottom, '^\([ \t]*\).*$', '\1', ''))
+        call s:CommentBlock(a:bottomLine, a:bottomLine, numLeadingSpacesTabs+1, a:bottomCol, a:forceNested)
+
+    endif
+
+    "stick the cursor back on the char it was on before the comment
+    call cursor(a:topLine, a:topCol + strlen(b:NERDLeft) + g:NERDSpaceDelims)
+
+    "if we switched delims then we gotta go back to what they were before
+    if switchedDelims == 1
+        call s:SwitchToAlternativeDelimiters(0)
+    endif
+
+endfunction
+
+" Function: s:InvertComment(firstLine, lastLine) function {{{2
+" Inverts the comments on the lines between and including the given line
+" numbers i.e all commented lines are uncommented and vice versa
+" Args:
+"   -firstLine: the top of the range of lines to be inverted
+"   -lastLine: the bottom of the range of lines to be inverted
+function s:InvertComment(firstLine, lastLine)
+
+    " go thru all lines in the given range
+    let currentLine = a:firstLine
+    while currentLine <= a:lastLine
+        let theLine = getline(currentLine)
+
+        let sexyComBounds = s:FindBoundingLinesOfSexyCom(currentLine)
+
+        " if the line is commented normally, uncomment it
+        if s:IsCommentedFromStartOfLine(b:NERDLeft, theLine) || s:IsCommentedFromStartOfLine(b:NERDLeftAlt, theLine)
+            call s:UncommentLines(currentLine, currentLine)
+            let currentLine = currentLine + 1
+
+        " check if the line is commented sexually
+        elseif !empty(sexyComBounds)
+            let numLinesBeforeSexyComRemoved = s:NumLinesInBuf()
+            call s:UncommentLinesSexy(sexyComBounds[0], sexyComBounds[1])
+
+            "move to the line after last line of the sexy comment
+            let numLinesAfterSexyComRemoved = s:NumLinesInBuf()
+            let currentLine = bottomBound - (numLinesBeforeSexyComRemoved - numLinesAfterSexyComRemoved) + 1
+
+        " the line isnt commented
+        else
+            call s:CommentLinesToggle(1, currentLine, currentLine)
+            let currentLine = currentLine + 1
+        endif
+
+    endwhile
+endfunction
+
+" Function: NERDComment(isVisual, type) function {{{2
+" This function is a Wrapper for the main commenting functions
+"
+" Args:
+"   -isVisual: a flag indicating whether the comment is requested in visual
+"    mode or not
+"   -type: the type of commenting requested. Can be 'sexy', 'invert',
+"    'minimal', 'toggle', 'alignLeft', 'alignBoth', 'norm',
+"    'nested', 'toEOL', 'append', 'insert', 'uncomment', 'yank'
+function! NERDComment(isVisual, type) range
+    " we want case sensitivity when commenting
+    let oldIgnoreCase = &ignorecase
+    set noignorecase
+
+    if a:isVisual
+        let firstLine = line("'<")
+        let lastLine = line("'>")
+        let firstCol = col("'<")
+        let lastCol = col("'>") - (&selection == 'exclusive' ? 1 : 0)
+    else
+        let firstLine = a:firstline
+        let lastLine = a:lastline
+    endif
+
+    let countWasGiven = (a:isVisual == 0 && firstLine != lastLine)
+
+    let forceNested = (a:type == 'nested' || g:NERDDefaultNesting)
+
+    if a:type == 'norm' || a:type == 'nested'
+        if a:isVisual && visualmode() == "\16"
+            call s:CommentBlock(firstLine, lastLine, firstCol, lastCol, forceNested)
+        elseif a:isVisual && visualmode() == "v" && (g:NERDCommentWholeLinesInVMode==0 || (g:NERDCommentWholeLinesInVMode==2 && s:HasMultipartDelims()))
+            call s:CommentRegion(firstLine, firstCol, lastLine, lastCol, forceNested)
+        else
+            call s:CommentLines(forceNested, "none", firstLine, lastLine)
+        endif
+
+    elseif a:type == 'alignLeft' || a:type == 'alignBoth'
+        let align = "none"
+        if a:type == "alignLeft"
+            let align = "left"
+        elseif a:type == "alignBoth"
+            let align = "both"
+        endif
+        call s:CommentLines(forceNested, align, firstLine, lastLine)
+
+    elseif a:type == 'invert'
+        call s:InvertComment(firstLine, lastLine)
+
+    elseif a:type == 'sexy'
+        try
+            call s:CommentLinesSexy(firstLine, lastLine)
+        catch /NERDCommenter.Delimiters/
+            call s:CommentLines(forceNested, "none", firstLine, lastLine)
+        catch /NERDCommenter.Nesting/
+            call s:NerdEcho("Sexy comment aborted. Nested sexy cannot be nested", 0)
+        endtry
+
+    elseif a:type == 'toggle'
+        let theLine = getline(firstLine)
+
+        if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(b:NERDLeft, theLine) || s:IsCommentedFromStartOfLine(b:NERDLeftAlt, theLine)
+            call s:UncommentLines(firstLine, lastLine)
+        else
+            call s:CommentLinesToggle(forceNested, firstLine, lastLine)
+        endif
+
+    elseif a:type == 'minimal'
+        try
+            call s:CommentLinesMinimal(firstLine, lastLine)
+        catch /NERDCommenter.Delimiters/
+            call s:NerdEcho("Minimal comments can only be used for filetypes that have multipart delimiters.", 0)
+        catch /NERDCommenter.Settings/
+            call s:NerdEcho("Place holders are required but disabled.", 0)
+        endtry
+
+    elseif a:type == 'toEOL'
+        call s:SaveScreenState()
+        call s:CommentBlock(firstLine, firstLine, col("."), col("$")-1, 1)
+        call s:RestoreScreenState()
+
+    elseif a:type == 'append'
+        call s:AppendCommentToLine()
+
+    elseif a:type == 'insert'
+        call s:PlaceDelimitersAndInsBetween()
+
+    elseif a:type == 'uncomment'
+        call s:UncommentLines(firstLine, lastLine)
+
+    elseif a:type == 'yank'
+        if a:isVisual
+            normal! gvy
+        elseif countWasGiven
+            execute firstLine .','. lastLine .'yank'
+        else
+            normal! yy
+        endif
+        execute firstLine .','. lastLine .'call NERDComment('. a:isVisual .', "norm")'
+    endif
+
+    let &ignorecase = oldIgnoreCase
+endfunction
+
+" Function: s:PlaceDelimitersAndInsBetween() function {{{2
+" This is function is called to place comment delimiters down and place the
+" cursor between them
+function s:PlaceDelimitersAndInsBetween()
+    " get the left and right delimiters without any escape chars in them
+    let left = s:GetLeft(0, 1, 0)
+    let right = s:GetRight(0, 1, 0)
+
+    let theLine = getline(".")
+    let lineHasLeadTabs = s:HasLeadingTabs(theLine) || (theLine =~ '^ *$' && !&expandtab)
+
+    "convert tabs to spaces and adjust the cursors column to take this into
+    "account
+    let untabbedCol = s:UntabbedCol(theLine, col("."))
+    call setline(line("."), s:ConvertLeadingTabsToSpaces(theLine))
+    call cursor(line("."), untabbedCol)
+
+    " get the len of the right delim
+    let lenRight = strlen(right)
+
+    let isDelimOnEOL = col(".") >= strlen(getline("."))
+
+    " if the cursor is in the first col then we gotta insert rather than
+    " append the comment delimiters here
+    let insOrApp = (col(".")==1 ? 'i' : 'a')
+
+    " place the delimiters down. We do it differently depending on whether
+    " there is a left AND right delimiter
+    if lenRight > 0
+        execute ":normal! " . insOrApp . left . right
+        execute ":normal! " . lenRight . "h"
+    else
+        execute ":normal! " . insOrApp . left
+
+        " if we are tacking the delim on the EOL then we gotta add a space
+        " after it cos when we go out of insert mode the cursor will move back
+        " one and the user wont be in position to type the comment.
+        if isDelimOnEOL
+            execute 'normal! a '
+        endif
+    endif
+    normal! l
+
+    "if needed convert spaces back to tabs and adjust the cursors col
+    "accordingly
+    if lineHasLeadTabs
+        let tabbedCol = s:TabbedCol(getline("."), col("."))
+        call setline(line("."), s:ConvertLeadingSpacesToTabs(getline(".")))
+        call cursor(line("."), tabbedCol)
+    endif
+
+    startinsert
+endfunction
+
+" Function: s:RemoveDelimiters(left, right, line) {{{2
+" this function is called to remove the first left comment delimiter and the
+" last right delimiter of the given line.
+"
+" The args left and right must be strings. If there is no right delimiter (as
+" is the case for e.g vim file comments) them the arg right should be ""
+"
+" Args:
+"   -left: the left comment delimiter
+"   -right: the right comment delimiter
+"   -line: the line to remove the delimiters from
+function s:RemoveDelimiters(left, right, line)
+
+    let l:left = a:left
+    let l:right = a:right
+    let lenLeft = strlen(left)
+    let lenRight = strlen(right)
+
+    let delimsSpaced = (g:NERDSpaceDelims || g:NERDRemoveExtraSpaces)
+
+    let line = a:line
+
+    "look for the left delimiter, if we find it, remove it.
+    let leftIndx = s:FindDelimiterIndex(a:left, line)
+    if leftIndx != -1
+        let line = strpart(line, 0, leftIndx) . strpart(line, leftIndx+lenLeft)
+
+        "if the user has specified that there is a space after the left delim
+        "then check for the space and remove it if it is there
+        if delimsSpaced && strpart(line, leftIndx, s:lenSpaceStr) == s:spaceStr
+            let line = strpart(line, 0, leftIndx) . strpart(line, leftIndx+s:lenSpaceStr)
+        endif
+    endif
+
+    "look for the right delimiter, if we find it, remove it
+    let rightIndx = s:FindDelimiterIndex(a:right, line)
+    if rightIndx != -1
+        let line = strpart(line, 0, rightIndx) . strpart(line, rightIndx+lenRight)
+
+        "if the user has specified that there is a space before the right delim
+        "then check for the space and remove it if it is there
+        if delimsSpaced && strpart(line, rightIndx-s:lenSpaceStr, s:lenSpaceStr) == s:spaceStr && s:Multipart()
+            let line = strpart(line, 0, rightIndx-s:lenSpaceStr) . strpart(line, rightIndx)
+        endif
+    endif
+
+    return line
+endfunction
+
+" Function: s:UncommentLines(topLine, bottomLine) {{{2
+" This function uncomments the given lines
+"
+" Args:
+" topLine: the top line of the visual selection to uncomment
+" bottomLine: the bottom line of the visual selection to uncomment
+function s:UncommentLines(topLine, bottomLine)
+    "make local copies of a:firstline and a:lastline and, if need be, swap
+    "them around if the top line is below the bottom
+    let l:firstline = a:topLine
+    let l:lastline = a:bottomLine
+    if firstline > lastline
+        let firstline = lastline
+        let lastline = a:topLine
+    endif
+
+    "go thru each line uncommenting each line removing sexy comments
+    let currentLine = firstline
+    while currentLine <= lastline
+
+        "check the current line to see if it is part of a sexy comment
+        let sexyComBounds = s:FindBoundingLinesOfSexyCom(currentLine)
+        if !empty(sexyComBounds)
+
+            "we need to store the num lines in the buf before the comment is
+            "removed so we know how many lines were removed when the sexy com
+            "was removed
+            let numLinesBeforeSexyComRemoved = s:NumLinesInBuf()
+
+            call s:UncommentLinesSexy(sexyComBounds[0], sexyComBounds[1])
+
+            "move to the line after last line of the sexy comment
+            let numLinesAfterSexyComRemoved = s:NumLinesInBuf()
+            let numLinesRemoved = numLinesBeforeSexyComRemoved - numLinesAfterSexyComRemoved
+            let currentLine = sexyComBounds[1] - numLinesRemoved + 1
+            let lastline = lastline - numLinesRemoved
+
+        "no sexy com was detected so uncomment the line as normal
+        else
+            call s:UncommentLinesNormal(currentLine, currentLine)
+            let currentLine = currentLine + 1
+        endif
+    endwhile
+
+endfunction
+
+" Function: s:UncommentLinesSexy(topline, bottomline) {{{2
+" This function removes all the comment characters associated with the sexy
+" comment spanning the given lines
+" Args:
+"   -topline/bottomline: the top/bottom lines of the sexy comment
+function s:UncommentLinesSexy(topline, bottomline)
+    let left = s:GetSexyComLeft(0,1)
+    let right = s:GetSexyComRight(0,1)
+
+
+    "check if it is even possible for sexy comments to exist with the
+    "available delimiters
+    if left == -1 || right == -1
+        throw 'NERDCommenter.Delimiters exception: cannot uncomment sexy comments with available delimiters.'
+    endif
+
+    let leftUnEsc = s:GetSexyComLeft(0,0)
+    let rightUnEsc = s:GetSexyComRight(0,0)
+
+    let sexyComMarker = s:GetSexyComMarker(0, 1)
+    let sexyComMarkerUnEsc = s:GetSexyComMarker(0, 0)
+
+    "the markerOffset is how far right we need to move the sexyComMarker to
+    "line it up with the end of the left delim
+    let markerOffset = strlen(leftUnEsc)-strlen(sexyComMarkerUnEsc)
+
+    " go thru the intermediate lines of the sexy comment and remove the
+    " sexy comment markers (eg the '*'s on the start of line in a c sexy
+    " comment)
+    let currentLine = a:topline+1
+    while currentLine < a:bottomline
+        let theLine = getline(currentLine)
+
+        " remove the sexy comment marker from the line. We also remove the
+        " space after it if there is one and if appropriate options are set
+        let sexyComMarkerIndx = stridx(theLine, sexyComMarkerUnEsc)
+        if strpart(theLine, sexyComMarkerIndx+strlen(sexyComMarkerUnEsc), s:lenSpaceStr) == s:spaceStr  && g:NERDSpaceDelims
+            let theLine = strpart(theLine, 0, sexyComMarkerIndx - markerOffset) . strpart(theLine, sexyComMarkerIndx+strlen(sexyComMarkerUnEsc)+s:lenSpaceStr)
+        else
+            let theLine = strpart(theLine, 0, sexyComMarkerIndx - markerOffset) . strpart(theLine, sexyComMarkerIndx+strlen(sexyComMarkerUnEsc))
+        endif
+
+        let theLine = s:SwapOutterPlaceHoldersForMultiPartDelims(theLine)
+
+        let theLine = s:ConvertLeadingWhiteSpace(theLine)
+
+        " move onto the next line
+        call setline(currentLine, theLine)
+        let currentLine = currentLine + 1
+    endwhile
+
+    " gotta make a copy of a:bottomline cos we modify the position of the
+    " last line  it if we remove the topline
+    let bottomline = a:bottomline
+
+    " get the first line so we can remove the left delim from it
+    let theLine = getline(a:topline)
+
+    " if the first line contains only the left delim then just delete it
+    if theLine =~ '^[ \t]*' . left . '[ \t]*$' && !g:NERDCompactSexyComs
+        call cursor(a:topline, 1)
+        normal! dd
+        let bottomline = bottomline - 1
+
+    " topline contains more than just the left delim
+    else
+
+        " remove the delim. If there is a space after it
+        " then remove this too if appropriate
+        let delimIndx = stridx(theLine, leftUnEsc)
+        if strpart(theLine, delimIndx+strlen(leftUnEsc), s:lenSpaceStr) == s:spaceStr && g:NERDSpaceDelims
+            let theLine = strpart(theLine, 0, delimIndx) . strpart(theLine, delimIndx+strlen(leftUnEsc)+s:lenSpaceStr)
+        else
+            let theLine = strpart(theLine, 0, delimIndx) . strpart(theLine, delimIndx+strlen(leftUnEsc))
+        endif
+        let theLine = s:SwapOutterPlaceHoldersForMultiPartDelims(theLine)
+        call setline(a:topline, theLine)
+    endif
+
+    " get the last line so we can remove the right delim
+    let theLine = getline(bottomline)
+
+    " if the bottomline contains only the right delim then just delete it
+    if theLine =~ '^[ \t]*' . right . '[ \t]*$'
+        call cursor(bottomline, 1)
+        normal! dd
+
+    " the last line contains more than the right delim
+    else
+        " remove the right delim. If there is a space after it and
+        " if the appropriate options are set then remove this too.
+        let delimIndx = s:LastIndexOfDelim(rightUnEsc, theLine)
+        if strpart(theLine, delimIndx+strlen(leftUnEsc), s:lenSpaceStr) == s:spaceStr  && g:NERDSpaceDelims
+            let theLine = strpart(theLine, 0, delimIndx) . strpart(theLine, delimIndx+strlen(rightUnEsc)+s:lenSpaceStr)
+        else
+            let theLine = strpart(theLine, 0, delimIndx) . strpart(theLine, delimIndx+strlen(rightUnEsc))
+        endif
+
+        " if the last line also starts with a sexy comment marker then we
+        " remove this as well
+        if theLine =~ '^[ \t]*' . sexyComMarker
+
+            " remove the sexyComMarker. If there is a space after it then
+            " remove that too
+            let sexyComMarkerIndx = stridx(theLine, sexyComMarkerUnEsc)
+            if strpart(theLine, sexyComMarkerIndx+strlen(sexyComMarkerUnEsc), s:lenSpaceStr) == s:spaceStr  && g:NERDSpaceDelims
+                let theLine = strpart(theLine, 0, sexyComMarkerIndx - markerOffset ) . strpart(theLine, sexyComMarkerIndx+strlen(sexyComMarkerUnEsc)+s:lenSpaceStr)
+            else
+                let theLine = strpart(theLine, 0, sexyComMarkerIndx - markerOffset ) . strpart(theLine, sexyComMarkerIndx+strlen(sexyComMarkerUnEsc))
+            endif
+        endif
+
+        let theLine = s:SwapOutterPlaceHoldersForMultiPartDelims(theLine)
+        call setline(bottomline, theLine)
+    endif
+endfunction
+
+" Function: s:UncommentLineNormal(line) {{{2
+" uncomments the given line and returns the result
+" Args:
+"   -line: the line to uncomment
+function s:UncommentLineNormal(line)
+    let line = a:line
+
+    "get the comment status on the line so we know how it is commented
+    let lineCommentStatus =  s:IsCommentedOuttermost(b:NERDLeft, b:NERDRight, b:NERDLeftAlt, b:NERDRightAlt, line)
+
+    "it is commented with b:NERDLeft and b:NERDRight so remove these delims
+    if lineCommentStatus == 1
+        let line = s:RemoveDelimiters(b:NERDLeft, b:NERDRight, line)
+
+    "it is commented with b:NERDLeftAlt and b:NERDRightAlt so remove these delims
+    elseif lineCommentStatus == 2 && g:NERDRemoveAltComs
+        let line = s:RemoveDelimiters(b:NERDLeftAlt, b:NERDRightAlt, line)
+
+    "it is not properly commented with any delims so we check if it has
+    "any random left or right delims on it and remove the outtermost ones
+    else
+        "get the positions of all delim types on the line
+        let indxLeft = s:FindDelimiterIndex(b:NERDLeft, line)
+        let indxLeftAlt = s:FindDelimiterIndex(b:NERDLeftAlt, line)
+        let indxRight = s:FindDelimiterIndex(b:NERDRight, line)
+        let indxRightAlt = s:FindDelimiterIndex(b:NERDRightAlt, line)
+
+        "remove the outter most left comment delim
+        if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1)
+            let line = s:RemoveDelimiters(b:NERDLeft, '', line)
+        elseif indxLeftAlt != -1
+            let line = s:RemoveDelimiters(b:NERDLeftAlt, '', line)
+        endif
+
+        "remove the outter most right comment delim
+        if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1)
+            let line = s:RemoveDelimiters('', b:NERDRight, line)
+        elseif indxRightAlt != -1
+            let line = s:RemoveDelimiters('', b:NERDRightAlt, line)
+        endif
+    endif
+
+
+    let indxLeft = s:FindDelimiterIndex(b:NERDLeft, line)
+    let indxLeftAlt = s:FindDelimiterIndex(b:NERDLeftAlt, line)
+    let indxLeftPlace = s:FindDelimiterIndex(g:NERDLPlace, line)
+
+    let indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line)
+    let indxRightAlt = s:FindDelimiterIndex(b:NERDRightAlt, line)
+    let indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line)
+
+    let right = b:NERDRight
+    let left = b:NERDLeft
+    if !s:Multipart()
+        let right = b:NERDRightAlt
+        let left = b:NERDLeftAlt
+    endif
+
+
+    "if there are place-holders on the line then we check to see if they are
+    "the outtermost delimiters on the line. If so then we replace them with
+    "real delimiters
+    if indxLeftPlace != -1
+        if (indxLeftPlace < indxLeft || indxLeft==-1) && (indxLeftPlace < indxLeftAlt || indxLeftAlt==-1)
+            let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, line)
+        endif
+    elseif indxRightPlace != -1
+        if (indxRightPlace < indxLeft || indxLeft==-1) && (indxLeftPlace < indxLeftAlt || indxLeftAlt==-1)
+            let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, line)
+        endif
+
+    endif
+
+    let line = s:ConvertLeadingWhiteSpace(line)
+
+    return line
+endfunction
+
+" Function: s:UncommentLinesNormal(topline, bottomline) {{{2
+" This function is called to uncomment lines that arent a sexy comment
+" Args:
+"   -topline/bottomline: the top/bottom line numbers of the comment
+function s:UncommentLinesNormal(topline, bottomline)
+    let currentLine = a:topline
+    while currentLine <= a:bottomline
+        let line = getline(currentLine)
+        call setline(currentLine, s:UncommentLineNormal(line))
+        let currentLine = currentLine + 1
+    endwhile
+endfunction
+
+
+" Section: Other helper functions {{{1
+" ============================================================================
+
+" Function: s:AddLeftDelim(delim, theLine) {{{2
+" Args:
+function s:AddLeftDelim(delim, theLine)
+    return substitute(a:theLine, '^\([ \t]*\)', '\1' . a:delim, '')
+endfunction
+
+" Function: s:AddLeftDelimAligned(delim, theLine) {{{2
+" Args:
+function s:AddLeftDelimAligned(delim, theLine, alignIndx)
+
+    "if the line is not long enough then bung some extra spaces on the front
+    "so we can align the delim properly
+    let theLine = a:theLine
+    if strlen(theLine) < a:alignIndx
+        let theLine = repeat(' ', a:alignIndx - strlen(theLine))
+    endif
+
+    return strpart(theLine, 0, a:alignIndx) . a:delim . strpart(theLine, a:alignIndx)
+endfunction
+
+" Function: s:AddRightDelim(delim, theLine) {{{2
+" Args:
+function s:AddRightDelim(delim, theLine)
+    if a:delim == ''
+        return a:theLine
+    else
+        return substitute(a:theLine, '$', a:delim, '')
+    endif
+endfunction
+
+" Function: s:AddRightDelimAligned(delim, theLine, alignIndx) {{{2
+" Args:
+function s:AddRightDelimAligned(delim, theLine, alignIndx)
+    if a:delim == ""
+        return a:theLine
+    else
+
+        " when we align the right delim we are just adding spaces
+        " so we get a string containing the needed spaces (it
+        " could be empty)
+        let extraSpaces = ''
+        let extraSpaces = repeat(' ', a:alignIndx-strlen(a:theLine))
+
+        " add the right delim
+        return substitute(a:theLine, '$', extraSpaces . a:delim, '')
+    endif
+endfunction
+
+" Function: s:AltMultipart() {{{2
+" returns 1 if the alternative delims are multipart
+function s:AltMultipart()
+    return b:NERDRightAlt != ''
+endfunction
+
+" Function: s:CanCommentLine(forceNested, line) {{{2
+"This function is used to determine whether the given line can be commented.
+"It returns 1 if it can be and 0 otherwise
+"
+" Args:
+"   -forceNested: a flag indicating whether the caller wants comments to be nested
+"    if the current line is already commented
+"   -lineNum: the line num of the line to check for commentability
+function s:CanCommentLine(forceNested, lineNum)
+    let theLine = getline(a:lineNum)
+
+    " make sure we don't comment lines that are just spaces or tabs or empty.
+    if theLine =~ "^[ \t]*$"
+        return 0
+    endif
+
+    "if the line is part of a sexy comment then just flag it...
+    if s:IsInSexyComment(a:lineNum)
+        return 0
+    endif
+
+    let isCommented = s:IsCommentedNormOrSexy(a:lineNum)
+
+    "if the line isnt commented return true
+    if !isCommented
+        return 1
+    endif
+
+    "if the line is commented but nesting is allowed then return true
+    if a:forceNested && (!s:Multipart() || g:NERDUsePlaceHolders)
+        return 1
+    endif
+
+    return 0
+endfunction
+
+" Function: s:CanPlaceCursor(line, col) {{{2
+" returns 1 if the cursor can be placed exactly in the given position
+function s:CanPlaceCursor(line, col)
+    let c = col(".")
+    let l = line(".")
+    call cursor(a:line, a:col)
+    let success = (line(".") == a:line && col(".") == a:col)
+    call cursor(l,c)
+    return success
+endfunction
+
+" Function: s:CanSexyCommentLines(topline, bottomline) {{{2
+" Return: 1 if the given lines can be commented sexually, 0 otherwise
+function s:CanSexyCommentLines(topline, bottomline)
+    " see if the selected regions have any sexy comments
+    let currentLine = a:topline
+    while(currentLine <= a:bottomline)
+        if s:IsInSexyComment(currentLine)
+            return 0
+        endif
+        let currentLine = currentLine + 1
+    endwhile
+    return 1
+endfunction
+" Function: s:CanToggleCommentLine(forceNested, line) {{{2
+"This function is used to determine whether the given line can be toggle commented.
+"It returns 1 if it can be and 0 otherwise
+"
+" Args:
+"   -lineNum: the line num of the line to check for commentability
+function s:CanToggleCommentLine(forceNested, lineNum)
+    let theLine = getline(a:lineNum)
+    if (s:IsCommentedFromStartOfLine(b:NERDLeft, theLine) || s:IsCommentedFromStartOfLine(b:NERDLeftAlt, theLine)) && !a:forceNested
+        return 0
+    endif
+
+    " make sure we don't comment lines that are just spaces or tabs or empty.
+    if theLine =~ "^[ \t]*$"
+        return 0
+    endif
+
+    "if the line is part of a sexy comment then just flag it...
+    if s:IsInSexyComment(a:lineNum)
+        return 0
+    endif
+
+    return 1
+endfunction
+
+" Function: s:ConvertLeadingSpacesToTabs(line) {{{2
+" This function takes a line and converts all leading tabs on that line into
+" spaces
+"
+" Args:
+"   -line: the line whose leading tabs will be converted
+function s:ConvertLeadingSpacesToTabs(line)
+    let toReturn  = a:line
+    while toReturn =~ '^\t*' . s:TabSpace() . '\(.*\)$'
+        let toReturn = substitute(toReturn, '^\(\t*\)' . s:TabSpace() . '\(.*\)$'  ,  '\1\t\2' , "")
+    endwhile
+
+    return toReturn
+endfunction
+
+
+" Function: s:ConvertLeadingTabsToSpaces(line) {{{2
+" This function takes a line and converts all leading spaces on that line into
+" tabs
+"
+" Args:
+"   -line: the line whose leading spaces will be converted
+function s:ConvertLeadingTabsToSpaces(line)
+    let toReturn  = a:line
+    while toReturn =~ '^\( *\)\t'
+        let toReturn = substitute(toReturn, '^\( *\)\t',  '\1' . s:TabSpace() , "")
+    endwhile
+
+    return toReturn
+endfunction
+
+" Function: s:ConvertLeadingWhiteSpace(line) {{{2
+" Converts the leading white space to tabs/spaces depending on &ts
+"
+" Args:
+"   -line: the line to convert
+function s:ConvertLeadingWhiteSpace(line)
+    let toReturn = a:line
+    while toReturn =~ '^ *\t'
+        let toReturn = substitute(toReturn, '^ *\zs\t\ze', s:TabSpace(), "g")
+    endwhile
+
+    if !&expandtab
+        let toReturn = s:ConvertLeadingSpacesToTabs(toReturn)
+    endif
+
+    return toReturn
+endfunction
+
+
+" Function: s:CountNonESCedOccurances(str, searchstr, escChar) {{{2
+" This function counts the number of substrings contained in another string.
+" These substrings are only counted if they are not escaped with escChar
+" Args:
+"   -str: the string to look for searchstr in
+"   -searchstr: the substring to search for in str
+"   -escChar: the escape character which, when preceding an instance of
+"    searchstr, will cause it not to be counted
+function s:CountNonESCedOccurances(str, searchstr, escChar)
+    "get the index of the first occurrence of searchstr
+    let indx = stridx(a:str, a:searchstr)
+
+    "if there is an instance of searchstr in str process it
+    if indx != -1
+        "get the remainder of str after this instance of searchstr is removed
+        let lensearchstr = strlen(a:searchstr)
+        let strLeft = strpart(a:str, indx+lensearchstr)
+
+        "if this instance of searchstr is not escaped, add one to the count
+        "and recurse. If it is escaped, just recurse
+        if !s:IsEscaped(a:str, indx, a:escChar)
+            return 1 + s:CountNonESCedOccurances(strLeft, a:searchstr, a:escChar)
+        else
+            return s:CountNonESCedOccurances(strLeft, a:searchstr, a:escChar)
+        endif
+    endif
+endfunction
+" Function: s:DoesBlockHaveDelim(delim, top, bottom) {{{2
+" Returns 1 if the given block of lines has a delimiter (a:delim) in it
+" Args:
+"   -delim: the comment delimiter to check the block for
+"   -top: the top line number of the block
+"   -bottom: the bottom line number of the block
+function s:DoesBlockHaveDelim(delim, top, bottom)
+    let currentLine = a:top
+    while currentLine < a:bottom
+        let theline = getline(currentLine)
+        if s:FindDelimiterIndex(a:delim, theline) != -1
+            return 1
+        endif
+        let currentLine = currentLine + 1
+    endwhile
+    return 0
+endfunction
+
+" Function: s:DoesBlockHaveMultipartDelim(top, bottom) {{{2
+" Returns 1 if the given block has a >= 1 multipart delimiter in it
+" Args:
+"   -top: the top line number of the block
+"   -bottom: the bottom line number of the block
+function s:DoesBlockHaveMultipartDelim(top, bottom)
+    if s:HasMultipartDelims()
+        if s:Multipart()
+            return s:DoesBlockHaveDelim(b:NERDLeft, a:top, a:bottom) || s:DoesBlockHaveDelim(b:NERDRight, a:top, a:bottom)
+        else
+            return s:DoesBlockHaveDelim(b:NERDLeftAlt, a:top, a:bottom) || s:DoesBlockHaveDelim(b:NERDRightAlt, a:top, a:bottom)
+        endif
+    endif
+    return 0
+endfunction
+
+
+" Function: s:Esc(str) {{{2
+" Escapes all the tricky chars in the given string
+function s:Esc(str)
+    let charsToEsc = '*/\."&$+'
+    return escape(a:str, charsToEsc)
+endfunction
+
+" Function: s:FindDelimiterIndex(delimiter, line) {{{2
+" This function is used to get the string index of the input comment delimiter
+" on the input line. If no valid comment delimiter is found in the line then
+" -1 is returned
+" Args:
+"   -delimiter: the delimiter we are looking to find the index of
+"   -line: the line we are looking for delimiter on
+function s:FindDelimiterIndex(delimiter, line)
+
+    "make sure the delimiter isnt empty otherwise we go into an infinite loop.
+    if a:delimiter == ""
+        return -1
+    endif
+
+
+    let l:delimiter = a:delimiter
+    let lenDel = strlen(l:delimiter)
+
+    "get the index of the first occurrence of the delimiter
+    let delIndx = stridx(a:line, l:delimiter)
+
+    "keep looping thru the line till we either find a real comment delimiter
+    "or run off the EOL
+    while delIndx != -1
+
+        "if we are not off the EOL get the str before the possible delimiter
+        "in question and check if it really is a delimiter. If it is, return
+        "its position
+        if delIndx != -1
+            if s:IsDelimValid(l:delimiter, delIndx, a:line)
+                return delIndx
+            endif
+        endif
+
+        "we have not yet found a real comment delimiter so move past the
+        "current one we are lookin at
+        let restOfLine = strpart(a:line, delIndx + lenDel)
+        let distToNextDelim = stridx(restOfLine , l:delimiter)
+
+        "if distToNextDelim is -1 then there is no more potential delimiters
+        "on the line so set delIndx to -1. Otherwise, move along the line by
+        "distToNextDelim
+        if distToNextDelim == -1
+            let delIndx = -1
+        else
+            let delIndx = delIndx + lenDel + distToNextDelim
+        endif
+    endwhile
+
+    "there is no comment delimiter on this line
+    return -1
+endfunction
+
+" Function: s:FindBoundingLinesOfSexyCom(lineNum) {{{2
+" This function takes in a line number and tests whether this line number is
+" the top/bottom/middle line of a sexy comment. If it is then the top/bottom
+" lines of the sexy comment are returned
+" Args:
+"   -lineNum: the line number that is to be tested whether it is the
+"    top/bottom/middle line of a sexy com
+" Returns:
+"   A string that has the top/bottom lines of the sexy comment encoded in it.
+"   The format is 'topline,bottomline'. If a:lineNum turns out not to be the
+"   top/bottom/middle of a sexy comment then -1 is returned
+function s:FindBoundingLinesOfSexyCom(lineNum)
+
+    "find which delimiters to look for as the start/end delims of the comment
+    let left = ''
+    let right = ''
+    if s:Multipart()
+        let left = s:GetLeft(0,0,1)
+        let right = s:GetRight(0,0,1)
+    elseif s:AltMultipart()
+        let left = s:GetLeft(1,0,1)
+        let right = s:GetRight(1,0,1)
+    else
+        return []
+    endif
+
+    let sexyComMarker = s:GetSexyComMarker(0, 1)
+
+    "initialise the top/bottom line numbers of the sexy comment to -1
+    let top = -1
+    let bottom = -1
+
+    let currentLine = a:lineNum
+    while top == -1 || bottom == -1
+        let theLine = getline(currentLine)
+
+        "check if the current line is the top of the sexy comment
+        if currentLine <= a:lineNum && theLine =~ '^[ \t]*' . left && theLine !~ '.*' . right && currentLine < s:NumLinesInBuf()
+            let top = currentLine
+            let currentLine = a:lineNum
+
+        "check if the current line is the bottom of the sexy comment
+        elseif theLine =~ '^[ \t]*' . right && theLine !~ '.*' . left && currentLine > 1
+            let bottom = currentLine
+
+        "the right delimiter is on the same line as the last sexyComMarker
+        elseif theLine =~ '^[ \t]*' . sexyComMarker . '.*' . right
+            let bottom = currentLine
+
+        "we have not found the top or bottom line so we assume currentLine is an
+        "intermediate line and look to prove otherwise
+        else
+
+            "if the line doesnt start with a sexyComMarker then it is not a sexy
+            "comment
+            if theLine !~ '^[ \t]*' . sexyComMarker
+                return []
+            endif
+
+        endif
+
+        "if top is -1 then we havent found the top yet so keep looking up
+        if top == -1
+            let currentLine = currentLine - 1
+        "if we have found the top line then go down looking for the bottom
+        else
+            let currentLine = currentLine + 1
+        endif
+
+    endwhile
+
+    return [top, bottom]
+endfunction
+
+
+" Function: s:GetLeft(alt, space, esc) {{{2
+" returns the left/left-alternative delimiter
+" Args:
+"   -alt: specifies whether to get left or left-alternative delim
+"   -space: specifies whether the delim should be spaced or not
+"    (the space string will only be added if NERDSpaceDelims is set)
+"   -esc: specifies whether the tricky chars in the delim should be ESCed
+function s:GetLeft(alt, space, esc)
+    let delim = b:NERDLeft
+
+    if a:alt
+        if b:NERDLeftAlt == ''
+            return ''
+        else
+            let delim = b:NERDLeftAlt
+        endif
+    endif
+    if delim == ''
+        return ''
+    endif
+
+    if a:space && g:NERDSpaceDelims
+        let delim = delim . s:spaceStr
+    endif
+
+    if a:esc
+        let delim = s:Esc(delim)
+    endif
+
+    return delim
+endfunction
+
+" Function: s:GetRight(alt, space, esc) {{{2
+" returns the right/right-alternative delimiter
+" Args:
+"   -alt: specifies whether to get right or right-alternative delim
+"   -space: specifies whether the delim should be spaced or not
+"   (the space string will only be added if NERDSpaceDelims is set)
+"   -esc: specifies whether the tricky chars in the delim should be ESCed
+function s:GetRight(alt, space, esc)
+    let delim = b:NERDRight
+
+    if a:alt
+        if !s:AltMultipart()
+            return ''
+        else
+            let delim = b:NERDRightAlt
+        endif
+    endif
+    if delim == ''
+        return ''
+    endif
+
+    if a:space && g:NERDSpaceDelims
+        let delim = s:spaceStr . delim
+    endif
+
+    if a:esc
+        let delim = s:Esc(delim)
+    endif
+
+    return delim
+endfunction
+
+
+" Function: s:GetSexyComMarker() {{{2
+" Returns the sexy comment marker for the current filetype.
+"
+" C style sexy comments are assumed if possible. If not then the sexy comment
+" marker is the last char of the delimiter pair that has both left and right
+" delims and has the longest left delim
+"
+" Args:
+"   -space: specifies whether the marker is to have a space string after it
+"    (the space string will only be added if NERDSpaceDelims is set)
+"   -esc: specifies whether the tricky chars in the marker are to be ESCed
+function s:GetSexyComMarker(space, esc)
+    let sexyComMarker = b:NERDSexyComMarker
+
+    "if there is no hardcoded marker then we find one
+    if sexyComMarker == ''
+
+        "if the filetype has c style comments then use standard c sexy
+        "comments
+        if s:HasCStyleComments()
+            let sexyComMarker = '*'
+        else
+            "find a comment marker by getting the longest available left delim
+            "(that has a corresponding right delim) and taking the last char
+            let lenLeft = strlen(b:NERDLeft)
+            let lenLeftAlt = strlen(b:NERDLeftAlt)
+            let left = ''
+            let right = ''
+            if s:Multipart() && lenLeft >= lenLeftAlt
+                let left = b:NERDLeft
+            elseif s:AltMultipart()
+                let left = b:NERDLeftAlt
+            else
+                return -1
+            endif
+
+            "get the last char of left
+            let sexyComMarker = strpart(left, strlen(left)-1)
+        endif
+    endif
+
+    if a:space && g:NERDSpaceDelims
+        let sexyComMarker = sexyComMarker . s:spaceStr
+    endif
+
+    if a:esc
+        let sexyComMarker = s:Esc(sexyComMarker)
+    endif
+
+    return sexyComMarker
+endfunction
+
+" Function: s:GetSexyComLeft(space, esc) {{{2
+" Returns the left delimiter for sexy comments for this filetype or -1 if
+" there is none. C style sexy comments are used if possible
+" Args:
+"   -space: specifies if the delim has a space string on the end
+"   (the space string will only be added if NERDSpaceDelims is set)
+"   -esc: specifies whether the tricky chars in the string are ESCed
+function s:GetSexyComLeft(space, esc)
+    let lenLeft = strlen(b:NERDLeft)
+    let lenLeftAlt = strlen(b:NERDLeftAlt)
+    let left = ''
+
+    "assume c style sexy comments if possible
+    if s:HasCStyleComments()
+        let left = '/*'
+    else
+        "grab the longest left delim that has a right
+        if s:Multipart() && lenLeft >= lenLeftAlt
+            let left = b:NERDLeft
+        elseif s:AltMultipart()
+            let left = b:NERDLeftAlt
+        else
+            return -1
+        endif
+    endif
+
+    if a:space && g:NERDSpaceDelims
+        let left = left . s:spaceStr
+    endif
+
+    if a:esc
+        let left = s:Esc(left)
+    endif
+
+    return left
+endfunction
+
+" Function: s:GetSexyComRight(space, esc) {{{2
+" Returns the right delimiter for sexy comments for this filetype or -1 if
+" there is none. C style sexy comments are used if possible.
+" Args:
+"   -space: specifies if the delim has a space string on the start
+"   (the space string will only be added if NERDSpaceDelims
+"   is specified for the current filetype)
+"   -esc: specifies whether the tricky chars in the string are ESCed
+function s:GetSexyComRight(space, esc)
+    let lenLeft = strlen(b:NERDLeft)
+    let lenLeftAlt = strlen(b:NERDLeftAlt)
+    let right = ''
+
+    "assume c style sexy comments if possible
+    if s:HasCStyleComments()
+        let right = '*/'
+    else
+        "grab the right delim that pairs with the longest left delim
+        if s:Multipart() && lenLeft >= lenLeftAlt
+            let right = b:NERDRight
+        elseif s:AltMultipart()
+            let right = b:NERDRightAlt
+        else
+            return -1
+        endif
+    endif
+
+    if a:space && g:NERDSpaceDelims
+        let right = s:spaceStr . right
+    endif
+
+    if a:esc
+        let right = s:Esc(right)
+    endif
+
+    return right
+endfunction
+
+" Function: s:HasMultipartDelims() {{{2
+" Returns 1 iff the current filetype has at least one set of multipart delims
+function s:HasMultipartDelims()
+    return s:Multipart() || s:AltMultipart()
+endfunction
+
+" Function: s:HasLeadingTabs(...) {{{2
+" Returns 1 if any of the given strings have leading tabs
+function s:HasLeadingTabs(...)
+    for s in a:000
+        if s =~ '^\t.*'
+            return 1
+        end
+    endfor
+    return 0
+endfunction
+" Function: s:HasCStyleComments() {{{2
+" Returns 1 iff the current filetype has c style comment delimiters
+function s:HasCStyleComments()
+    return (b:NERDLeft == '/*' && b:NERDRight == '*/') || (b:NERDLeftAlt == '/*' && b:NERDRightAlt == '*/')
+endfunction
+
+" Function: s:IsCommentedNormOrSexy(lineNum) {{{2
+"This function is used to determine whether the given line is commented with
+"either set of delimiters or if it is part of a sexy comment
+"
+" Args:
+"   -lineNum: the line number of the line to check
+function s:IsCommentedNormOrSexy(lineNum)
+    let theLine = getline(a:lineNum)
+
+    "if the line is commented normally return 1
+    if s:IsCommented(b:NERDLeft, b:NERDRight, theLine) || s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine)
+        return 1
+    endif
+
+    "if the line is part of a sexy comment return 1
+    if s:IsInSexyComment(a:lineNum)
+        return 1
+    endif
+    return 0
+endfunction
+
+" Function: s:IsCommented(left, right, line) {{{2
+"This function is used to determine whether the given line is commented with
+"the given delimiters
+"
+" Args:
+"   -line: the line that to check if commented
+"   -left/right: the left and right delimiters to check for
+function s:IsCommented(left, right, line)
+    "if the line isnt commented return true
+    if s:FindDelimiterIndex(a:left, a:line) != -1 && (s:FindDelimiterIndex(a:right, a:line) != -1 || !s:Multipart())
+        return 1
+    endif
+    return 0
+endfunction
+
+" Function: s:IsCommentedFromStartOfLine(left, line) {{{2
+"This function is used to determine whether the given line is commented with
+"the given delimiters at the start of the line i.e the left delimiter is the
+"first thing on the line (apart from spaces\tabs)
+"
+" Args:
+"   -line: the line that to check if commented
+"   -left: the left delimiter to check for
+function s:IsCommentedFromStartOfLine(left, line)
+    let theLine = s:ConvertLeadingTabsToSpaces(a:line)
+    let numSpaces = strlen(substitute(theLine, '^\( *\).*$', '\1', ''))
+    let delimIndx = s:FindDelimiterIndex(a:left, theLine)
+    return delimIndx == numSpaces
+endfunction
+
+" Function: s:IsCommentedOuttermost(left, right, leftAlt, rightAlt, line) {{{2
+" Finds the type of the outtermost delims on the line
+"
+" Args:
+"   -line: the line that to check if the outtermost comments on it are
+"    left/right
+"   -left/right: the left and right delimiters to check for
+"   -leftAlt/rightAlt: the left and right alternative delimiters to check for
+"
+" Returns:
+"   0 if the line is not commented with either set of delims
+"   1 if the line is commented with the left/right delim set
+"   2 if the line is commented with the leftAlt/rightAlt delim set
+function s:IsCommentedOuttermost(left, right, leftAlt, rightAlt, line)
+    "get the first positions of the left delims and the last positions of the
+    "right delims
+    let indxLeft = s:FindDelimiterIndex(a:left, a:line)
+    let indxLeftAlt = s:FindDelimiterIndex(a:leftAlt, a:line)
+    let indxRight = s:LastIndexOfDelim(a:right, a:line)
+    let indxRightAlt = s:LastIndexOfDelim(a:rightAlt, a:line)
+
+    "check if the line has a left delim before a leftAlt delim
+    if (indxLeft <= indxLeftAlt || indxLeftAlt == -1) && indxLeft != -1
+        "check if the line has a right delim after any rightAlt delim
+        if (indxRight > indxRightAlt && indxRight > indxLeft) || !s:Multipart()
+            return 1
+        endif
+
+        "check if the line has a leftAlt delim before a left delim
+    elseif (indxLeftAlt <= indxLeft || indxLeft == -1) && indxLeftAlt != -1
+        "check if the line has a rightAlt delim after any right delim
+        if (indxRightAlt > indxRight && indxRightAlt > indxLeftAlt) || !s:AltMultipart()
+            return 2
+        endif
+    else
+        return 0
+    endif
+
+    return 0
+
+endfunction
+
+
+" Function: s:IsDelimValid(delimiter, delIndx, line) {{{2
+" This function is responsible for determining whether a given instance of a
+" comment delimiter is a real delimiter or not. For example, in java the
+" // string is a comment delimiter but in the line:
+"               System.out.println("//");
+" it does not count as a comment delimiter. This function is responsible for
+" distinguishing between such cases. It does so by applying a set of
+" heuristics that are not fool proof but should work most of the time.
+"
+" Args:
+"   -delimiter: the delimiter we are validating
+"   -delIndx: the position of delimiter in line
+"   -line: the line that delimiter occurs in
+"
+" Returns:
+" 0 if the given delimiter is not a real delimiter (as far as we can tell) ,
+" 1 otherwise
+function s:IsDelimValid(delimiter, delIndx, line)
+    "get the delimiter without the escchars
+    let l:delimiter = a:delimiter
+
+    "get the strings before and after the delimiter
+    let preComStr = strpart(a:line, 0, a:delIndx)
+    let postComStr = strpart(a:line, a:delIndx+strlen(delimiter))
+
+    "to check if the delimiter is real, make sure it isnt preceded by
+    "an odd number of quotes and followed by the same (which would indicate
+    "that it is part of a string and therefore is not a comment)
+    if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, '"', "\\"))
+        return 0
+    endif
+    if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, "'", "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, "'", "\\"))
+        return 0
+    endif
+    if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, "`", "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, "`", "\\"))
+        return 0
+    endif
+
+
+    "if the comment delimiter is escaped, assume it isnt a real delimiter
+    if s:IsEscaped(a:line, a:delIndx, "\\")
+        return 0
+    endif
+
+    "vim comments are so fuckin stupid!! Why the hell do they have comment
+    "delimiters that are used elsewhere in the syntax?!?! We need to check
+    "some conditions especially for vim
+    if &filetype == "vim"
+        if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\"))
+            return 0
+        endif
+
+        "if the delimiter is on the very first char of the line or is the
+        "first non-tab/space char on the line then it is a valid comment delimiter
+        if a:delIndx == 0 || a:line =~ "^[ \t]\\{" . a:delIndx . "\\}\".*$"
+            return 1
+        endif
+
+        let numLeftParen =s:CountNonESCedOccurances(preComStr, "(", "\\")
+        let numRightParen =s:CountNonESCedOccurances(preComStr, ")", "\\")
+
+        "if the quote is inside brackets then assume it isnt a comment
+        if numLeftParen > numRightParen
+            return 0
+        endif
+
+        "if the line has an even num of unescaped "'s then we can assume that
+        "any given " is not a comment delimiter
+        if s:IsNumEven(s:CountNonESCedOccurances(a:line, "\"", "\\"))
+            return 0
+        endif
+    endif
+
+    return 1
+
+endfunction
+
+" Function: s:IsNumEven(num) {{{2
+" A small function the returns 1 if the input number is even and 0 otherwise
+" Args:
+"   -num: the number to check
+function s:IsNumEven(num)
+    return (a:num % 2) == 0
+endfunction
+
+" Function: s:IsEscaped(str, indx, escChar) {{{2
+" This function takes a string, an index into that string and an esc char and
+" returns 1 if the char at the index is escaped (i.e if it is preceded by an
+" odd number of esc chars)
+" Args:
+"   -str: the string to check
+"   -indx: the index into str that we want to check
+"   -escChar: the escape char the char at indx may be ESCed with
+function s:IsEscaped(str, indx, escChar)
+    "initialise numEscChars to 0 and look at the char before indx
+    let numEscChars = 0
+    let curIndx = a:indx-1
+
+    "keep going back thru str until we either reach the start of the str or
+    "run out of esc chars
+    while curIndx >= 0 && strpart(a:str, curIndx, 1) == a:escChar
+
+        "we have found another esc char so add one to the count and move left
+        "one char
+        let numEscChars  = numEscChars + 1
+        let curIndx = curIndx - 1
+
+    endwhile
+
+    "if there is an odd num of esc chars directly before the char at indx then
+    "the char at indx is escaped
+    return !s:IsNumEven(numEscChars)
+endfunction
+
+" Function: s:IsInSexyComment(line) {{{2
+" returns 1 if the given line number is part of a sexy comment
+function s:IsInSexyComment(line)
+    return !empty(s:FindBoundingLinesOfSexyCom(a:line))
+endfunction
+
+" Function: s:IsSexyComment(topline, bottomline) {{{2
+" This function takes in 2 line numbers and returns 1 if the lines between and
+" including the given line numbers are a sexy comment. It returns 0 otherwise.
+" Args:
+"   -topline: the line that the possible sexy comment starts on
+"   -bottomline: the line that the possible sexy comment stops on
+function s:IsSexyComment(topline, bottomline)
+
+    "get the delim set that would be used for a sexy comment
+    let left = ''
+    let right = ''
+    if s:Multipart()
+        let left = b:NERDLeft
+        let right = b:NERDRight
+    elseif s:AltMultipart()
+        let left = b:NERDLeftAlt
+        let right = b:NERDRightAlt
+    else
+        return 0
+    endif
+
+    "swap the top and bottom line numbers around if need be
+    let topline = a:topline
+    let bottomline = a:bottomline
+    if bottomline < topline
+        topline = bottomline
+        bottomline = a:topline
+    endif
+
+    "if there is < 2 lines in the comment it cannot be sexy
+    if (bottomline - topline) <= 0
+        return 0
+    endif
+
+    "if the top line doesnt begin with a left delim then the comment isnt sexy
+    if getline(a:topline) !~ '^[ \t]*' . left
+        return 0
+    endif
+
+    "if there is a right delim on the top line then this isnt a sexy comment
+    if s:FindDelimiterIndex(right, getline(a:topline)) != -1
+        return 0
+    endif
+
+    "if there is a left delim on the bottom line then this isnt a sexy comment
+    if s:FindDelimiterIndex(left, getline(a:bottomline)) != -1
+        return 0
+    endif
+
+    "if the bottom line doesnt begin with a right delim then the comment isnt
+    "sexy
+    if getline(a:bottomline) !~ '^.*' . right . '$'
+        return 0
+    endif
+
+    let sexyComMarker = s:GetSexyComMarker(0, 1)
+
+    "check each of the intermediate lines to make sure they start with a
+    "sexyComMarker
+    let currentLine = a:topline+1
+    while currentLine < a:bottomline
+        let theLine = getline(currentLine)
+
+        if theLine !~ '^[ \t]*' . sexyComMarker
+            return 0
+        endif
+
+        "if there is a right delim in an intermediate line then the block isnt
+        "a sexy comment
+        if s:FindDelimiterIndex(right, theLine) != -1
+            return 0
+        endif
+
+        let currentLine = currentLine + 1
+    endwhile
+
+    "we have not found anything to suggest that this isnt a sexy comment so
+    return 1
+
+endfunction
+
+" Function: s:LastIndexOfDelim(delim, str) {{{2
+" This function takes a string and a delimiter and returns the last index of
+" that delimiter in string
+" Args:
+"   -delim: the delimiter to look for
+"   -str: the string to look for delim in
+function s:LastIndexOfDelim(delim, str)
+    let delim = a:delim
+    let lenDelim = strlen(delim)
+
+    "set index to the first occurrence of delim. If there is no occurrence then
+    "bail
+    let indx = s:FindDelimiterIndex(delim, a:str)
+    if indx == -1
+        return -1
+    endif
+
+    "keep moving to the next instance of delim in str till there is none left
+    while 1
+
+        "search for the next delim after the previous one
+        let searchStr = strpart(a:str, indx+lenDelim)
+        let indx2 = s:FindDelimiterIndex(delim, searchStr)
+
+        "if we find a delim update indx to record the position of it, if we
+        "dont find another delim then indx is the last one so break out of
+        "this loop
+        if indx2 != -1
+            let indx = indx + indx2 + lenDelim
+        else
+            break
+        endif
+    endwhile
+
+    return indx
+
+endfunction
+
+" Function: s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) {{{2
+" This function takes in 2 line numbers and returns the index of the left most
+" char (that is not a space or a tab) on all of these lines.
+" Args:
+"   -countCommentedLines: 1 if lines that are commented are to be checked as
+"    well. 0 otherwise
+"   -countEmptyLines: 1 if empty lines are to be counted in the search
+"   -topline: the top line to be checked
+"   -bottomline: the bottom line to be checked
+function s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomline)
+
+    " declare the left most index as an extreme value
+    let leftMostIndx = 1000
+
+    " go thru the block line by line updating leftMostIndx
+    let currentLine = a:topline
+    while currentLine <= a:bottomline
+
+        " get the next line and if it is allowed to be commented, or is not
+        " commented, check it
+        let theLine = getline(currentLine)
+        if a:countEmptyLines || theLine !~ '^[ \t]*$'
+            if a:countCommentedLines || (!s:IsCommented(b:NERDLeft, b:NERDRight, theLine) && !s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine))
+                " convert spaces to tabs and get the number of leading spaces for
+                " this line and update leftMostIndx if need be
+                let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+                let leadSpaceOfLine = strlen( substitute(theLine, '\(^[ \t]*\).*$','\1','') )
+                if leadSpaceOfLine < leftMostIndx
+                    let leftMostIndx = leadSpaceOfLine
+                endif
+            endif
+        endif
+
+        " move on to the next line
+        let currentLine = currentLine + 1
+    endwhile
+
+    if leftMostIndx == 1000
+        return 0
+    else
+        return leftMostIndx
+    endif
+endfunction
+
+" Function: s:Multipart() {{{2
+" returns 1 if the current delims are multipart
+function s:Multipart()
+    return b:NERDRight != ''
+endfunction
+
+" Function: s:NerdEcho(msg, typeOfMsg) {{{2
+" Args:
+"   -msg: the message to echo
+"   -typeOfMsg: 0 = warning message
+"               1 = normal message
+function s:NerdEcho(msg, typeOfMsg)
+    if a:typeOfMsg == 0
+        echohl WarningMsg
+        echo 'NERDCommenter:' . a:msg
+        echohl None
+    elseif a:typeOfMsg == 1
+        echo 'NERDCommenter:' . a:msg
+    endif
+endfunction
+
+" Function: s:NumberOfLeadingTabs(s) {{{2
+" returns the number of leading tabs in the given string
+function s:NumberOfLeadingTabs(s)
+    return strlen(substitute(a:s, '^\(\t*\).*$', '\1', ""))
+endfunction
+
+" Function: s:NumLinesInBuf() {{{2
+" Returns the number of lines in the current buffer
+function s:NumLinesInBuf()
+    return line('$')
+endfunction
+
+" Function: s:ReplaceDelims(toReplace1, toReplace2, replacor1, replacor2, str) {{{2
+" This function takes in a string, 2 delimiters in that string and 2 strings
+" to replace these delimiters with.
+"
+" Args:
+"   -toReplace1: the first delimiter to replace
+"   -toReplace2: the second delimiter to replace
+"   -replacor1: the string to replace toReplace1 with
+"   -replacor2: the string to replace toReplace2 with
+"   -str: the string that the delimiters to be replaced are in
+function s:ReplaceDelims(toReplace1, toReplace2, replacor1, replacor2, str)
+    let line = s:ReplaceLeftMostDelim(a:toReplace1, a:replacor1, a:str)
+    let line = s:ReplaceRightMostDelim(a:toReplace2, a:replacor2, line)
+    return line
+endfunction
+
+" Function: s:ReplaceLeftMostDelim(toReplace, replacor, str) {{{2
+" This function takes a string and a delimiter and replaces the left most
+" occurrence of this delimiter in the string with a given string
+"
+" Args:
+"   -toReplace: the delimiter in str that is to be replaced
+"   -replacor: the string to replace toReplace with
+"   -str: the string that contains toReplace
+function s:ReplaceLeftMostDelim(toReplace, replacor, str)
+    let toReplace = a:toReplace
+    let replacor = a:replacor
+    "get the left most occurrence of toReplace
+    let indxToReplace = s:FindDelimiterIndex(toReplace, a:str)
+
+    "if there IS an occurrence of toReplace in str then replace it and return
+    "the resulting string
+    if indxToReplace != -1
+        let line = strpart(a:str, 0, indxToReplace) . replacor . strpart(a:str, indxToReplace+strlen(toReplace))
+        return line
+    endif
+
+    return a:str
+endfunction
+
+" Function: s:ReplaceRightMostDelim(toReplace, replacor, str) {{{2
+" This function takes a string and a delimiter and replaces the right most
+" occurrence of this delimiter in the string with a given string
+"
+" Args:
+"   -toReplace: the delimiter in str that is to be replaced
+"   -replacor: the string to replace toReplace with
+"   -str: the string that contains toReplace
+"
+function s:ReplaceRightMostDelim(toReplace, replacor, str)
+    let toReplace = a:toReplace
+    let replacor = a:replacor
+    let lenToReplace = strlen(toReplace)
+
+    "get the index of the last delim in str
+    let indxToReplace = s:LastIndexOfDelim(toReplace, a:str)
+
+    "if there IS a delimiter in str, replace it and return the result
+    let line = a:str
+    if indxToReplace != -1
+        let line = strpart(a:str, 0, indxToReplace) . replacor . strpart(a:str, indxToReplace+strlen(toReplace))
+    endif
+    return line
+endfunction
+
+"FUNCTION: s:RestoreScreenState() {{{2
+"
+"Sets the screen state back to what it was when s:SaveScreenState was last
+"called.
+"
+function s:RestoreScreenState()
+    if !exists("t:NERDComOldTopLine") || !exists("t:NERDComOldPos")
+        throw 'NERDCommenter exception: cannot restore screen'
+    endif
+
+    call cursor(t:NERDComOldTopLine, 0)
+    normal! zt
+    call setpos(".", t:NERDComOldPos)
+endfunction
+
+" Function: s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) {{{2
+" This function takes in 2 line numbers and returns the index of the right most
+" char on all of these lines.
+" Args:
+"   -countCommentedLines: 1 if lines that are commented are to be checked as
+"    well. 0 otherwise
+"   -countEmptyLines: 1 if empty lines are to be counted in the search
+"   -topline: the top line to be checked
+"   -bottomline: the bottom line to be checked
+function s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomline)
+    let rightMostIndx = -1
+
+    " go thru the block line by line updating rightMostIndx
+    let currentLine = a:topline
+    while currentLine <= a:bottomline
+
+        " get the next line and see if it is commentable, otherwise it doesnt
+        " count
+        let theLine = getline(currentLine)
+        if a:countEmptyLines || theLine !~ '^[ \t]*$'
+
+            if a:countCommentedLines || (!s:IsCommented(b:NERDLeft, b:NERDRight, theLine) && !s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine))
+
+                " update rightMostIndx if need be
+                let theLine = s:ConvertLeadingTabsToSpaces(theLine)
+                let lineLen = strlen(theLine)
+                if lineLen > rightMostIndx
+                    let rightMostIndx = lineLen
+                endif
+            endif
+        endif
+
+        " move on to the next line
+        let currentLine = currentLine + 1
+    endwhile
+
+    return rightMostIndx
+endfunction
+
+"FUNCTION: s:SaveScreenState() {{{2
+"Saves the current cursor position in the current buffer and the window
+"scroll position
+function s:SaveScreenState()
+    let t:NERDComOldPos = getpos(".")
+    let t:NERDComOldTopLine = line("w0")
+endfunction
+
+" Function: s:SwapOutterMultiPartDelimsForPlaceHolders(line) {{{2
+" This function takes a line and swaps the outter most multi-part delims for
+" place holders
+" Args:
+"   -line: the line to swap the delims in
+"
+function s:SwapOutterMultiPartDelimsForPlaceHolders(line)
+    " find out if the line is commented using normal delims and/or
+    " alternate ones
+    let isCommented = s:IsCommented(b:NERDLeft, b:NERDRight, a:line)
+    let isCommentedAlt = s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, a:line)
+
+    let line2 = a:line
+
+    "if the line is commented and there is a right delimiter, replace
+    "the delims with place-holders
+    if isCommented && s:Multipart()
+        let line2 = s:ReplaceDelims(b:NERDLeft, b:NERDRight, g:NERDLPlace, g:NERDRPlace, a:line)
+
+    "similarly if the line is commented with the alternative
+    "delimiters
+    elseif isCommentedAlt && s:AltMultipart()
+        let line2 = s:ReplaceDelims(b:NERDLeftAlt, b:NERDRightAlt, g:NERDLPlace, g:NERDRPlace, a:line)
+    endif
+
+    return line2
+endfunction
+
+" Function: s:SwapOutterPlaceHoldersForMultiPartDelims(line) {{{2
+" This function takes a line and swaps the outtermost place holders for
+" multi-part delims
+" Args:
+"   -line: the line to swap the delims in
+"
+function s:SwapOutterPlaceHoldersForMultiPartDelims(line)
+    let left = ''
+    let right = ''
+    if s:Multipart()
+        let left = b:NERDLeft
+        let right = b:NERDRight
+    elseif s:AltMultipart()
+        let left = b:NERDLeftAlt
+        let right = b:NERDRightAlt
+    endif
+
+    let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, a:line)
+    return line
+endfunction
+" Function: s:TabbedCol(line, col) {{{2
+" Gets the col number for given line and existing col number. The new col
+" number is the col number when all leading spaces are converted to tabs
+" Args:
+"   -line:the line to get the rel col for
+"   -col: the abs col
+function s:TabbedCol(line, col)
+    let lineTruncated = strpart(a:line, 0, a:col)
+    let lineSpacesToTabs = substitute(lineTruncated, s:TabSpace(), '\t', 'g')
+    return strlen(lineSpacesToTabs)
+endfunction
+"FUNCTION: s:TabSpace() {{{2
+"returns a string of spaces equal in length to &tabstop
+function s:TabSpace()
+    let tabSpace = ""
+    let spacesPerTab = &tabstop
+    while spacesPerTab > 0
+        let tabSpace = tabSpace . " "
+        let spacesPerTab = spacesPerTab - 1
+    endwhile
+    return tabSpace
+endfunction
+
+" Function: s:UnEsc(str, escChar) {{{2
+" This function removes all the escape chars from a string
+" Args:
+"   -str: the string to remove esc chars from
+"   -escChar: the escape char to be removed
+function s:UnEsc(str, escChar)
+    return substitute(a:str, a:escChar, "", "g")
+endfunction
+
+" Function: s:UntabbedCol(line, col) {{{2
+" Takes a line and a col and returns the absolute column of col taking into
+" account that a tab is worth 3 or 4 (or whatever) spaces.
+" Args:
+"   -line:the line to get the abs col for
+"   -col: the col that doesnt take into account tabs
+function s:UntabbedCol(line, col)
+    let lineTruncated = strpart(a:line, 0, a:col)
+    let lineTabsToSpaces = substitute(lineTruncated, '\t', s:TabSpace(), 'g')
+    return strlen(lineTabsToSpaces)
+endfunction
+" Section: Comment mapping setup {{{1
+" ===========================================================================
+
+" switch to/from alternative delimiters
+nnoremap <plug>NERDCommenterAltDelims :call <SID>SwitchToAlternativeDelimiters(1)<cr>
+
+" comment out lines
+nnoremap <silent> <plug>NERDCommenterComment :call NERDComment(0, "norm")<cr>
+vnoremap <silent> <plug>NERDCommenterComment <ESC>:call NERDComment(1, "norm")<cr>
+
+" toggle comments
+nnoremap <silent> <plug>NERDCommenterToggle :call NERDComment(0, "toggle")<cr>
+vnoremap <silent> <plug>NERDCommenterToggle <ESC>:call NERDComment(1, "toggle")<cr>
+
+" minimal comments
+nnoremap <silent> <plug>NERDCommenterMinimal :call NERDComment(0, "minimal")<cr>
+vnoremap <silent> <plug>NERDCommenterMinimal <ESC>:call NERDComment(1, "minimal")<cr>
+
+" sexy comments
+nnoremap <silent> <plug>NERDCommenterSexy :call NERDComment(0, "sexy")<CR>
+vnoremap <silent> <plug>NERDCommenterSexy <ESC>:call NERDComment(1, "sexy")<CR>
+
+" invert comments
+nnoremap <silent> <plug>NERDCommenterInvert :call NERDComment(0, "invert")<CR>
+vnoremap <silent> <plug>NERDCommenterInvert <ESC>:call NERDComment(1, "invert")<CR>
+
+" yank then comment
+nmap <silent> <plug>NERDCommenterYank :call NERDComment(0, "yank")<CR>
+vmap <silent> <plug>NERDCommenterYank <ESC>:call NERDComment(1, "yank")<CR>
+
+" left aligned comments
+nnoremap <silent> <plug>NERDCommenterAlignLeft :call NERDComment(0, "alignLeft")<cr>
+vnoremap <silent> <plug>NERDCommenterAlignLeft <ESC>:call NERDComment(1, "alignLeft")<cr>
+
+" left and right aligned comments
+nnoremap <silent> <plug>NERDCommenterAlignBoth :call NERDComment(0, "alignBoth")<cr>
+vnoremap <silent> <plug>NERDCommenterAlignBoth <ESC>:call NERDComment(1, "alignBoth")<cr>
+
+" nested comments
+nnoremap <silent> <plug>NERDCommenterNest :call NERDComment(0, "nested")<cr>
+vnoremap <silent> <plug>NERDCommenterNest <ESC>:call NERDComment(1, "nested")<cr>
+
+" uncomment
+nnoremap <silent> <plug>NERDCommenterUncomment :call NERDComment(0, "uncomment")<cr>
+vnoremap <silent> <plug>NERDCommenterUncomment :call NERDComment(1, "uncomment")<cr>
+
+" comment till the end of the line
+nnoremap <silent> <plug>NERDCommenterToEOL :call NERDComment(0, "toEOL")<cr>
+
+" append comments
+nmap <silent> <plug>NERDCommenterAppend :call NERDComment(0, "append")<cr>
+
+" insert comments
+inoremap <silent> <plug>NERDCommenterInInsert <SPACE><BS><ESC>:call NERDComment(0, "insert")<CR>
+
+
+function! s:CreateMaps(target, combo)
+    if !hasmapto(a:target, 'n')
+        exec 'nmap ' . a:combo . ' ' . a:target
+    endif
+
+    if !hasmapto(a:target, 'v')
+        exec 'vmap ' . a:combo . ' ' . a:target
+    endif
+endfunction
+
+if g:NERDCreateDefaultMappings
+    call s:CreateMaps('<plug>NERDCommenterComment',    ',cc')
+    call s:CreateMaps('<plug>NERDCommenterToggle',     ',c<space>')
+    call s:CreateMaps('<plug>NERDCommenterMinimal',    ',cm')
+    call s:CreateMaps('<plug>NERDCommenterSexy',       ',cs')
+    call s:CreateMaps('<plug>NERDCommenterInvert',     ',ci')
+    call s:CreateMaps('<plug>NERDCommenterYank',       ',cy')
+    call s:CreateMaps('<plug>NERDCommenterAlignLeft',  ',cl')
+    call s:CreateMaps('<plug>NERDCommenterAlignBoth',  ',cb')
+    call s:CreateMaps('<plug>NERDCommenterNest',       ',cn')
+    call s:CreateMaps('<plug>NERDCommenterUncomment',  ',cu')
+    call s:CreateMaps('<plug>NERDCommenterToEOL',      ',c$')
+    call s:CreateMaps('<plug>NERDCommenterAppend',     ',cA')
+
+    if !hasmapto('<plug>NERDCommenterAltDelims', 'n')
+        nmap ,ca <plug>NERDCommenterAltDelims
+    endif
+endif
+
+
+
+" Section: Menu item setup {{{1
+" ===========================================================================
+"check if the user wants the menu to be displayed
+if g:NERDMenuMode != 0
+
+    let menuRoot = ""
+    if g:NERDMenuMode == 1
+        let menuRoot = 'comment'
+    elseif g:NERDMenuMode == 2
+        let menuRoot = '&comment'
+    elseif g:NERDMenuMode == 3
+        let menuRoot = '&Plugin.&comment'
+    endif
+
+    function! s:CreateMenuItems(target, desc, root)
+        exec 'nmenu <silent> ' . a:root . '.' . a:desc . ' ' . a:target
+        exec 'vmenu <silent> ' . a:root . '.' . a:desc . ' ' . a:target
+    endfunction
+    call s:CreateMenuItems("<plug>NERDCommenterComment",    'Comment', menuRoot)
+    call s:CreateMenuItems("<plug>NERDCommenterToggle",     'Toggle', menuRoot)
+    call s:CreateMenuItems('<plug>NERDCommenterMinimal',    'Minimal', menuRoot)
+    call s:CreateMenuItems('<plug>NERDCommenterNest',       'Nested', menuRoot)
+    exec 'nmenu <silent> '. menuRoot .'.To\ EOL <plug>NERDCommenterToEOL'
+    call s:CreateMenuItems('<plug>NERDCommenterInvert',     'Invert', menuRoot)
+    call s:CreateMenuItems('<plug>NERDCommenterSexy',       'Sexy', menuRoot)
+    call s:CreateMenuItems('<plug>NERDCommenterYank',       'Yank\ then\ comment', menuRoot)
+    exec 'nmenu <silent> '. menuRoot .'.Append <plug>NERDCommenterAppend'
+    exec 'menu <silent> '. menuRoot .'.-Sep-    :'
+    call s:CreateMenuItems('<plug>NERDCommenterAlignLeft',  'Left\ aligned', menuRoot)
+    call s:CreateMenuItems('<plug>NERDCommenterAlignBoth',  'Left\ and\ right\ aligned', menuRoot)
+    exec 'menu <silent> '. menuRoot .'.-Sep2-    :'
+    call s:CreateMenuItems('<plug>NERDCommenterUncomment',  'Uncomment', menuRoot)
+    exec 'nmenu <silent> '. menuRoot .'.Switch\ Delimiters <plug>NERDCommenterAltDelims'
+    exec 'imenu <silent> '. menuRoot .'.Insert\ Comment\ Here <plug>NERDCommenterInInsert'
+    exec 'menu <silent> '. menuRoot .'.-Sep3-    :'
+    exec 'menu <silent>'. menuRoot .'.Help :help NERDCommenterContents<CR>'
+endif
+" vim: set foldmethod=marker :
diff --git a/etc/vim/plugin/calendar.vim b/etc/vim/plugin/calendar.vim
new file mode 100644 (file)
index 0000000..fa25858
--- /dev/null
@@ -0,0 +1,1263 @@
+"=============================================================================
+" What Is This: Calendar
+" File: calendar.vim
+" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
+" Last Change: Thu, 08 Oct 2009
+" Version: 1.8
+" Thanks:
+"     Yu Pei                        : bug report
+"     Per Winkvist                  : bug fix
+"     Serge (gentoosiast) Koksharov : bug fix
+"     Vitor Antunes                 : bug fix
+"     Olivier Mengue                : bug fix
+"     Noel Henson                   : today action
+"     Per Winkvist                  : bug report
+"     Peter Findeisen               : bug fix
+"     Chip Campbell                 : gave a hint for 1.3z
+"     PAN Shizhu                    : gave a hint for 1.3y
+"     Eric Wald                     : bug fix
+"     Sascha Wuestemann             : advise
+"     Linas Vasiliauskas            : bug report
+"     Per Winkvist                  : bug report
+"     Ronald Hoelwarth              : gave a hint for 1.3s
+"     Vikas Agnihotri               : bug report
+"     Steve Hall                    : gave a hint for 1.3q
+"     James Devenish                : bug fix
+"     Carl Mueller                  : gave a hint for 1.3o
+"     Klaus Fabritius               : bug fix
+"     Stucki                        : gave a hint for 1.3m
+"     Rosta                         : bug report
+"     Richard Bair                  : bug report
+"     Yin Hao Liew                  : bug report
+"     Bill McCarthy                 : bug fix and gave a hint
+"     Srinath Avadhanula            : bug fix
+"     Ronald Hoellwarth             : few advices
+"     Juan Orlandini                : added higlighting of days with data
+"     Ray                           : bug fix
+"     Ralf.Schandl                  : gave a hint for 1.3
+"     Bhaskar Karambelkar           : bug fix
+"     Suresh Govindachar            : gave a hint for 1.2, bug fix
+"     Michael Geddes                : bug fix
+"     Leif Wickland                 : bug fix
+" Usage:
+"     :Calendar
+"       show calendar at this year and this month
+"     :Calendar 8
+"       show calendar at this year and given month
+"     :Calendar 2001 8
+"       show calendar at given year and given month
+"     :CalendarH ...
+"       show horizontal calendar ...
+"
+"     <Leader>ca
+"       show calendar in normal mode
+"     <Leader>ch
+"       show horizontal calendar ...
+" ChangeLog:
+"     1.8  : bug fix, E382 when close diary.
+"     1.7  : bug fix, week number was broken on 2008.
+"     1.6  : added calendar_begin action.
+"            added calendar_end action.
+"     1.5  : bug fix, fixed ruler formating with strpart.
+"            bug fix, using winfixheight.
+"     1.4a : bug fix, week number was broken on 2005.
+"            added calendar_today action.
+"            bug fix, about wrapscan.
+"            bug fix, about today mark.
+"            bug fix, about today navigation.
+"     1.4  : bug fix, and one improvement.
+"            bug 1:
+"              when marking the current date, there is not distinguished e.g. between
+"              20041103 and 20040113, both dates are marked as today
+"            bug 2:
+"              the navigation mark "today" doesn't work
+"            improvement:
+"              the mapping t worked only when today was displayed, now it works always
+"              and redisplays the cuurent month and today
+"     1.3z : few changes
+"            asign <Left>, <Right> for navigation.
+"            set ws for search navigation.
+"            add tag for GetLatestVimScripts(AutoInstall)
+"     1.3y : bug fix, few changes
+"            changed color syntax name. (ex. CalNavi, see bottom of this)
+"            changed a map CalendarV for <Leader>cal
+"            changed a map CalendarH for <Leader>caL
+"            (competitive map for cvscommand.vim)
+"            the date on the right-hand side didn't work correctoly.
+"            make a map to rebuild Calendar window(r).
+"     1.3x : bug fix
+"            viweek can't refer when not set calendar_weeknm.
+"     1.3w : bug fix
+"            on leap year, week number decreases.
+"     1.3v : bug fix
+"            add nowrapscan 
+"            use s:bufautocommandsset for making title
+"            don't focus to navi when doubleclick bottom next>.
+"     1.3u : bug fix
+"             when enter diary first time,
+"              it don't warn that you don't have diary directory.
+"     1.3t : bug fix
+"             make sure the variables for help
+"     1.3s : bug fix
+"             make a map CalendarV for <Leader>ca
+"            add option calendar_navi_label
+"             see Additional:
+"            add option calendar_focus_today
+"             see Additional:
+"            add map ? for help
+"     1.3r : bug fix
+"             if clicked navigator, cursor go to strange position.
+"     1.3q : bug fix
+"             coundn't set calendar_navi
+"              in its horizontal direction
+"     1.3p : bug fix
+"             coundn't edit diary when the calendar is
+"              in its horizontal direction
+"     1.3o : add option calendar_mark, and delete calendar_rmark
+"             see Additional:
+"            add option calendar_navi
+"             see Additional:
+"     1.3n : bug fix
+"             s:CalendarSign() should use filereadable(expand(sfile)).
+"     1.3m : tuning
+"             using topleft or botright for opening Calendar.
+"            use filereadable for s:CalendarSign().
+"     1.3l : bug fix
+"             if set calendar_monday, it can see that Sep 1st is Sat
+"               as well as Aug 31st.
+"     1.3k : bug fix
+"             it didn't escape the file name on calendar.
+"     1.3j : support for fixed Gregorian
+"             added the part of Sep 1752.
+"     1.3i : bug fix
+"             Calculation mistake for week number.
+"     1.3h : add option for position of displaying '*' or '+'.
+"             see Additional:
+"     1.3g : centering header
+"            add option for show name of era.
+"             see Additional:
+"            bug fix
+"             <Leader>ca didn't show current month.
+"     1.3f : bug fix
+"            there was yet another bug of today's sign.
+"     1.3e : added usage for <Leader>
+"            support handler for sign.
+"            see Additional:
+"     1.3d : added higlighting of days that have calendar data associated
+"             with it.
+"            bug fix for calculates date.
+"     1.3c : bug fix for MakeDir()
+"            if CalendarMakeDir(sfile) != 0
+"               v 
+"            if s:CalendarMakeDir(sfile) != 0
+"     1.3b : bug fix for calendar_monday.
+"            it didn't work g:calendar_monday correctly.
+"            add g:calendar_version.
+"            add argument on action handler.
+"            see Additional:
+"     1.3a : bug fix for MakeDir().
+"            it was not able to make directory.
+"     1.3  : support handler for action.
+"            see Additional:
+"     1.2g : bug fix for today's sign.
+"            it could not display today's sign correctly.
+"     1.2f : bug fix for current Date.
+"            vtoday variable calculates date as 'YYYYMMDD'
+"            while the loop calculates date as 'YYYYMMD' i.e just 1 digit
+"            for date if < 10 so if current date is < 10 , the if condiction
+"            to check for current date fails and current date is not
+"            highlighted.
+"            simple solution changed vtoday calculation line divide the
+"            current-date by 1 so as to get 1 digit date.
+"     1.2e : change the way for setting title.
+"            auto configuration for g:calendar_wruler with g:calendar_monday
+"     1.2d : add option for show week number.
+"              let g:calendar_weeknm = 1
+"            add separator if horizontal.
+"            change all option's name
+"              g:calendar_mnth -> g:calendar_mruler
+"              g:calendar_week -> g:calendar_wruler
+"              g:calendar_smnd -> g:calendar_monday
+"     1.2c : add option for that the week starts with monday.
+"              let g:calendar_smnd = 1
+"     1.2b : bug fix for modifiable.
+"            setlocal nomodifiable (was set)
+"     1.2a : add default options.
+"            nonumber,foldcolumn=0,nowrap... as making gap
+"     1.2  : support wide display.
+"            add a command CalendarH
+"            add map <s-left> <s-right>
+"     1.1c : extra.
+"            add a titlestring for today.
+"     1.1b : bug fix by Michael Geddes.
+"            it happend when do ':Calender' twice
+"     1.1a : fix misspell.
+"            Calender -> Calendar
+"     1.1  : bug fix.
+"            it"s about strftime("%m")
+"     1.0a : bug fix by Leif Wickland.
+"            it"s about strftime("%w")
+"     1.0  : first release.
+" TODO:
+"     add the option for diary which is separate or single file.
+" Additional:
+"     *if you want to keep focus when goto next or prev calendar,
+"       add the following to your .vimrc:
+"
+"       let g:calendar_focus_today = 1
+"
+"     *if you want to place the mark('*' or '+') after the day,
+"       add the following to your .vimrc:
+"
+"       let g:calendar_mark = 'right'
+"
+"       NOTE:you can set 'left', 'left-fit', 'right' for this option.
+"
+"     *if you want to use navigator,
+"       add the following to your .vimrc:
+"
+"       let g:calendar_navi = ''
+"
+"       NOTE:you can set 'top', 'bottom', 'both' for this option.
+"
+"     *if you want to replace navigator in your language,
+"       add the following to your .vimrc:
+"
+"       let g:calendar_navi_label = 'Prev,Today,Next'
+"
+"       NOTE:it must be separated with ','.
+"
+"     *if you want to replace calendar header,
+"       add the following in your favorite language to your .vimrc:
+"
+"       let g:calendar_erafmt = 'Heisei,-1988'   " for Japanese
+"       (name of era and diff with A.D.)
+"
+"     *if you want to replace calendar ruler,
+"       add the following in your favorite language to your .vimrc:
+"
+"       let g:calendar_mruler = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'
+"       let g:calendar_wruler = 'Su Mo Tu We Th Fr Sa'
+"
+"     *if you want the week to start with monday, add below to your .vimrc:
+"
+"       let g:calendar_monday = 1
+"       (You don't have to to change g:calendar_wruler!)
+"
+"     *if you want to show week number, add this to your .vimrc:
+"
+"       set g:calendar_weeknm as below
+"       (Can't be used together with g:calendar_monday.)
+"
+"       let g:calendar_weeknm = 1 " WK01
+"       let g:calendar_weeknm = 2 " WK 1
+"       let g:calendar_weeknm = 3 " KW01
+"       let g:calendar_weeknm = 4 " KW 1
+"
+"     *if you want to hook calender when pressing enter,
+"       add this to your .vimrc:
+"
+"       function MyCalAction(day,month,year,week,dir)
+"         " day   : day you actioned
+"         " month : month you actioned
+"         " year  : year you actioned
+"         " week  : day of week (Mo=1 ... Su=7)
+"         " dir   : direction of calendar
+"       endfunction
+"       let calendar_action = 'MyCalAction'
+"
+"       also, Calendar call following actions when begin or end of display.
+"       them actions are called at one each time when it show 3 months display.
+"
+"       function MyCalActionBegin()
+"       endfunction
+"       let calendar_begin = 'MyCalActionBegin'
+"
+"       function MyCalActionEnd()
+"       endfunction
+"       let calendar_end = 'MyCalActionEnd'
+"
+"     *if you want to show sign in calender,
+"       add this to your .vimrc:
+"
+"       function MyCalSign(day,month,year)
+"         " day   : day you actioned
+"         " month : month you actioned
+"         " year  : year you actioned
+"         if a:day == 1 && a:month == 1
+"           return 1 " happy new year
+"         else
+"           return 0 " or not
+"         endif
+"       endfunction
+"       let calendar_sign = 'MyCalSign'
+"
+"     *if you want to hook calender when pressing 'today',
+"       add this to your .vimrc:
+"
+"       function MyCalToday()
+"       endfunction
+"       let calendar_today = 'MyCalToday'
+"
+"     *if you want to get the version of this.
+"       type below.
+"
+"       :echo calendar_version
+" GetLatestVimScripts: 52 1 :AutoInstall: calendar.vim
+
+if &compatible || exists("g:calendar_version")
+  finish
+endif
+let g:calendar_version = "1.8"
+
+if !exists("g:calendar_action")
+  let g:calendar_action = "<SID>CalendarDiary"
+endif
+if !exists("g:calendar_sign")
+  let g:calendar_sign = "<SID>CalendarSign"
+endif
+if !exists("g:calendar_mark")
+ \|| (g:calendar_mark != 'left'
+ \&& g:calendar_mark != 'left-fit'
+ \&& g:calendar_mark != 'right')
+  let g:calendar_mark = 'left'
+endif
+if !exists("g:calendar_navi")
+ \|| (g:calendar_navi != 'top'
+ \&& g:calendar_navi != 'bottom'
+ \&& g:calendar_navi != 'both'
+ \&& g:calendar_navi != '')
+  let g:calendar_navi = 'top'
+endif
+if !exists("g:calendar_navi_label")
+  let g:calendar_navi_label = "Prev,Today,Next"
+endif
+if !exists("g:calendar_diary")
+  let g:calendar_diary = "~/diary"
+endif
+if !exists("g:calendar_focus_today")
+  let g:calendar_focus_today = 0
+endif
+
+"*****************************************************************
+"* Calendar commands
+"*****************************************************************
+:command! -nargs=* Calendar  call Calendar(0,<f-args>)
+:command! -nargs=* CalendarH call Calendar(1,<f-args>)
+
+if !hasmapto("<Plug>CalendarV")
+  nmap <unique> <Leader>cal <Plug>CalendarV
+endif
+if !hasmapto("<Plug>CalendarH")
+  nmap <unique> <Leader>caL <Plug>CalendarH
+endif
+nmap <silent> <Plug>CalendarV :cal Calendar(0)<CR>
+nmap <silent> <Plug>CalendarH :cal Calendar(1)<CR>
+
+"*****************************************************************
+"* GetToken : get token from source with count
+"*----------------------------------------------------------------
+"*   src : source
+"*   dlm : delimiter
+"*   cnt : skip count
+"*****************************************************************
+function! s:GetToken(src,dlm,cnt)
+  let tokn_hit=0     " flag of found
+  let tokn_fnd=''    " found path
+  let tokn_spl=''    " token
+  let tokn_all=a:src " all source
+
+  " safe for end
+  let tokn_all = tokn_all.a:dlm
+  while 1
+    let tokn_spl = strpart(tokn_all,0,match(tokn_all,a:dlm))
+    let tokn_hit = tokn_hit + 1
+    if tokn_hit == a:cnt
+      return tokn_spl
+    endif
+    let tokn_all = strpart(tokn_all,strlen(tokn_spl.a:dlm))
+    if tokn_all == ''
+      break
+    endif
+  endwhile
+  return ''
+endfunction
+
+"*****************************************************************
+"* CalendarDoAction : call the action handler function
+"*----------------------------------------------------------------
+"*****************************************************************
+function! s:CalendarDoAction(...)
+  " if no action defined return
+  if !exists("g:calendar_action")
+    return
+  endif
+
+  " for navi
+  if exists('g:calendar_navi')
+    let navi = (a:0 > 0)? a:1 : expand("<cWORD>")
+    let curl = line(".")
+    if navi == '<' . s:GetToken(g:calendar_navi_label, ',', 1)
+      exec substitute(maparg('<s-left>', 'n'), '<CR>', '', '')
+    elseif navi == s:GetToken(g:calendar_navi_label, ',', 3) . '>'
+      exec substitute(maparg('<s-right>', 'n'), '<CR>', '', '')
+    elseif navi == s:GetToken(g:calendar_navi_label, ',', 2)
+      call Calendar(b:CalendarDir)
+      if exists('g:calendar_today')
+        exe "call " . g:calendar_today . "()"
+      endif
+    else
+      let navi = ''
+    endif
+    if navi != ''
+      if g:calendar_focus_today == 1 && search("\*","w") > 0
+        silent execute "normal! gg/\*\<cr>"
+        return
+      else
+        setlocal ws
+        if curl < line('$')/2
+          silent execute "normal! gg0/".navi."\<cr>"
+        else
+          silent execute "normal! G0/".navi."\<cr>"
+        endif
+        setlocal nows
+        return
+      endif
+    endif
+  endif
+
+  if b:CalendarDir
+    let dir = 'H'
+    if !exists('g:calendar_monday') && exists('g:calendar_weeknm')
+      let cnr = col('.') - (col('.')%(24+5)) + 1
+    else
+      let cnr = col('.') - (col('.')%(24)) + 1
+    endif
+    let week = ((col(".") - cnr - 1 + cnr/49) / 3)
+  else
+    let dir = 'V'
+    let cnr = 1
+    let week = ((col(".")+1) / 3) - 1
+  endif
+  let lnr = 1
+  let hdr = 1
+  while 1
+    if lnr > line('.')
+      break
+    endif
+    let sline = getline(lnr)
+    if sline =~ '^\s*$'
+      let hdr = lnr + 1
+    endif
+    let lnr = lnr + 1
+  endwhile
+  let lnr = line('.')
+  if(exists('g:calendar_monday'))
+      let week = week + 1
+  elseif(week == 0)
+      let week = 7
+  endif
+  if lnr-hdr < 2
+    return
+  endif
+  let sline = substitute(strpart(getline(hdr),cnr,21),'\s*\(.*\)\s*','\1','')
+  if (col(".")-cnr) > 21
+    return
+  endif
+
+  " extract day
+  if g:calendar_mark == 'right' && col('.') > 1
+    normal! h
+    let day = matchstr(expand("<cword>"), '[^0].*')
+    normal! l
+  else
+    let day = matchstr(expand("<cword>"), '[^0].*')
+  endif
+  if day == 0
+    return
+  endif
+  " extract year and month
+  if exists('g:calendar_erafmt') && g:calendar_erafmt !~ "^\s*$"
+    let year = matchstr(substitute(sline, '/.*', '', ''), '\d\+')
+    let month = matchstr(substitute(sline, '.*/\(\d\d\=\).*', '\1', ""), '[^0].*')
+    if g:calendar_erafmt =~ '.*,[+-]*\d\+'
+      let veranum=substitute(g:calendar_erafmt,'.*,\([+-]*\d\+\)','\1','')
+      if year-veranum > 0
+        let year=year-veranum
+      endif
+    endif
+  else
+    let year  = matchstr(substitute(sline, '/.*', '', ''), '[^0].*')
+    let month = matchstr(substitute(sline, '\d*/\(\d\d\=\).*', '\1', ""), '[^0].*')
+  endif
+  " call the action function
+  exe "call " . g:calendar_action . "(day, month, year, week, dir)"
+endfunc
+
+"*****************************************************************
+"* Calendar : build calendar
+"*----------------------------------------------------------------
+"*   a1 : direction
+"*   a2 : month(if given a3, it's year)
+"*   a3 : if given, it's month
+"*****************************************************************
+function! Calendar(...)
+
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  "+++ ready for build
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  " remember today
+  " divide strftime('%d') by 1 so as to get "1,2,3 .. 9" instead of "01, 02, 03 .. 09"
+  let vtoday = strftime('%Y').strftime('%m').strftime('%d')
+
+  " get arguments
+  if a:0 == 0
+    let dir = 0
+    let vyear = strftime('%Y')
+    let vmnth = matchstr(strftime('%m'), '[^0].*')
+  elseif a:0 == 1
+    let dir = a:1
+    let vyear = strftime('%Y')
+    let vmnth = matchstr(strftime('%m'), '[^0].*')
+  elseif a:0 == 2
+    let dir = a:1
+    let vyear = strftime('%Y')
+    let vmnth = matchstr(a:2, '^[^0].*')
+  else
+    let dir = a:1
+    let vyear = a:2
+    let vmnth = matchstr(a:3, '^[^0].*')
+  endif
+
+  " remember constant
+  let vmnth_org = vmnth
+  let vyear_org = vyear
+
+  " start with last month
+  let vmnth = vmnth - 1
+  if vmnth < 1
+    let vmnth = 12
+    let vyear = vyear - 1
+  endif
+
+  " reset display variables
+  let vdisplay1 = ''
+  let vheight = 1
+  let vmcnt = 0
+
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  "+++ build display
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  if exists("g:calendar_begin")
+    exe "call " . g:calendar_begin . "()"
+  endif
+  while vmcnt < 3
+    let vcolumn = 22
+    let vnweek = -1
+    "--------------------------------------------------------------
+    "--- calculating
+    "--------------------------------------------------------------
+    " set boundary of the month
+    if vmnth == 1
+      let vmdays = 31
+      let vparam = 1
+      let vsmnth = 'Jan'
+    elseif vmnth == 2
+      let vmdays = 28
+      let vparam = 32
+      let vsmnth = 'Feb'
+    elseif vmnth == 3
+      let vmdays = 31
+      let vparam = 60
+      let vsmnth = 'Mar'
+    elseif vmnth == 4
+      let vmdays = 30
+      let vparam = 91
+      let vsmnth = 'Apr'
+    elseif vmnth == 5
+      let vmdays = 31
+      let vparam = 121
+      let vsmnth = 'May'
+    elseif vmnth == 6
+      let vmdays = 30
+      let vparam = 152
+      let vsmnth = 'Jun'
+    elseif vmnth == 7
+      let vmdays = 31
+      let vparam = 182
+      let vsmnth = 'Jul'
+    elseif vmnth == 8
+      let vmdays = 31
+      let vparam = 213
+      let vsmnth = 'Aug'
+    elseif vmnth == 9
+      let vmdays = 30
+      let vparam = 244
+      let vsmnth = 'Sep'
+    elseif vmnth == 10
+      let vmdays = 31
+      let vparam = 274
+      let vsmnth = 'Oct'
+    elseif vmnth == 11
+      let vmdays = 30
+      let vparam = 305
+      let vsmnth = 'Nov'
+    elseif vmnth == 12
+      let vmdays = 31
+      let vparam = 335
+      let vsmnth = 'Dec'
+    else
+      echo 'Invalid Year or Month'
+      return
+    endif
+    if vyear % 400 == 0
+      if vmnth == 2
+        let vmdays = 29
+      elseif vmnth >= 3
+        let vparam = vparam + 1
+      endif
+    elseif vyear % 100 == 0
+      if vmnth == 2
+        let vmdays = 28
+      endif
+    elseif vyear % 4 == 0
+      if vmnth == 2
+        let vmdays = 29
+      elseif vmnth >= 3
+        let vparam = vparam + 1
+      endif
+    endif
+
+    " calc vnweek of the day
+    if vnweek == -1
+      let vnweek = ( vyear * 365 ) + vparam
+      let vnweek = vnweek + ( vyear/4 ) - ( vyear/100 ) + ( vyear/400 )
+      if vyear % 4 == 0
+        if vyear % 100 != 0 || vyear % 400 == 0
+          let vnweek = vnweek - 1
+        endif
+      endif
+      let vnweek = vnweek - 1
+    endif
+
+    " fix Gregorian
+    if vyear <= 1752
+      let vnweek = vnweek - 3
+    endif
+
+    let vnweek = vnweek % 7
+
+    if exists('g:calendar_monday')
+      " if given g:calendar_monday, the week start with monday
+      if vnweek == 0
+        let vnweek = 7
+      endif
+      let vnweek = vnweek - 1
+    elseif exists('g:calendar_weeknm')
+      " if given g:calendar_weeknm, show week number(ref:ISO8601)
+      let viweek = vparam / 7
+      let vfweek = vparam % 7
+      if vnweek == 0
+        let vfweek = vfweek - 7
+        let viweek = viweek + 1
+      else
+        let vfweek = vfweek - vnweek
+      endif
+      if vfweek <= 0 && viweek > 0
+        let viweek = viweek - 1
+        let vfweek = vfweek + 7
+      endif
+      if vfweek > -4
+        let viweek = viweek + 1
+      endif
+      if vfweek > 3
+        let viweek = viweek + 1
+      endif
+      if viweek == 0
+        let viweek = '??'
+      elseif viweek > 52
+        if vnweek != 0 && vnweek < 4
+          let viweek = 1
+        endif
+      endif
+      let vcolumn = vcolumn + 5
+    endif
+
+    "--------------------------------------------------------------
+    "--- displaying
+    "--------------------------------------------------------------
+    " build header
+    if exists('g:calendar_erafmt') && g:calendar_erafmt !~ "^\s*$"
+      if g:calendar_erafmt =~ '.*,[+-]*\d\+'
+        let veranum=substitute(g:calendar_erafmt,'.*,\([+-]*\d\+\)','\1','')
+        if vyear+veranum > 0
+          let vdisplay2=substitute(g:calendar_erafmt,'\(.*\),.*','\1','') 
+          let vdisplay2=vdisplay2.(vyear+veranum).'/'.vmnth.'('
+        else
+          let vdisplay2=vyear.'/'.vmnth.'('
+        endif
+      else
+        let vdisplay2=vyear.'/'.vmnth.'('
+      endif
+      let vdisplay2=strpart("                           ",
+        \ 1,(vcolumn-strlen(vdisplay2))/2-2).vdisplay2
+    else
+      let vdisplay2=vyear.'/'.vmnth.'('
+      let vdisplay2=strpart("                           ",
+        \ 1,(vcolumn-strlen(vdisplay2))/2-2).vdisplay2
+    endif
+    if exists('g:calendar_mruler') && g:calendar_mruler !~ "^\s*$"
+      let vdisplay2=vdisplay2.s:GetToken(g:calendar_mruler,',',vmnth).')'."\n"
+    else
+      let vdisplay2=vdisplay2.vsmnth.')'."\n"
+    endif
+    let vwruler = "Su Mo Tu We Th Fr Sa"
+    if exists('g:calendar_wruler') && g:calendar_wruler !~ "^\s*$"
+      let vwruler = g:calendar_wruler
+    endif
+    if exists('g:calendar_monday')
+      let vwruler = strpart(vwruler,stridx(vwruler, ' ') + 1).' '.strpart(vwruler,0,stridx(vwruler, ' '))
+    endif
+    let vdisplay2 = vdisplay2.' '.vwruler."\n"
+    if g:calendar_mark == 'right'
+      let vdisplay2 = vdisplay2.' '
+    endif
+
+    " build calendar
+    let vinpcur = 0
+    while (vinpcur < vnweek)
+      let vdisplay2=vdisplay2.'   '
+      let vinpcur = vinpcur + 1
+    endwhile
+    let vdaycur = 1
+    while (vdaycur <= vmdays)
+      if vmnth < 10
+         let vtarget =vyear."0".vmnth
+      else
+         let vtarget =vyear.vmnth
+      endif
+      if vdaycur < 10
+         let vtarget = vtarget."0".vdaycur
+      else
+         let vtarget = vtarget.vdaycur
+      endif
+      if exists("g:calendar_sign")
+        exe "let vsign = " . g:calendar_sign . "(vdaycur, vmnth, vyear)"
+        if vsign != ""
+          let vsign = vsign[0]
+          if vsign !~ "[+!#$%&@?]"
+            let vsign = "+"
+          endif
+        endif
+      else
+        let vsign = ''
+      endif
+
+      " show mark
+      if g:calendar_mark == 'right'
+        if vdaycur < 10
+          let vdisplay2=vdisplay2.' '
+        endif
+        let vdisplay2=vdisplay2.vdaycur
+      elseif g:calendar_mark == 'left-fit'
+        if vdaycur < 10
+          let vdisplay2=vdisplay2.' '
+        endif
+      endif
+      if vtarget == vtoday
+        let vdisplay2=vdisplay2.'*'
+      elseif vsign != ''
+        let vdisplay2=vdisplay2.vsign
+      else
+        let vdisplay2=vdisplay2.' '
+      endif
+      if g:calendar_mark == 'left'
+        if vdaycur < 10
+          let vdisplay2=vdisplay2.' '
+        endif
+        let vdisplay2=vdisplay2.vdaycur
+      endif
+      if g:calendar_mark == 'left-fit'
+        let vdisplay2=vdisplay2.vdaycur
+      endif
+      let vdaycur = vdaycur + 1
+
+      " fix Gregorian
+      if vyear == 1752 && vmnth == 9 && vdaycur == 3
+        let vdaycur = 14
+      endif
+
+      let vinpcur = vinpcur + 1
+      if vinpcur % 7 == 0
+        if !exists('g:calendar_monday') && exists('g:calendar_weeknm')
+          if g:calendar_mark != 'right'
+            let vdisplay2=vdisplay2.' '
+          endif
+          " if given g:calendar_weeknm, show week number
+          if viweek < 10
+            if g:calendar_weeknm == 1
+              let vdisplay2=vdisplay2.'WK0'.viweek
+            elseif g:calendar_weeknm == 2
+              let vdisplay2=vdisplay2.'WK '.viweek
+            elseif g:calendar_weeknm == 3
+              let vdisplay2=vdisplay2.'KW0'.viweek
+            elseif g:calendar_weeknm == 4
+              let vdisplay2=vdisplay2.'KW '.viweek
+            endif
+          else
+            if g:calendar_weeknm <= 2
+              let vdisplay2=vdisplay2.'WK'.viweek
+            else
+              let vdisplay2=vdisplay2.'KW'.viweek
+            endif
+          endif
+          let viweek = viweek + 1
+        endif
+        let vdisplay2=vdisplay2."\n"
+        if g:calendar_mark == 'right'
+          let vdisplay2 = vdisplay2.' '
+        endif
+      endif
+    endwhile
+
+    " if it is needed, fill with space
+    if vinpcur % 7 
+      while (vinpcur % 7 != 0)
+        let vdisplay2=vdisplay2.'   '
+        let vinpcur = vinpcur + 1
+      endwhile
+      if !exists('g:calendar_monday') && exists('g:calendar_weeknm')
+        if g:calendar_mark != 'right'
+          let vdisplay2=vdisplay2.' '
+        endif
+        if viweek < 10
+          if g:calendar_weeknm == 1
+            let vdisplay2=vdisplay2.'WK0'.viweek
+          elseif g:calendar_weeknm == 2
+            let vdisplay2=vdisplay2.'WK '.viweek
+          elseif g:calendar_weeknm == 3
+            let vdisplay2=vdisplay2.'KW0'.viweek
+          elseif g:calendar_weeknm == 4
+            let vdisplay2=vdisplay2.'KW '.viweek
+          endif
+        else
+          if g:calendar_weeknm <= 2
+            let vdisplay2=vdisplay2.'WK'.viweek
+          else
+            let vdisplay2=vdisplay2.'KW'.viweek
+          endif
+        endif
+      endif
+    endif
+
+    " build display
+    let vstrline = ''
+    if dir
+      " for horizontal
+      "--------------------------------------------------------------
+      " +---+   +---+   +------+
+      " |   |   |   |   |      |
+      " | 1 | + | 2 | = |  1'  |
+      " |   |   |   |   |      |
+      " +---+   +---+   +------+
+      "--------------------------------------------------------------
+      let vtokline = 1
+      while 1
+        let vtoken1 = s:GetToken(vdisplay1,"\n",vtokline)
+        let vtoken2 = s:GetToken(vdisplay2,"\n",vtokline)
+        if vtoken1 == '' && vtoken2 == ''
+          break
+        endif
+        while strlen(vtoken1) < (vcolumn+1)*vmcnt
+          if strlen(vtoken1) % (vcolumn+1) == 0
+            let vtoken1 = vtoken1.'|'
+          else
+            let vtoken1 = vtoken1.' '
+          endif
+        endwhile
+        let vstrline = vstrline.vtoken1.'|'.vtoken2.' '."\n"
+        let vtokline = vtokline + 1
+      endwhile
+      let vdisplay1 = vstrline
+      let vheight = vtokline-1
+    else
+      " for virtical
+      "--------------------------------------------------------------
+      " +---+   +---+   +---+
+      " | 1 | + | 2 | = |   |
+      " +---+   +---+   | 1'|
+      "                 |   |
+      "                 +---+
+      "--------------------------------------------------------------
+      let vtokline = 1
+      while 1
+        let vtoken1 = s:GetToken(vdisplay1,"\n",vtokline)
+        if vtoken1 == ''
+          break
+        endif
+        let vstrline = vstrline.vtoken1."\n"
+        let vtokline = vtokline + 1
+        let vheight = vheight + 1
+      endwhile
+      if vstrline != ''
+        let vstrline = vstrline.' '."\n"
+        let vheight = vheight + 1
+      endif
+      let vtokline = 1
+      while 1
+        let vtoken2 = s:GetToken(vdisplay2,"\n",vtokline)
+        if vtoken2 == ''
+          break
+        endif
+        while strlen(vtoken2) < vcolumn
+          let vtoken2 = vtoken2.' '
+        endwhile
+        let vstrline = vstrline.vtoken2."\n"
+        let vtokline = vtokline + 1
+        let vheight = vtokline + 1
+      endwhile
+      let vdisplay1 = vstrline
+    endif
+    let vmnth = vmnth + 1
+    let vmcnt = vmcnt + 1
+    if vmnth > 12
+      let vmnth = 1
+      let vyear = vyear + 1
+    endif
+  endwhile
+  if exists("g:calendar_end")
+    exe "call " . g:calendar_end . "()"
+  endif
+  if a:0 == 0
+    return vdisplay1
+  endif
+
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  "+++ build window
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  " make window
+  let vwinnum=bufnr('__Calendar')
+  if getbufvar(vwinnum, 'Calendar')=='Calendar'
+    let vwinnum=bufwinnr(vwinnum)
+  else
+    let vwinnum=-1
+  endif
+
+  if vwinnum >= 0
+    " if already exist
+    if vwinnum != bufwinnr('%')
+      exe "normal \<c-w>".vwinnum."w"
+    endif
+    setlocal modifiable
+    silent %d _
+  else
+    " make title
+    if (!exists('s:bufautocommandsset'))
+      auto BufEnter *Calendar let b:sav_titlestring = &titlestring | let &titlestring = '%{strftime("%c")}' | let b:sav_wrapscan = &wrapscan
+      auto BufLeave *Calendar let &titlestring = b:sav_titlestring | let &wrapscan = b:sav_wrapscan
+      let s:bufautocommandsset=1
+    endif
+
+    if exists('g:calendar_navi') && dir
+      if g:calendar_navi == 'both'
+        let vheight = vheight + 4
+      else
+        let vheight = vheight + 2
+      endif
+    endif
+
+    " or not
+    if dir
+      execute 'bo '.vheight.'split __Calendar'
+      setlocal winfixheight
+    else
+      execute 'to '.vcolumn.'vsplit __Calendar'
+    endif
+    setlocal noswapfile
+    setlocal buftype=nowrite
+    setlocal bufhidden=delete
+    setlocal nonumber
+    setlocal nowrap
+    setlocal norightleft
+    setlocal foldcolumn=0
+    setlocal modifiable
+    setlocal nolist
+    set nowrapscan
+    let b:Calendar='Calendar'
+    " is this a vertical (0) or a horizontal (1) split?
+  endif
+  let b:CalendarDir=dir
+  let b:CalendarYear = vyear_org
+  let b:CalendarMonth = vmnth_org
+
+  " navi
+  if exists('g:calendar_navi')
+    let navi_label = '<'
+        \.s:GetToken(g:calendar_navi_label, ',', 1).' '
+        \.s:GetToken(g:calendar_navi_label, ',', 2).' '
+        \.s:GetToken(g:calendar_navi_label, ',', 3).'>'
+    if dir
+      let navcol = vcolumn + (vcolumn-strlen(navi_label)+2)/2
+    else
+      let navcol = (vcolumn-strlen(navi_label)+2)/2
+    endif
+    if navcol < 3
+      let navcol = 3
+    endif
+
+    if g:calendar_navi == 'top'
+      execute "normal gg".navcol."i "
+      silent exec "normal! i".navi_label."\<cr>\<cr>"
+      silent put! =vdisplay1
+    endif
+    if g:calendar_navi == 'bottom'
+      silent put! =vdisplay1
+      silent exec "normal! Gi\<cr>"
+      execute "normal ".navcol."i "
+      silent exec "normal! i".navi_label
+    endif
+    if g:calendar_navi == 'both'
+      execute "normal gg".navcol."i "
+      silent exec "normal! i".navi_label."\<cr>\<cr>"
+      silent put! =vdisplay1
+      silent exec "normal! Gi\<cr>"
+      execute "normal ".navcol."i "
+      silent exec "normal! i".navi_label
+    endif
+  else
+    silent put! =vdisplay1
+  endif
+
+  setlocal nomodifiable
+
+  let vyear = vyear_org
+  let vmnth = vmnth_org
+
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  "+++ build keymap
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  " make keymap
+  if vmnth > 1
+    execute 'nnoremap <silent> <buffer> <s-left> '
+      \.':call Calendar('.dir.','.vyear.','.(vmnth-1).')<cr>'
+  else
+    execute 'nnoremap <silent> <buffer> <s-left> '
+      \.':call Calendar('.dir.','.(vyear-1).',12)<cr>'
+  endif
+  if vmnth < 12
+    execute 'nnoremap <silent> <buffer> <s-right> '
+      \.':call Calendar('.dir.','.vyear.','.(vmnth+1).')<cr>'
+  else
+    execute 'nnoremap <silent> <buffer> <s-right> '
+      \.':call Calendar('.dir.','.(vyear+1).',1)<cr>'
+  endif
+  execute 'nnoremap <silent> <buffer> q :close<cr>'
+
+  execute 'nnoremap <silent> <buffer> <cr> :call <SID>CalendarDoAction()<cr>'
+  execute 'nnoremap <silent> <buffer> <2-LeftMouse> :call <SID>CalendarDoAction()<cr>'
+  execute 'nnoremap <silent> <buffer> t :call Calendar(b:CalendarDir)<cr>'
+  execute 'nnoremap <silent> <buffer> ? :call <SID>CalendarHelp()<cr>'
+  execute 'nnoremap <silent> <buffer> r :call Calendar(' . dir . ',' . vyear . ',' . vmnth . ')<cr>'
+  let pnav = s:GetToken(g:calendar_navi_label, ',', 1)
+  let nnav = s:GetToken(g:calendar_navi_label, ',', 3)
+  execute 'nnoremap <silent> <buffer> <Up>    :call <SID>CalendarDoAction("<' . pnav . '")<cr>'
+  execute 'nnoremap <silent> <buffer> <Left>  :call <SID>CalendarDoAction("<' . pnav . '")<cr>'
+  execute 'nnoremap <silent> <buffer> <Down>  :call <SID>CalendarDoAction("' . nnav . '>")<cr>'
+  execute 'nnoremap <silent> <buffer> <Right> :call <SID>CalendarDoAction("' . nnav . '>")<cr>'
+
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  "+++ build highlight
+  "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  " today
+  syn clear
+  if g:calendar_mark =~ 'left-fit'
+    syn match CalToday display "\s*\*\d*"
+    syn match CalMemo display "\s*[+!#$%&@?]\d*"
+  elseif g:calendar_mark =~ 'right'
+    syn match CalToday display "\d*\*\s*"
+    syn match CalMemo display "\d*[+!#$%&@?]\s*"
+  else
+    syn match CalToday display "\*\s*\d*"
+    syn match CalMemo display "[+!#$%&@?]\s*\d*"
+  endif
+  " header
+  syn match CalHeader display "[^ ]*\d\+\/\d\+([^)]*)"
+
+  " navi
+  if exists('g:calendar_navi')
+    exec "silent! syn match CalNavi display \"\\(<"
+        \.s:GetToken(g:calendar_navi_label, ',', 1)."\\|"
+        \.s:GetToken(g:calendar_navi_label, ',', 3).">\\)\""
+    exec "silent! syn match CalNavi display \"\\s"
+        \.s:GetToken(g:calendar_navi_label, ',', 2)."\\s\"hs=s+1,he=e-1"
+  endif
+
+  " saturday, sunday
+  let dayorspace = '\(\*\|\s\)\(\s\|\d\)\(\s\|\d\)'
+  if !exists('g:calendar_weeknm') || g:calendar_weeknm <= 2
+    let wknmstring = '\(\sWK[0-9\ ]\d\)*'
+  else
+    let wknmstring = '\(\sKW[0-9\ ]\d\)*'
+  endif
+  let eolnstring = '\s\(|\|$\)'
+  if exists('g:calendar_monday')
+    execute "syn match CalSaturday display \'"
+      \.dayorspace.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
+    execute "syn match CalSunday display \'"
+      \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
+  else
+    if dir
+      execute "syn match CalSaturday display \'"
+        \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
+      execute "syn match CalSunday display \'\|"
+        \.dayorspace."\'ms=s+2,me=s+4"
+    else
+      execute "syn match CalSaturday display \'"
+        \.dayorspace.wknmstring.eolnstring."\'ms=s+1,me=s+3"
+      execute "syn match CalSunday display \'^"
+        \.dayorspace."\'ms=s+1,me=s+3"
+    endif
+  endif
+
+  " week number
+  if !exists('g:calendar_weeknm') || g:calendar_weeknm <= 2
+    syn match CalWeeknm display "WK[0-9\ ]\d"
+  else
+    syn match CalWeeknm display "KW[0-9\ ]\d"
+  endif
+
+  " ruler
+  execute 'syn match CalRuler "'.vwruler.'"'
+
+  if search("\*","w") > 0
+    silent execute "normal! gg/\*\<cr>"
+  endif
+
+  return ''
+endfunction
+"*****************************************************************
+"* CalendarMakeDir : make directory
+"*----------------------------------------------------------------
+"*   dir : directory
+"*****************************************************************
+function! s:CalendarMakeDir(dir)
+  if(has("unix"))
+    call system("mkdir " . a:dir)
+    let rc = v:shell_error
+  elseif(has("win16") || has("win32") || has("win95") ||
+              \has("dos16") || has("dos32") || has("os2"))
+    call system("mkdir \"" . a:dir . "\"")
+    let rc = v:shell_error
+  else
+    let rc = 1
+  endif
+  if rc != 0
+    call confirm("can't create directory : " . a:dir, "&OK")
+  endif
+  return rc
+endfunc
+
+"*****************************************************************
+"* CalendarDiary : calendar hook function
+"*----------------------------------------------------------------
+"*   day   : day you actioned
+"*   month : month you actioned
+"*   year  : year you actioned
+"*****************************************************************
+function! s:CalendarDiary(day, month, year, week, dir)
+  " build the file name and create directories as needed
+  if !isdirectory(expand(g:calendar_diary))
+    call confirm("please create diary directory : ".g:calendar_diary, 'OK')
+    return
+  endif
+  let sfile = expand(g:calendar_diary) . "/" . a:year
+  if isdirectory(sfile) == 0
+    if s:CalendarMakeDir(sfile) != 0
+      return
+    endif
+  endif
+  let sfile = sfile . "/" . a:month
+  if isdirectory(sfile) == 0
+    if s:CalendarMakeDir(sfile) != 0
+      return
+    endif
+  endif
+  let sfile = expand(sfile) . "/" . a:day . ".cal"
+  let sfile = substitute(sfile, ' ', '\\ ', 'g')
+  let vbufnr = bufnr('__Calendar')
+
+  " load the file
+  exe "sp " . sfile
+  setlocal ft=calendar
+  let dir = getbufvar(vbufnr, "CalendarDir")
+  let vyear = getbufvar(vbufnr, "CalendarYear")
+  let vmnth = getbufvar(vbufnr, "CalendarMonth")
+  exe "auto BufDelete ".escape(sfile, ' \\')." call Calendar(" . dir . "," . vyear . "," . vmnth . ")"
+endfunc
+
+"*****************************************************************
+"* CalendarSign : calendar sign function
+"*----------------------------------------------------------------
+"*   day   : day of sign
+"*   month : month of sign
+"*   year  : year of sign
+"*****************************************************************
+function! s:CalendarSign(day, month, year)
+  let sfile = g:calendar_diary."/".a:year."/".a:month."/".a:day.".cal"
+  return filereadable(expand(sfile))
+endfunction
+
+"*****************************************************************
+"* CalendarVar : get variable
+"*----------------------------------------------------------------
+"*****************************************************************
+function! s:CalendarVar(var)
+  if !exists(a:var)
+    return ''
+  endif
+  exec 'return ' . a:var
+endfunction
+
+"*****************************************************************
+"* CalendarHelp : show help for Calendar
+"*----------------------------------------------------------------
+"*****************************************************************
+function! s:CalendarHelp()
+  echohl None
+  echo 'Calendar version ' . g:calendar_version
+  echohl SpecialKey
+  echo '<s-left>  : goto prev month'
+  echo '<s-right> : goto next month'
+  echo 't         : goto today'
+  echo 'q         : close window'
+  echo 'r         : re-display window'
+  echo '?         : show this help'
+  if g:calendar_action == "<SID>CalendarDiary"
+    echo '<cr>      : show diary'
+  endif
+  echo ''
+  echohl Question
+  echo 'calendar_erafmt=' . s:CalendarVar('g:calendar_erafmt')
+  echo 'calendar_mruler=' . s:CalendarVar('g:calendar_mruler')
+  echo 'calendar_wruler=' . s:CalendarVar('g:calendar_wruler')
+  echo 'calendar_weeknm=' . s:CalendarVar('g:calendar_weeknm')
+  echo 'calendar_navi_label=' . s:CalendarVar('g:calendar_navi_label')
+  echo 'calendar_diary=' . s:CalendarVar('g:calendar_diary')
+  echo 'calendar_mark=' . s:CalendarVar('g:calendar_mark')
+  echo 'calendar_navi=' . s:CalendarVar('g:calendar_navi')
+  echohl MoreMsg
+  echo "[Hit any key]"
+  echohl None
+  call getchar()
+  redraw!
+endfunction
+
+hi def link CalNavi     Search
+hi def link CalSaturday Statement
+hi def link CalSunday   Type
+hi def link CalRuler    StatusLine
+hi def link CalWeeknm   Comment
+hi def link CalToday    Directory
+hi def link CalHeader   Special
+hi def link CalMemo     Identifier
diff --git a/etc/vim/plugin/vimplate.vim b/etc/vim/plugin/vimplate.vim
new file mode 100644 (file)
index 0000000..defae92
--- /dev/null
@@ -0,0 +1,41 @@
+"""""""""""""""""""""""""""""""""""""""""""""
+" vimplate - Template-Toolkit support for Vim
+"""""""""""""""""""""""""""""""""""""""""""""
+" please see:
+"     :help vimplate
+"   or
+"     http://www.vim.org/scripts/script.php?script_id=1311
+" Version:
+"   vimplate 0.2.3
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+" allow user to avoid loading this plugin and prevent loading twice
+if exists ("loaded_vimplate")
+    finish
+endif
+let loaded_vimplate = 1
+
+if !exists("Vimplate")
+  " Debian specific path unless overridden by the user
+  let Vimplate = "/usr/bin/vimplate"
+endif
+let s:vimplate = Vimplate
+
+function s:RunVimplate(template)
+  let l:tmpfile = tempname()
+  let l:cmd =  s:vimplate. " -out=" . l:tmpfile . " -template=" . a:template
+  let l:line = line(".")
+  execute "!" . l:cmd
+  silent execute "read " . l:tmpfile
+  execute delete(l:tmpfile)
+  execute "normal " . l:line . "G"
+  if getline(".") =~ "^$"
+    execute "normal dd"
+  endif
+endfunction
+
+function ListTemplates(...)
+  return system(s:vimplate . " -listtemplates")
+endfun
+
+command! -complete=custom,ListTemplates -nargs=1 Vimplate call s:RunVimplate(<f-args>)
diff --git a/etc/vim/source/._ShowFunc.vim b/etc/vim/source/._ShowFunc.vim
new file mode 100644 (file)
index 0000000..16ce0ba
Binary files /dev/null and b/etc/vim/source/._ShowFunc.vim differ
diff --git a/etc/vim/source/ShowFunc.vim.disable b/etc/vim/source/ShowFunc.vim.disable
new file mode 100644 (file)
index 0000000..a540892
--- /dev/null
@@ -0,0 +1,566 @@
+" ------------------------------------------------------------------------------
+" Filename:      ShowFunc.vim                                                {{{
+" VimScript:     #397
+"
+" Maintainer:    Dave Vehrs <dvehrs (at) gmail.com>
+" Last Modified: 28 Mar 2006 03:58:12 PM by Dave V
+"
+" Copyright:     (C) 2002,2003,2004,2005,2006 Dave Vehrs
+"
+"                This program is free software; you can redistribute it and/or
+"                modify it under the terms of the GNU General Public License as
+"                published by the Free Software Foundation; either version 2 of
+"                the License, or (at your option) any later version.
+"
+"                This program is distributed in the hope that it will be useful,
+"                but WITHOUT ANY WARRANTY; without even the implied warranty of
+"                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+"                GNU General Public License for more details.
+"
+"                You should have received a copy of the GNU General Public
+"                License along with this program; if not, write to the Free
+"                Software Foundation, Inc., 59 Temple Place, Suite 330, 
+"                Boston, MA 02111-1307 USA _OR_ download at copy at 
+"                http://www.gnu.org/licenses/licenses.html#TOCGPL
+"
+" Description:   This script creates a hyper link list of all the functions,
+"                subroutines, classes, macros or procedures in a  single file or
+"                all currently open windows and displays them in a dynamically
+"                sized cwindow.
+" History:       This script inspired by an idea posted by Flemming Madsen, in
+"                vimtip#79.
+"
+" WARNING:       It may write the file as a side effect.
+" Requires:      Vim 6.0 or newer.
+"                Exuberant ctags (http://ctags.sourceforge.net/).
+" Install:       Put this file in the vim plugins directory (~/.vim/plugin)
+"                to load it automatically, or load it manually with
+"                :so ShowFunc.vim.
+"                
+"                                          Additional notes at end of file...}}}
+" ------------------------------------------------------------------------------
+" Configuration:                                                             {{{
+
+" Test for and if necessary configure all default settings.  If you would like
+" to change any setting, just add let g:variablename = "new-value" to your
+" .vimrc.
+" For Example, to change the location of the ctags binary, add this:
+"     let g:showfuncctagsbin = "/bin/ctags"
+"       OR
+"     let g:showfuncctagsbin = "c:\\gnu\\ctags\\ctags.exe"
+" Default ScanType Options:   buffers  |  Scan all open buffers.
+"                             current  |  Scan only the current buffer.
+"                             windows  |  Scan all open windows.
+if !exists("g:ShowFuncScanType")
+  let g:ShowFuncScanType = "buffers"
+endif
+
+" Default SortType Options:   yes      |  Display output sorted alphabetically.
+"                             no       |  Display output in file order.
+"                             foldcase |  Display output sorted alphabetically,
+"                                      |  disregarding case.
+if !exists("g:ShowFuncSortType")
+  let g:ShowFuncSortType = "foldcase"
+endif
+
+" You can limited the filetypes that are supported by listing them seperated 
+" by "^@".  
+" let g:CtagsSupportedFileTypes = "c^@python^@perl^@"
+
+" ----- 
+" Sometimes you'll get more results than you want and you can filter the
+" output.
+
+" To find out what languages ctags supports:
+"                ctags --list-languages
+" To find out what tags are supported for each language, execute:
+"                ctags --list-kinds=<lang>
+" For example:
+"                ctags --list-kinds=vim
+"                a  autocommand groups
+"                f  function definitions
+"                v  variable definitions
+
+" Now, we can set ctags to just search for functions like so:
+"                let g:ShowFunc_vim_Kinds = "f"
+" To search for functions and autocommand groups:
+"                let g:ShowFunc_vim_Kinds = "af"
+"                let g:ShowFunc_vim_Kinds = "-a+f-v"
+" To search for everything but variables:
+"                let g:ShowFunc_vim_Kinds = "-v"
+let g:ShowFunc_vim_Kinds = "-v"
+let g:ShowFunc_php_Kinds = "-v"
+
+" To set filters for other languages, simply set a global variable for them 
+" by replacing the _vim_ with the vim filetype (same as ctags for all
+" languages but c++, then use cpp).
+"                let g:ShowFunc_cpp_Kinds = "-v"
+
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Exit if already loaded.                                                    {{{
+
+if ( exists("loaded_showfunc") || &cp ) | finish | endif 
+let g:loaded_showfunc=1 
+                        
+" Enable filetype detection 
+filetype on
+
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" AutoCommands:                                                              {{{
+
+augroup showfunc_autocmd
+  autocmd!
+  autocmd BufEnter * call <SID>LastWindow()
+augroup end
+
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Functions:                                                                 {{{
+
+" Rotate through available scan types.
+function! <SID>ChangeScanType()
+       if g:ShowFuncScanType == "buffers"     | let g:ShowFuncScanType = "windows"
+       elseif g:ShowFuncScanType == "windows" | let g:ShowFuncScanType = "current"
+       elseif g:ShowFuncScanType == "current" | let g:ShowFuncScanType = "buffers"
+  endif
+       call <SID>ShowFuncOpen()
+endfunction
+
+" Rotate through available sort types.
+function! <SID>ChangeSortType()
+       if g:ShowFuncSortType == "no"            | let g:ShowFuncSortType = "yes"
+       elseif g:ShowFuncSortType == "yes"       | let g:ShowFuncSortType = "foldcase"
+       elseif g:ShowFuncSortType == "foldcase"  | let g:ShowFuncSortType = "no"
+  endif
+       call <SID>ShowFuncOpen()
+endfunction
+
+" Ctags binary tests
+function! s:CtagsTest(path)
+  " if the location of the ctags executable is not already configured, then 
+  " attempt to find it....
+  if a:path == "unk"
+    let l:test_paths = "/usr/local/bin/ctags /usr/bin/ctags" .
+      \ " C:\\gnu\\ctags\\ctags.exe "
+    let l:rpath = "fail"  
+    while l:test_paths != ''
+      let l:pathcut = strpart(l:test_paths,0,stridx(l:test_paths,' '))
+      if executable(l:pathcut)
+        let l:rpath = s:CtagsVersionTest(l:pathcut)
+        if l:rpath != "fail"
+          break
+        endif
+      endif
+      let l:test_paths = strpart(l:test_paths,stridx(l:test_paths,' ') + 1)
+    endwhile
+    if l:rpath == "fail"
+      if !has("gui_running") || has("win32")
+        echo "ShowFunc Error: Ctags binary not found.\n".
+          \  "Please set g:showfuncctagsbin in your .vimrc.\n" 
+      endif
+    endif
+  else
+    " Else test the variable to see that it is actually an executable.
+    if executable(a:path)
+      let l:rpath = s:CtagsVersionTest(a:path)
+    else
+      if ( !has("gui_running") || has("win32") )
+        echo "ShowFunc Error: Ctags binary not found.\n".
+          \  "Your g:showfuncctagsbin may be set incorrectly.\n"
+      endif
+      let g:loaded_showfunc = 0
+      let l:rpath = "fail"
+    endif  
+  endif
+  return l:rpath
+endfunction 
+
+" Test to be sure we have Exuberant Ctags.
+function! s:CtagsVersionTest(path) 
+  " Test Ctags for correct ctags project.. 
+  let l:test_str = strtrans(system(a:path . " -x  --version"))
+  let ctagsvertest = strpart(l:test_str,0,15)
+  if ctagsvertest != "Exuberant Ctags"
+    if ( !has("gui_running") || has("win32") )
+      echo "ShowFunc Error: Incorrect Version of Ctags.\n".
+        \  "Download the correct version from http://ctags.sourceforge.net"
+    endif
+    let g:loaded_showfunc = 0
+    let l:rpath = "fail"
+  else
+    let l:rpath = a:path
+    " Set Ctags version variables.
+    let g:CtagsMajorVersion = strpart(l:test_str,(stridx(l:test_str,"s ")+2),
+      \ (stridx(l:test_str,".")-(stridx(l:test_str,"s ")+2))  )
+    let l:test_str2 = strpart(l:test_str,(stridx(l:test_str,".")+1))
+    if ((stridx(l:test_str2,".") < stridx(l:test_str2,",")) && (stridx(l:test_str2,".") >= 0))
+      let g:CtagsSubVersion = strpart(l:test_str2,
+        \ (stridx(l:test_str2,".")+1),(stridx(l:test_str2,",")-(stridx(l:test_str2,".")+1)))
+
+      let g:CtagsMinorVersion = strpart(l:test_str2,0,
+        \ (stridx(l:test_str2,".")))
+    else
+      let g:CtagsMinorVersion = strpart(l:test_str2,0,
+        \ (stridx(l:test_str2,",")))
+      let g:CtagsSubVersion = "0"
+    endif
+    " Test for correct versions.
+    if g:CtagsMajorVersion < 5
+      echo "Exuberant Ctags needs to be upgraded for ShowFunc to work."
+      echo "Please visit http://ctags.sourceforge,net."
+      let l:rpath = "fail"
+    elseif g:CtagsMinorVersion <= 4
+      echo "Exuberant Ctags should be upgraded, some features of the"
+      echo "ShowFunc script may not work."
+      echo "Please visit http://ctags.sourceforge,net."
+    endif
+    " Define default supported file types list for Ctags versions 5.5 and newer.
+    if (!exists("g:CtagsSupportedFileTypes") && g:CtagsMajorVersion == 5 && 
+      \ g:CtagsMinorVersion >= 5)
+      let g:CtagsSupportedFileTypes = strtrans(system(l:rpath . 
+        \ " -x --list-languages"))
+    endif
+  endif
+  return l:rpath
+endfunction
+
+ " Display a simple help window.
+function! <SID>DisplayHelp() 
+  echo "ShowFunc Help:          \n".
+    \  " c  Close                   \n".
+    \  " r  Refresh                 \n".
+    \  " s  Change Scan Sort  \n".
+    \  " t  Change Scan Type \n"
+endfunction
+
+" Watch for last window and if its a CWindow, then close (vimtip#536).
+function! <SID>LastWindow()
+   if ( &buftype == "quickfix" )
+    if winbufnr(2) == -1
+      quit!
+    endif
+  endif
+endfunction
+" Determine the best window height for the new cwindow and open it.
+function! s:OpenCWin()
+  let l:mod_total = 0
+  let l:win_count = 1
+  " Determine correct window height
+       windo let l:win_count =  l:win_count + 1
+  if l:win_count <= 2 | let l:win_count = 4 | endif
+  windo let l:mod_total = l:mod_total + winheight(0)/l:win_count |
+  \ execute 'resize +'.l:mod_total
+  " Open cwindow
+  execute 'belowright copen '.l:mod_total
+       let l:cwin_filelen = line("$")
+  " Test for short output lists.
+  if l:cwin_filelen < winheight(0)
+    cclose
+    " And adjust cwindow height accordingly.
+    execute 'belowright copen '.l:cwin_filelen
+  endif
+  if v:version >= 700
+    setlocal statusline=ShowFunc.vim\ Tag\ List
+  endif
+  " Set cwindow specific key mappings.
+  nnoremap <buffer> <silent> c :cclose<CR>
+  nnoremap <buffer> <silent> h :call <SID>DisplayHelp()<CR>
+  nnoremap <buffer> <silent> r :call <SID>ShowFuncOpen()<CR>
+  nnoremap <buffer> <silent> s :call <SID>ChangeSortType()<CR>
+  nnoremap <buffer> <silent> t :call <SID>ChangeScanType()<CR>
+  set nobuflisted
+  return
+endfunction
+
+" Set Folds by filename.
+function! s:ShowFuncFolds()
+  let l:test_line = getline(v:lnum)
+  let l:test_filename = strpart(l:test_line,0,stridx(l:test_line,'|'))
+  if  g:FoldFileName == '' 
+    let g:FoldFileName = l:test_filename
+    return ">1"
+       elseif g:FoldFileName == l:test_filename
+    return "="
+       else
+    let g:FoldFileName = l:test_filename
+    return ">1"
+  endif
+endfunction
+
+" Set FoldText to filename and tag count.
+function! ShowFuncFoldText()
+  let l:line = ""
+  let l:textwidth = &textwidth - 20
+  let l:line = getline(v:foldstart)
+  let l:line = strpart(l:line,0,stridx(l:line,'|'))
+  if strlen(l:line) < l:textwidth
+    let l:count =  59 - strlen(l:subline)
+    while  strlen(l:line) < l:textwidth 
+      let l:line = l:line." "
+    endwhile
+  endif
+  let l:tag_count = v:foldend - v:foldstart + 1
+  if l:tag_count <= 9 
+    return v:folddashes."+ File: ".l:line." Tags:    ". l:tag_count." "
+  elseif l:tag_count <= 99 
+    return v:folddashes."+ File: ".l:line." Tags:   ". l:tag_count." "
+  elseif l:tag_count <= 999 
+    return v:folddashes."+ File: ".l:line." Tags:  ". l:tag_count." "
+  else
+    return v:folddashes."+ File: ".l:line." Tags: ". l:tag_count." "
+  endif
+endfunction  
+
+" Set ctags options to call.
+function! s:SetGrepPrg(sort)
+  if  g:CtagsMinorVersion < 5 
+    if ( &filetype == "asm"     || &filetype == "asp"     || &filetype == "awk"   ||
+      \ &filetype == "beta"    || &filetype == "c"       || &filetype == "cobol" ||
+      \ &filetype == "eiffel"  || &filetype == "fortran" || &filetype == "java"  ||
+      \ &filetype == "lisp"    || &filetype == "lua"     || &filetype == "make"  ||
+      \ &filetype == "pascal"  || &filetype == "perl"    || &filetype == "php"   ||
+      \ &filetype == "python"  || &filetype == "rexx"    || &filetype == "ruby"  ||
+      \ &filetype == "scheme"  || &filetype == "sh"      || &filetype == "slang" ||
+      \ &filetype == "sql"     || &filetype == "tcl"     || &filetype == "vera"  ||
+      \ &filetype == "verilog" || &filetype == "vim"     || &filetype == "yacc"  )
+      let l:grep_return = g:showfuncctagsbin .' -x --language-force=' . &filetype . 
+        \ ' --sort=' . a:sort
+    elseif &filetype == "cpp" 
+      let l:grep_return = g:showfuncctagsbin .' -x --language-force=c++ --sort=' . 
+        \ a:sort
+    else
+       return "fail" 
+    endif
+  else
+    if &filetype == "cpp" | let l:cfiletype = "c++"
+    else | let l:cfiletype = &filetype | endif
+    let l:filetest = s:TestFileType(l:cfiletype)
+    if l:filetest != "false"
+      if exists("g:ShowFunc_{&filetype}_Kinds")
+        let l:grep_return = g:showfuncctagsbin . ' -x --language-force=' . 
+          \ l:cfiletype . ' --' . l:cfiletype . '-kinds=' .
+          \ g:ShowFunc_{&filetype}_Kinds . ' --sort=' . a:sort 
+      else
+        let l:grep_return = g:showfuncctagsbin . ' -x --language-force=' . 
+          \ l:cfiletype . ' --sort=' . a:sort
+      endif
+    else | let l:grep_return = "fail" | endif
+  endif
+  return l:grep_return
+endfunction 
+
+function! <SID>ShowFuncOpen()
+       set lazyredraw
+  " Close any existing cwindows.
+       cclose
+  if &lines >= 8
+               let l:count = 0
+    let l:gf_s = &grepformat
+    let l:gp_s = &grepprg
+    set grepformat&vim
+    set grepprg&vim
+    let &grepformat = '%*\k%*\s%t%*\k%*\s%l%*\s%f\ %m' 
+               if ( g:ShowFuncScanType == "buffers" )
+      " Scan all open buffers.
+           let l:currbuf = bufnr("%")
+           bufdo! let &grepprg = s:SetGrepPrg(g:ShowFuncSortType) | 
+      \ if &grepprg != "fail" | if &readonly == 0 | update | endif |
+                       \ if l:count == 0 | silent! grep! % | let l:count =  l:count + 1 |
+                       \ else | silent! grepadd! % | endif | endif
+                 execute 'buffer '.l:currbuf
+               elseif g:ShowFuncScanType == "windows"
+                 " Scan all open windows.
+           windo let &grepprg = s:SetGrepPrg(g:ShowFuncSortType) | 
+      \ if &grepprg != "fail" | if &readonly == 0 | update | endif |
+                       \ if l:count == 0 | silent! grep! %| let l:count =  l:count + 1 |
+                       \ else | silent! grepadd! % | endif | endif
+               elseif g:ShowFuncScanType == "current"
+                 " Scan current buffer only.
+      let &grepprg = s:SetGrepPrg(g:ShowFuncSortType)
+                 if &grepprg != "fail"
+        if &readonly == 0 | update | endif
+        silent! grep! %
+                 else
+        echohl WarningMsg
+        echo "ShowFunc Error: Unknown FileType"
+        echohl none
+      endif
+               endif
+         let &grepformat = l:gf_s
+    let &grepprg = l:gp_s
+               execute s:OpenCWin()
+               if ( g:ShowFuncScanType == "buffers" || g:ShowFuncScanType ==  "windows" )
+      " Do folding.
+      let g:FoldFileName = ''
+      setlocal foldexpr=s:ShowFuncFolds()
+      setlocal foldmethod=expr
+      setlocal foldtext=ShowFuncFoldText()
+    endif
+       else
+    echohl WarningMsg
+    echo "ShowFunc Error: Window too small.\n"
+    echohl none
+  endif
+       set nolazyredraw
+       redraw!
+endfunction   
+
+" Test for supported filetype.
+function! s:TestFileType(type) 
+  let l:supportedfiles = g:CtagsSupportedFileTypes
+  while l:supportedfiles != "^@" && l:supportedfiles != "" 
+    let l:sfcut = strpart(l:supportedfiles,0,stridx(l:supportedfiles,"^@"))
+    if l:sfcut ==? a:type 
+      return "true"
+    endif
+    let l:supportedfiles = strpart(l:supportedfiles,
+      \ stridx(l:supportedfiles,'^@')+2)
+  endwhile
+  return "false"
+endfunction
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Test Environment:                                                          {{{
+" Test Ctags Binary to be sure its the correct version.
+if exists("g:showfuncctagsbin")
+  let g:showfuncctagsbin = s:CtagsTest(g:showfuncctagsbin)
+endif
+if (!exists("g:showfuncctagsbin") || g:showfuncctagsbin == "fail")
+  let g:showfuncctagsbin = s:CtagsTest("unk")
+endif
+
+" If a suitable ctags binary cannot be found, remove autocommands,  clear 
+" functions and exit script.
+if g:showfuncctagsbin == "fail" 
+  echo "ShowFunc exting.  (Cleaning up functions)"
+  let g:loaded_showfunc = 0
+  augroup! showfunc_autocmd
+  delfunction <SID>ChangeScanType
+  delfunction <SID>ChangeSortType
+  delfunction s:CtagsTest
+  delfunction s:CtagsVersionTest
+  delfunction <SID>DisplayHelp
+  delfunction <SID>LastWindow
+  delfunction s:OpenCWin
+  delfunction s:ShowFuncFolds
+  delfunction s:ShowFuncFoldText
+  delfunction s:SetGrepPrg
+  delfunction <SID>ShowFuncOpen
+  delfunction s:TestFileType
+  finish
+endif 
+
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Key Mappings:                                                              {{{
+" To change the main key mapping, add this to your .vimrc file:
+"   map <key> <PLug>ShowFunc
+
+if ( !hasmapto('<PLUG>ShowFunc') && (maparg('<F1>') == '') )
+       map  <F1> <Plug>ShowFunc
+  map! <F1> <Plug>ShowFunc
+elseif !hasmapto('<PLUG>ShowFunc')
+  if ( !has("gui_running") || has("win32") )
+    echo "ShowFunc Error: No Key mapped.\n".
+      \  "<F1> is taken and a replacement was not assigned."
+  endif
+  let g:loaded_showfunc = 0
+  finish
+endif
+noremap  <silent> <Plug>ShowFunc   :call <SID>ShowFuncOpen()<CR>
+noremap! <silent> <Plug>ShowFunc   <ESC>:call <SID>ShowFuncOpen()<CR>
+
+" Note: Cwindow specific key mappings can be found in the OpenCWin function. }}}
+" ------------------------------------------------------------------------------
+" Known Issues:                                                              {{{
+" 1.  Error messages that occur as gvim is loading (on Linux) do not display in 
+"     GUI windows.  When called from a menu or icon, it appears that gvim is hung
+"     (it appears in the ps listings but no window appears).  To avoid this I 
+"     have disabled the display of errors during gvim loading and the ShowFunc 
+"     script simply exits.  
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Feature Wishlist:                                                          {{{
+" 1.  If scan is set to "current", make cwindow update on buffer change (except
+"     to the cwindow)
+" 2.  Window size ratios should remain the same as ShowFunc opens and closes.
+" 3.  Patch vim to allow for setlocal statusline.
+" 4.  Expand error format format so that the tag type is grabbed by grep.
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Notes:                                                                     {{{
+" 1. Best veiwed with AutoFold.vim (vimscript#925) and ShowFunc.vim
+"    (vimscript#397).
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" Version History:                                                           {{{
+" 1.0      08-24-2002  Initial Release.
+" 1.1      08-26-2002  Patches to Fortran (thanks to Ajit Thakkar), Pascal,
+"                      and Python support.
+" 1.1.1    08-26-2002  Fixed copy&paste errors.  ooops.
+" 1.1.2    08-27-2002  Removed the Python patch.
+" 1.1.3    08-31-2002  Fixed Fortran and Pascal patches, Thanks to Ajit Thakkar,
+"                      and Engelbert Gruber.
+" 1.2      09-22-2002  Fixed redraw bug so that it works with the Winmanager
+"                      (vimscript#95) and Bufexplorer (vimscript#42) scripts.
+" 1.2.1    10-17-2002  Added unknown filetype handling. Added status messages
+"                      ('ShowFunc:').  Fixed key-mappings.
+" 1.3Beta  11-16-2002  Beta: Multiple file handling.  Restructured script.
+" 1.3Beta2 11-20-2002  Beta: Fixed Multiple file cwindow refresh issue (grep
+"                      vs. grepadd).
+" 1.3Beta3 11-29-2002  Beta: Split SetFileType into two ( SetGrepFormat, and
+"                      SetGrepPrg ). Set &...&vim to  insure proper '\ multiline
+"                      translation. Added keymapping testing to  protect against
+"                      conflicting with existing user configurations and to make
+"                      it easy to remap when necessary. Thanks to Luc Hermitte
+" 1.3      12-01-2002  Fixed buffer display issue (Thanks to vimtip#133). Fixed
+"                      window height test for TestWinH and OpenCWin.  Changed
+"                      MultiWin (scans all open windows) to MultiBuf (scans all
+"                      open buffers). Basic multiple file handling is complete.
+" 1.4      12-21-2002  Changed user interface. Eliminated multiple key-mappings.
+"                      Pressing F1 runs the default scan, and opens the cwindow.
+"                      Scan sort and type can be changed by pressing the s and t
+"                      keys respectively.  Unifed scan types into one function
+"                      (ShowFuncOpen) and bought back the all open windows scan.
+" 1.4.1    01-19-2003  Fixed multi-window scan display issue. Improved dynamic
+"                      cwindow sizing.  Added basic help dialog.
+" 1.4.2    03-13-2003  Rewrote the SetGrepFormat and SetGrepPrg functions. Added
+"                      support for all tags for all languages that Exburent
+"                      Ctags (ver. 5.4) supports.
+" 1.4.3    03-15-2003  Automatically fold output on filename for multiple file
+"                      scans (all buffers or windows).
+" 1.4.4    03-17-2003  Improved error handling.  Improved SetFoldText().
+" 1.4.5    03-22-2003  More error handling improvements, including tests for the 
+"                      correct version of ctags, and keymap assignment.  I want
+"                      to thank Mark Thomas for his assistance in finding and 
+"                      fixing a bug in the ctags executable detection on Windows.  
+" 1.5     09-21-2003   Created a more generic grep format so that explicit type 
+"                      definitions are no longer necessary (eliminating the 
+"                      SetGrepFormat function).  Modified the SetGrepPrg function 
+"                      to detect Ctags versions earlier than 5.5.  Supportted 
+"                      filetypes for Ctags versions 5.4 are statically 
+"                      assigned.  
+"                      With Ctags versions 5.5 (and later) supported filetypes 
+"                      are detected dynamically (including those defined by 
+"                      regular expressions (--regex-<LANG>).  
+" 1.5.1   09-25-2003   Bug Fixes.
+" 1.5.2   10-06-2003   Improved Exuberant Ctags version checking.  
+" 1.5.3   10-15-2004   Fixed ShowFuncFoldText.
+" 1.5.4   01-13-2005   Script cleanup.  Added MyLastWindow function (when
+"                      closing windows, tests last window to see if its a
+"                      Cwindow, if it is then close vim session). 
+" 1.5.5   07-20-2005   Patches from two Windows users (David Rennalls and Bill 
+"                      McCarthy).  Fixes in cleanup, documentaion, and autocmds.
+" 1.5.6   02-28-2006   First Vim 7 patches.  Added setlocal statusline support 
+"                      to update the cwindow name.
+" 1.5.7   03-27-2006   Per request by Diederik Van der Boor, added ability to
+"                      filter the variables kinds that ctags outputs (ver 5.5
+"                      or newer).
+"
+"                                                                            }}}
+" ------------------------------------------------------------------------------
+" vim:tw=80:ts=2:sw=2:
diff --git a/etc/vim/source/abbreviate.vim b/etc/vim/source/abbreviate.vim
new file mode 100644 (file)
index 0000000..0dad8b6
--- /dev/null
@@ -0,0 +1,23 @@
+" iabbrev <silent> <buffer> #for Hello
+
+" NB 23.10.12 ab _reload echo VimrcReload()
+" NB 23.10.12 ab _init echo FileInit()
+" NB 23.10.12 ab _stats echo Stats()
+
+" iab ^V059 jai
+iab tjrs toujours
+iab etre être
+iab meme même
+iab ete été
+
+" iab !D <C-R>=StrTrim(system('date'))<CR>
+iab !D <C-R>=strftime('%d.%m.%Y')<CR>
+iab !N <C-R>=NB ' . strftime('%d.%m.%y')<CR>
+
+iab !C /*<CR><CR>*/<Up>
+
+iab <D <div></div><ESC>b<ESC>b<Right>i
+iab <d <div class="
+
+iab <S <span></span><ESC>b<ESC>b<Right>i
+iab <s <span class="
diff --git a/etc/vim/source/debian.vim b/etc/vim/source/debian.vim
new file mode 100644 (file)
index 0000000..1d64115
--- /dev/null
@@ -0,0 +1,82 @@
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" Take from the Debian package and the exemple on $VIM/vim_exemples
+" AUGROUP
+"
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+if has("autocmd")
+
+       """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+       " Set some sensible defaults for editing C-files
+       "
+       augroup cprog
+         " Remove all cprog autocommands
+         au!
+
+         " When starting to edit a file:
+         "   For *.c and *.h files set formatting of comments and set C-indenting on.
+         "   For other files switch it off.
+         "   Don't change the order, it's important that the line with * comes first.
+         autocmd BufRead *       set formatoptions=tcql nocindent comments&
+         autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
+       augroup END
+
+       """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+       "" Gzip and Bzip2 files support
+       " Also, support editing of gzip-compressed files. DO NOT REMOVE THIS!
+       " This is also used when loading the compressed helpfiles.
+       "
+       augroup gzip
+         " Remove all gzip autocommands
+         au!
+
+         " Enable editing of gzipped files
+         "       read: set binary mode before reading the file
+         "             uncompress text in buffer after reading
+         "      write: compress file after writing
+         "     append: uncompress file, append, compress file
+         autocmd BufReadPre,FileReadPre        *.gz set bin
+         autocmd BufReadPre,FileReadPre        *.gz let ch_save = &ch|set ch=2
+         autocmd BufReadPost,FileReadPost      *.gz '[,']!gunzip
+         autocmd BufReadPost,FileReadPost      *.gz set nobin
+         autocmd BufReadPost,FileReadPost      *.gz let &ch = ch_save|unlet ch_save
+" NB 19.07.14    autocmd BufReadPost,FileReadPost      *.gz execute ":doautocmd BufReadPost " . %:r
+
+         autocmd BufWritePost,FileWritePost    *.gz !mv <afile> <afile>:r
+         autocmd BufWritePost,FileWritePost    *.gz !gzip -9 <afile>:r
+
+         autocmd FileAppendPre                 *.gz !gunzip <afile>
+         autocmd FileAppendPre                 *.gz !mv <afile>:r <afile>
+         autocmd FileAppendPost                *.gz !mv <afile> <afile>:r
+         autocmd FileAppendPost                *.gz !gzip <afile>:r
+       augroup END
+
+       """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+       " BZIP2
+       "
+       augroup bzip2
+         " Remove all bzip2 autocommands
+         au!
+
+         " Enable editing of bzipped files
+         "       read: set binary mode before reading the file
+         "             uncompress text in buffer after reading
+         "      write: compress file after writing
+         "     append: uncompress file, append, compress file
+         autocmd BufReadPre,FileReadPre        *.bz2 set bin
+         autocmd BufReadPre,FileReadPre        *.bz2 let ch_save = &ch|set ch=2
+         autocmd BufReadPost,FileReadPost      *.bz2 set cmdheight=2|'[,']!bunzip2
+         autocmd BufReadPost,FileReadPost      *.bz2 set cmdheight=1 nobin|execute ":doautocmd BufReadPost " . %:r
+         autocmd BufReadPost,FileReadPost      *.bz2 let &ch = ch_save|unlet ch_save
+
+         autocmd BufWritePost,FileWritePost    *.bz2 !mv <afile> <afile>:r
+         autocmd BufWritePost,FileWritePost    *.bz2 !bzip2 <afile>:r
+
+         autocmd FileAppendPre                 *.bz2 !bunzip2 <afile>
+         autocmd FileAppendPre                 *.bz2 !mv <afile>:r <afile>
+         autocmd FileAppendPost                *.bz2 !mv <afile> <afile>:r
+         autocmd FileAppendPost                *.bz2 !bzip2 -9 --repetitive-best <afile>:r
+       augroup END
+
+endif " has ("autocmd")
+
diff --git a/etc/vim/source/functions.vim b/etc/vim/source/functions.vim
new file mode 100644 (file)
index 0000000..1bc0c86
--- /dev/null
@@ -0,0 +1,430 @@
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" Functions
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let $VIMHOME = $HOME.'/.vim'
+"let $VIMHOME = '/home/nico'.'/.vim'
+
+" let vimhome = '/home/nico/.vim'
+let $VIMPLATE_DIR = $VIMHOME . '/templates'
+let $VIMPLATE = 'vimplate'
+
+let $VIMPLATE = $VIMPLATE . ' -user nico'
+
+let $VIMPLATE = $VIMPLATE . ' -config '.$VIMHOME.'/vimplaterc'
+
+let $VIMPLATE = $VIMPLATE . ' -dir '.$VIMPLATE_DIR
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" File...()
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let File = { 'type' : '' }
+
+func! FileVimplate()
+       let $VIMFILE = FileGet('path')
+
+       setloc paste
+       setloc nomore
+       setloc textwidth=0
+
+       let fname = &filetype.'.tt'
+       let ffind = findfile(fname,$VIMPLATE_DIR)
+       if ffind == ''
+       " if ffind != $VIMPLATE_DIR . '/' . fname
+               echo "FileVimplate(): Can't find ". $VIMPLATE_DIR . '/' . fname.' <> "' . ffind . '" !'
+               return
+       endif
+
+       let cmd = $VIMPLATE . ' -template '.&filetype
+" NB 29.12.12  let cmd = cmd . ' -listtemplates'
+       " let cmd = 'vimplate -user nico -dir '.$VIMHOME.'/vimplaterc -template '.&filetype
+       " let cmd = 'vimplate -user nico' .  -dir '.$VIMHOME.'/vimplaterc -template '.&filetype
+" NB 29.12.12 echo '>>'.cmd
+" NB 29.12.12           execute "!" . cmd . ' && echo OK'
+  let bashenv = $BASH_ENV
+  let $BASH_ENV = ""
+  execute "r!" . cmd
+  let $BASH_ENV = bashenv
+endfunc
+
+func! FileInit(...)
+  let bashenv = $BASH_ENV
+  let $BASH_ENV = ""
+
+       let vimplate = $VIMHOME."/vimplate-dump"
+       " NB 18.02.14 let tmp = vimplate .".vim.tmp"
+       let tmp = '/tmp/vimplate-dump.tmp'
+
+       call system(vimplate ." > ". tmp)
+
+       exec "source ".tmp
+
+       call delete(tmp)
+
+       let g:File['path'] = expand('%:p')
+       let g:File['ext'] = expand('%:e')
+  let g:File['type'] = &filetype
+
+       " Comment char - NB 20.08.12
+       let g:File['c'] = '#'
+       let g:File['cEnd'] = ''
+
+       if (g:File['type'] == 'vim') || (g:File['type'] == 'vimrc')
+               let g:File['c'] = '"'
+
+       elseif (g:File['type'] == 'javascript')
+               let g:File['c'] = '//'
+
+       elseif (g:File['type'] == 'php')
+               let g:File['c'] = '//'
+
+       elseif (g:File['type'] == 'sql')
+               let g:File['c'] = '--'
+
+       elseif (g:File['type'] == 'ini') || (g:File['type'] == 'cfg')
+               let g:File['c'] = ';'
+
+       elseif (g:File['type'] == 'xhtml') || (g:File['type'] == 'html') || (g:File['type'] == 'xml')
+               let g:File['c'] = '<!-- '
+               let g:File['cEnd'] = ' -->'
+
+       endif
+
+       " Script valid cmd - NB 20.08.12
+       let g:File['check'] = 'du -sh'
+
+       if (g:File['type'] == 'php')
+               let g:File['check'] = "php5 --define error_reporting=22519 --define display_errors=1 --define log_errors=1 --define html_errors=1" " E_ALL & ~E_NOTICE & ~E_DEPRECATED
+" todo - NB 11.12.12           if match(expand('%'),'/izideal/') let g:File['check'] = g:File['check'] . ' -z ~izideal/include/default.inc.php'
+
+       elseif (g:File['type'] == 'perl')
+               let g:File['check'] = 'perl -c -w'
+
+       elseif (g:File['type'] == 'html') || (g:File['type'] == 'xhtml')
+               let g:File['check'] = 'xmllint --noout --html'
+
+       elseif (g:File['type'] == 'xml')
+               let g:File['check'] = 'xmllint --noout'
+
+       elseif (g:File['ext'] == 'rb')
+               let g:File['check'] = 'ruby -c'
+
+       elseif (g:File['ext'] == 'pp')
+               let g:File['check'] = "perl -e 'system qq/puppet parser validate $ARGV[0] && puppet-lint --no-selector_inside_resource-check --no-autoloader_layout-check --no-hard_tabs-check --no-80chars-check $ARGV[0]/'"
+
+       elseif (g:File['type'] == 'yaml')
+               let g:File['check'] = "perl -MYAML -e 'YAML::LoadFile($ARGV[0])'"
+
+       elseif (g:File['type'] == 'sh')
+               let g:File['check'] = 'bash -n'
+
+       endif
+
+  let $BASH_ENV = bashenv
+       return "g:File: <".string(g:File).">"
+endfunc
+
+func! FileGet(...)
+
+       call FileInit()
+
+       let ret = []
+
+   for o in a:000 | call add(ret,g:File[o]) | endfor
+
+       return join(ret,' ')
+endfunc
+
+func! FileCheck()
+
+       call FileInit()
+
+   if g:File['check'] == ''
+               echo "FileCheck: Unknow file type".g:File['type']
+               return
+       endif
+
+       let cmd = g:File['check'].' '.g:File['path']
+  let bashenv = $BASH_ENV
+  let $BASH_ENV = ""
+       exec '!'.cmd
+  let $BASH_ENV = bashenv
+       return cmd
+
+endfunc
+
+func! FileCommentToggle()
+       let curr_line = getline('.')
+
+       let c = FileGet('c','me_now').' '
+
+       let exp = '^'.substitute(c,'\d\d\.\d\d\.\d\d','........','')
+" NB 13.02.14  let exp = '^'.substitute(c,'\d\d','..','')
+       let new_line = substitute(curr_line,exp,'','')
+
+       if new_line == curr_line
+               s/^/\=c/
+       else
+               call setline('.',new_line)
+       endif
+
+       " call setline('.',c)
+       " let new_line = '" ZAZA ' . curr_line
+       " call setline('.', new_line)
+       " call setline('.','" ZAZA')
+endfunc
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let Cmd = $HOME . '/.vim/vim-shortcurts'
+let FilePath = expand('%:p')
+
+let Debug = $VIMRC_DEBUG
+let DebugMsgs = [ 'Start '.strftime('%F %T') ]
+
+func! Debug(...)
+
+       if a:0 == 0
+               return g:DebugMsgs
+       endif
+
+       let msg = strftime('%F %T') . ' ' . a:1
+
+       call add(g:DebugMsgs,msg)
+
+       if g:Debug == 1
+               echo "DEBUG:" msg
+       endif
+       " echo string(g:DebugMsgs)
+
+       return g:Debug
+
+endfunc
+
+func! Stats()
+       let stats = expand("$HOME/.vim/stats")
+       if ! isdirectory(stats)
+               call mkdir(stats)
+       endif
+       call FileExec(stats.'/set.all','set all')
+       call FileExec(stats.'/setglob.all','setglob all')
+       call FileExec(stats.'/setloc.all','setloc all')
+       call FileExec(stats.'/let.g','let g:')
+       call FileExec(stats.'/let.v','let v:')
+       return
+endfunc
+
+func! Test()
+       let @a = ''
+       setloc nomore
+       setloc textwidth=0
+
+       redir @a
+
+       silent set all
+
+       redir END
+       return @a
+endfunc
+
+func! FileExec(file,...)
+       setlocal nomore
+       setlocal textwidth=0
+       exec "redir! > ".a:file
+       silent execute join(a:000,' ')
+       redir END
+       return
+endfunc
+
+func! GetExec(...)
+       " return join(a:000,' ')
+       setlocal nomore
+       setlocal textwidth=0
+       let rd = ''
+       redir => rd
+       silent execute join(a:000,' ')
+       redir END
+       return rd
+       echo "ZAZA"
+endfunc
+
+func! VimrcReload2(...)
+       " echo GetExec('set all')
+       " call FileExec('/tmp/zaza.vim','set all')
+       return
+       echo "ZAZA"
+endfunc
+
+if !exists('*VimrcReload')
+       " call Debug("VimrcReload: Create")
+       func! VimrcReload(...)
+               call Debug("VimrcReload: Start")
+
+               call Debug("VimrcReload: ".$MYVIMRC)
+               " source plugin/*.vim
+               exec "source $MYVIMRC"
+
+               call Debug("VimrcReload: End")
+               call VimrcReload2()
+               
+               return Debug()
+       endfunc
+endif
+
+func! FileScript(...)
+       let Out = shellescape(g:Cmd). ' ' . join(a:000,' ')
+       let Out = system(Out)
+       let Out = substitute(Out,'[\n\s]\+$','','')
+       " let Out = substitute(Out,'[\t\r\n ]\+$','','')
+       return Out
+       echo "<".Out.">"
+endfunc
+
+func! VS(...)
+   let Cmd = g:Cmd
+   let FilePath = expand('%:p')
+       if (a:0 == 0) || (a:1 == "auto") || (g:FilePath == "") || (g:VimShortcurtsAutoType == "")
+               " echon "DEBUG"
+       let g:FilePath = expand('%:p')
+               let g:VimShortcurtsAutoType = system(g:Cmd .' file_type ' . g:FilePath)
+               if (a:0 == 0) || (a:1 == "auto")
+                       return g:FilePath.':'.g:VimShortcurtsAutoType
+               endif
+       end
+   for o in a:000
+      let o = substitute(o, '^%$', FilePath, '')
+      let o = substitute(o, '^auto_', g:VimShortcurtsAutoType.'_', '')
+      let Cmd = Cmd . ' ' . o
+   endfor
+   " return system(Cmd)
+   return Cmd
+endfunc
+
+func! VimShortcurtsAuto(...)
+   let Cmd = g:Cmd
+   let FilePath = expand('%:p')
+       " return a:1.match(a:1,"_comment_line_toggle")
+       " f (match(a:1,"_comment_line_toggle"))
+        if (a:1 == "Wcomment_line_toggle")
+               " return Cmd
+               let Cmd = 'cat|' . Cmd
+       endif
+
+       setlocal paste
+
+       " return (g:Cmd .' auto_' . a:1 . ' ' . FilePath)
+       return system(g:Cmd .' auto_' . a:1 . ' ' . FilePath)
+
+endfunc
+
+func! VimShortcurtsList()
+" NB 09.11.11  call input('Entry: ')
+       let list = system(g:Cmd .' all_choose')
+       let i = input(list . 'Please choose a number function: ')
+
+       let fct = substitute(list, '^.*\s' . i . '\. \(\w\+\).*$', '\1', '')
+       return fct
+
+       let items = split(list,"\n\t")
+       return items
+       let opt = inputlist(items)
+" NB 09.11.11  call setline(lnum, '" zaza ' . getline(lnum))
+       " echo items[opt]
+       " g:nicoInput = items[opt]
+       return items[opt]
+endfunc
+
+
+" Trim
+function! StrTrim (string)
+       let string=a:string
+       let string = substitute(string, '[\s\t\r\n]\+$', '', '')
+       return string
+endfunction
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Other function copy from examples
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function! CountSpaces(type, ...)
+
+       let sel_save = &selection
+       let &selection = "inclusive"
+       let reg_save = @@
+
+       if a:0  " Invoked from Visual mode, use '< and '> marks.
+       silent exe "normal! `<" . a:type . "`>y"
+
+       elseif a:type == 'line'
+       silent exe "normal! '[V']y"
+
+       elseif a:type == 'block'
+       silent exe "normal! `[\<C-V>`]y"
+
+       else
+       silent exe "normal! `[v`]y"
+
+       endif
+
+       echomsg strlen(substitute(@@, '[^ ]', '', 'g'))
+
+       let &selection = sel_save
+       let @@ = reg_save
+endfunction
+
+" You can call this function with: :10,30call Count_words()
+func! Count_words() range
+       let lnum = a:firstline
+       let n = 0
+       while lnum <= a:lastline
+               let n = n + len(split(getline(lnum)))
+               let lnum = lnum + 1
+       endwhile
+               echo lnum
+       return "found " . n . " words"
+endfunction
+
+" Capitalize the first letter of each word
+func! Capitalize() range
+       for line_number in range(a:firstline, a:lastline)
+               let line_content = getline(line_number)
+               let line_content = substitute(line_content, "\\w\\+", "\\u\\0", "g")
+               call setline(line_number, line_content)
+       endfor
+endfunction
+
+" Escape special characters in a string for exact matching.
+" This is useful to copying strings from the file to the search tool
+" Based on this - http://peterodding.com/code/vim/profile/autoload/xolox/escape.vim
+function! EscapeString (string)
+       let string=a:string
+       " Escape regex characters
+       let string = escape(string, '^$.*\/~[]')
+       " Escape the line endings
+       let string = substitute(string, '\n', '\\n', 'g')
+       return string
+endfunction
+
+" Get the current visual block for search and replaces
+" This function passed the visual block through a string escape function
+" Based on this - http://stackoverflow.com/questions/676600/vim-replace-selected-text/677918#677918
+function! GetVisual() range
+       " Save the current register and clipboard
+       let reg_save = getreg('"')
+       let regtype_save = getregtype('"')
+       let cb_save = &clipboard
+       set clipboard&
+
+       " Put the current visual selection in the " register
+       normal! ""gvy
+       let selection = getreg('"')
+
+       " Put the saved registers and clipboards back
+       call setreg('"', reg_save, regtype_save)
+       let &clipboard = cb_save
+
+       "Escape any special characters in the selection
+       let escaped_selection = EscapeString(selection)
+
+       return escaped_selection
+endfunction
+
+
diff --git a/etc/vim/source/html.no b/etc/vim/source/html.no
new file mode 100644 (file)
index 0000000..485cdd3
--- /dev/null
@@ -0,0 +1,6 @@
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"  NB 04.09.06 HTML plugin
+" :let g:html_authorname = 'Nicolas'
+" :let g:html_tag_case = 'l'
+" :let g:html_template = '~/.vim/template.html'
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
diff --git a/etc/vim/source/map.vim b/etc/vim/source/map.vim
new file mode 100644 (file)
index 0000000..43d38a3
--- /dev/null
@@ -0,0 +1,90 @@
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" Map Keys
+"
+"
+" imap <Tab> :Z
+" set encoding=utf-8
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" NB 22.07.12 " Remember last line
+" NB 22.07.12 set viminfo='10,\"100,:20,%,n~/.viminfo
+" NB 22.07.12     au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
+" NB 22.07.12 
+" NB 22.07.12 " I know it's horrible for a vi master but useful for newbies. - NB 04.11.03
+" NB 22.07.12 imap <C-a> <Esc>I
+" NB 22.07.12 imap <C-e> <ESC>A
+" NB 22.07.12 map <C-Tab> <C-W>w
+" NB 22.07.12 imap <C-Tab> <C-O><C-W>w
+" NB 22.07.12 cmap <C-Tab> <C-C><C-Tab>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" Next File
+" Next / Prev File
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+map <C-n> :bn<C-M>
+map <C-b> :bp<C-M>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" Shortcuts
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F1 - Last Cmd
+map <F1> :!<C-UP><C-M>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F2 - Script, formated text verification
+map <F2> :call FileCheck()<CR>
+" map <F2> :!~/.vim/checkscript.sh %<CR>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F3 - Choose email signature
+map <F3> :update <CR>:!~/.vim/choosesig.pl % <CR>:e<CR>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F4 - Check spell
+map <F4> :update <CR>:!~/.vim/checkspell.sh %<CR>:e<CR>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F5 - Comment
+map <F5> o<C-R>=FileGet('c').' - '.FileGet('me_now').FileGet('cEnd')<CR><Esc>^<CR>b^wi
+" - NB 18.04.13
+" vmap <F5> :s/^/\=VimShortcurtsAuto('comment_line_toggle').' '/<CR>
+" vmap <F5> :call NERDComment(1, "invert")<CR>
+vmap <F5> :call FileCommentToggle()<CR>
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F6 - Prog Function Create
+map <F6> o<C-R>=VimShortcurtsAuto('function_new')<CR><Esc>?foo<CR>cw
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" F7 - Prog Create
+map <F7> :call FileVimplate()<CR>
+" map <F7> O<C-R>=FileVimplate()<CR>
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" - Prog Create
+" map <F8> :call VimShortcurtsInteractive()<CR>
+" vmap <F8> :call VimShortcurtsInteractive()<CR>
+
+
+" Start the find and replace command across the entire file
+" vmap <leader>z <Esc>:%s/<c-r>=GetVisual()<cr>/
+" Interactif
+" You can call this function with: :10,30call Count_words()
+" map <F7> o<C-R>=VimShortcurtsAuto('all_choose')<CR>
+" NB 09.11.11 map <F8> :.!~/.vim/vim-shortcurts-stdin<CR>
+" vmap <F8> !~/.vim/vim-shortcurts<CR>
+" vmap <F8> .!~/.vim/vim-shortcurts all_choose<CR>
+" map <F8> :s/^\(.*\)$/\=VimShortcurtsAuto('all_choose','\1')/<CR>
+" map <F8> :s/^/\=VimShortcurtsAuto('all_choose')/<CR>
+" vmap <F8> :s/^/\=VimShortcurtsAuto('all_choose')/<CR>
+" nmap <silent> <F8> :set opfunc=CountSpaces<CR>g@
+" vmap <silent> <F8> :<C-U>call CountSpaces(visualmode(), 1)<CR>
+
+
+
diff --git a/etc/vim/source/option.vim b/etc/vim/source/option.vim
new file mode 100644 (file)
index 0000000..eb074d7
--- /dev/null
@@ -0,0 +1,132 @@
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"
+" Options
+"
+" SEE http://vimdoc.sourceforge.net/htmldoc/options.html#set-option
+" more-prompt
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set history=1000
+"                                              *'history'* *'hi'*
+"'history' 'hi'                number  (Vim default: 20, Vi default: 0)
+"                      global
+"                      {not in Vi}
+"      A history of ":" commands, and a history of previous search patterns
+"      are remembered.  This option decides how many entries may be stored in
+"      each of these histories (see |cmdline-editing|).
+"      NOTE: This option is set to the Vi default value when 'compatible' is
+"      set and to the Vim default value when 'compatible' is reset.
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Sell
+" set shellpipe=
+" set shellcmdflag=-ic
+" set shellcmdflag=-ic
+" set shell=/bin/bash\ -i
+let $BASH_ENV = "~/.bashrc"
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" set nocompatible
+set indentexpr=
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set indentkeys=
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"set nomore
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" set mousemodel=popup
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set wildmenu
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set expandtab
+set smarttab
+set tabstop=2
+set shiftwidth=2
+set softtabstop=2
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set autoindent
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set backspace=2
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" set textwidth=79
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set nobackup
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set nohlsearch
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set noincsearch
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set ruler
+"                                       *'ruler'* *'ru'* *'noruler'* *'noru'*
+"'ruler' 'ru'          boolean (default off)
+"                      global
+"                      {not in Vi}
+"                      {not available when compiled without the
+"                      |+cmdline_info| feature}
+"      Show the line and column number of the cursor position, separated by a
+"      comma.  When there is room, the relative position of the displayed
+"      text in the file is shown on the far right:
+"              Top     first line is visible
+"              Bot     last line is visible
+"              All     first and last line are visible
+"              45%     relative position in the file
+"      If 'rulerformat' is set, it will determine the contents of the ruler.
+"      Each window has its own ruler.  If a window has a status line, the
+"      ruler is shown there.  Otherwise it is shown in the last line of the
+"      screen.  If the statusline is given by 'statusline' (i.e. not empty),
+"      this option takes precedence over 'ruler' and 'rulerformat'
+"      If the number of characters displayed is different from the number of
+"      bytes in the text (e.g., for a TAB or a multi-byte character), both
+"      the text column (byte number) and the screen column are shown,
+"      separated with a dash.
+"      For an empty line "0-1" is shown.
+"      For an empty buffer the line number will also be zero: "0,0-1".
+"      This option is reset when the 'paste' option is set.
+"      If you don't want to see the ruler all the time but want to know where
+"      you are, use "g CTRL-G" |g_CTRL-G|.
+"      NOTE: This option is reset when 'compatible' is set.
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"                                              *'rulerformat'* *'ruf'*
+"'rulerformat' 'ruf'   string  (default empty)
+"                      global
+"                      {not in Vi}
+"                      {not available when compiled without the |+statusline|
+"                      feature}
+"      When this option is not empty, it determines the content of the ruler
+"      string, as displayed for the 'ruler' option.
+"      The format of this option is like that of 'statusline'.
+"      The default ruler width is 17 characters.  To make the ruler 15
+"      characters wide, put "%15(" at the start and "%)" at the end.
+"      Example: >
+"              :set rulerformat=%15(%c%V\ %p%%%)
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set showmatch
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+set laststatus=1
+"                                      *'laststatus'* *'ls'*
+"'laststatus' 'ls'     number  (default 1)
+"                      global
+"                      {not in Vi}
+"      The value of this option influences when the last window will have a
+"      status line:
+"              0: never
+"              1: only if there are at least two windows
+"              2: always
+"      The screen looks nicer with a status line if you have several
+"      windows, but it takes another screen line. |status-line|
+
diff --git a/etc/vim/source/tt.vim b/etc/vim/source/tt.vim
new file mode 100644 (file)
index 0000000..e726b42
--- /dev/null
@@ -0,0 +1 @@
+au BufNewFile,BufRead *.dump set filetype=sql
diff --git a/etc/vim/stats/let.g b/etc/vim/stats/let.g
new file mode 100644 (file)
index 0000000..9a4caa1
--- /dev/null
@@ -0,0 +1,19 @@
+
+syntax_on             #1
+stats                  /home/nico/.vimrc/stats
+loaded_getscriptPlugin  v32
+loaded_netrwPlugin     v138
+loaded_zipPlugin       v23
+did_load_filetypes    #1
+Debug                  
+loaded_rrhelper       #1
+Cmd                    /home/nico/.vim/vim-shortcurts
+loaded_spellfile_plugin #1
+FilePath               /home/nico/.vim/plugin/functions.vim
+loaded_vimballPlugin   v31
+File                  {}
+DebugMsgs             ['Start 2012-08-10 08:52:45']
+loaded_tarPlugin       v24
+loaded_matchparen     #1
+ft_ignore_pat          \.\(Z\|gz\|bz2\|zip\|tgz\)$
+vimsyn_embed           mpPr
\ No newline at end of file
diff --git a/etc/vim/stats/let.v b/etc/vim/stats/let.v
new file mode 100644 (file)
index 0000000..c1e2866
--- /dev/null
@@ -0,0 +1,33 @@
+
+v:version             #702
+v:beval_winnr         #0
+v:lnum                #0
+v:scrollstart          function Stats line 3
+v:oldfiles            ['~/.vimrc', '~/.vim/plugin/functions.vim', '/usr/share/vim/vim72/doc/eval.txt', '~/.vim/plugin/abbreviate.vim', '/home/www/nicolas.boisselier/html/begin.inc.php', '~/.vim/vim-shortcurts', '/usr/share/vim/vim72/doc/filetype.txt', '/usr/share/vim/vim72/doc/options.txt', '~/.vim/plugin/map.vim', '/usr/share/vim/vim72/doc/repeat.txt', '~/.vim/plugin/html.no', '~/.vim/plugin/debian.vim', '/home/www/nicolas.boisselier/map', '/usr/share/vim/vim72/doc/map.txt', '/usr/share/vim/vim72/doc/motion.txt', '/usr/share/vim/vim72/doc/syntax.txt', '~/.vim/plugin/nb.vim', '/usr/share/vim/vim72/doc/starting.txt', '/tmp/zaza.vim', '/usr/share/vim/vim72/doc/usr_05.txt', '/usr/share/vim/vim72/doc/various.txt', '/home/etc/vimrc', '~/.vim/sources/nb.vim', '/usr/share/vim/vim72/doc/insert.txt', '/usr/share/vim/vim72/doc/intro.txt', '/home/www/nicolas.boisselier/echo ''zaza''', '/usr/share/vim/vim72/doc/help.txt', '/usr/share/vim/vim72/doc/autocmd.txt', '/usr/share/vim/vim72/doc/message.txt', '/usr/share/vim/vim72/doc/quickfix.txt', '/usr/share/vim/vim72/doc/digraph.txt', '/usr/share/vim/vim72/doc/pi_netrw.txt', '/home/www/nicolas.boisselier/source', '~/tmp/nb.vim', 'html/begin.inc.php', '/home/www/nicolas.boisselier/rd.txt', '/home/www/nicolas.boisselier/redir', '/usr/share/vim/vim72/doc/windows.txt', '/usr/share/vim/vim72/doc/editing.txt', '/home/www/nicolas.boisselier/^Yset shell ?', '/usr/share/vim/vim72/macros/less.sh', '/usr/share/vim/vim72/doc/quickref.txt', '/usr/share/vim/vim72.', '/usr/share/vim/vim72/doc/usr_41.txt', '/usr/share/vim/vim72/doc/visual.txt', '/usr/share/vim/vim72/doc/usr_10.txt', '/usr/share/vim/vim72/doc/cmdline.txt', '~/tmp/nb.so', '/usr/share/vim/vim72/doc/os_unix.txt', '/home/www/nicolas.boisselier/functions', '/usr/share/vim/vim72/doc/change.txt', '`/.vimrc', '/usr/share/vim/vim72/doc/pattern.txt', '/usr/share/vim/vim72/doc/ft_sql.txt', '/usr/share/vim/vim72/doc/gui_w16.txt', '/~.vimrc', '/home/www/nicolas.boisselier/html/begin.inc.php:', '/home/www/nicolas.boisselier/html/tips/index.php', '/home/www/nicolas.boisselier/html/tips/Firefox-About-Config.tips', '/home/www/nicolas.boisselier/html/tips/index.php:', '/home/www/nicolas.boisselier/html/body-begin.inc.php', 'html/body-begin.inc.php:', '/home/www/nicolas.boisselier/html/tips/Firefox-About-Config', '/home/bin/gg-contacts', '~/bin/access.pl', '~/Crypt/LOGIN.INI', '/home/bin/nico-fetchmail', '/home/bin/nico-fetchmail.new', '~/tmp/mutt-big-501-24483-42c9b17ca70db858d', '/home/www/izideal/styles/default/css/search/index.php', '/home/www/izideal/styles/default/css/vendors.php', '/home/www/izideal/styles/default/css/css.inc.php', '~/tmp/mutt-big-501-31354-45758b39168f2ca3a', '/home/www/izideal/bin/vendors/NETAFFILIATION/conf-xls.pm', '/home/www/izideal/bin/izi-get-0.0.1', '~/.cvsignore', '~/tmp/mutt-big-501-25281-23994017f6ecb0c47', '/boot/grub/grub.cfg', '/home/www/izideal/share/rkhunter/install_rkhunter.sh', '/home/www/izideal/bin/izi-search-code', '/home/www/izideal/.izirc.functions']
+v:dying               #0
+v:lang                 en_US.UTF-8
+v:count               #0
+v:progname             vim
+v:cmdbang             #0
+v:foldlevel           #0
+v:operator             d
+v:ctype                en_US.UTF-8
+v:prevcount           #0
+v:register             "
+v:mouse_win           #0
+v:count1              #1
+v:foldstart           #0
+v:foldend             #0
+v:profiling           #0
+v:beval_col           #0
+v:errmsg               E121: Undefined variable: s:
+v:beval_lnum          #0
+v:mouse_lnum          #0
+v:insertmode           i
+v:beval_bufnr         #0
+v:shell_error         #0
+v:lc_time              en_US.UTF-8
+v:searchforward       #1
+v:mouse_col           #0
+v:statusmsg            "~/.vim/plugin/functions.vim" 280L, 6861C written
+v:warningmsg           search hit BOTTOM, continuing at TOP
\ No newline at end of file
diff --git a/etc/vim/stats/set.all b/etc/vim/stats/set.all
new file mode 100644 (file)
index 0000000..1d7d6e6
--- /dev/null
@@ -0,0 +1,88 @@
+
+--- Options ---
+  aleph=224           columns=181         esckeys           noicon                makeprg=make        printfont=courier noshowcmd             taglength=0       novisualbell
+noarabic            nocompatible          eventignore=        iconstring=         matchtime=5         printmbcharset=   noshowfulltag         tagrelative         warn
+  arabicshape         completefunc=     noexpandtab         noignorecase          maxcombine=2        printmbfont=        showmatch           tagstack          noweirdinvert
+noallowrevins       noconfirm           noexrc                iminsert=0          maxfuncdepth=100    prompt              showmode            term=screen.linux   whichwrap=b,s
+noaltkeymap         nocopyindent          fileformat=unix     imsearch=0          maxmapdepth=1000    pumheight=0         showtabline=1     notermbidi            wildchar=<Tab>
+  ambiwidth=single    cpoptions=aABceFs   filetype=vim        includeexpr=        maxmem=4087002      quoteescape=\       sidescroll=0        termencoding=       wildcharm=0
+noautochdir           cscopepathcomp=0  nofkmap             noincsearch           maxmemtot=4087002 noreadonly            sidescrolloff=0   noterse               wildignore=
+  autoindent          cscopeprg=cscope    foldclose=          indentexpr=         menuitems=25        redrawtime=2000   nosmartcase           textauto            wildmenu
+noautoread            cscopequickfix=     foldcolumn=0        indentkeys=         modeline            remap             nosmartindent       notextmode            wildmode=full
+noautowrite         nocscopetag           foldenable        noinfercase           modelines=5         report=2            smarttab            textwidth=0         wildoptions=
+noautowriteall        cscopetagorder=0    foldexpr=0        noinsertmode          modifiable        norevins              softtabstop=0       thesaurus=          window=48
+  background=dark   nocscopeverbose       foldignore=#        isprint=@,161-255 nomodified          norightleft         nospell             notildeop             winheight=1
+  backspace=2       nocursorcolumn        foldlevel=0         joinspaces        nomore                ruler               spellfile=          timeout           nowinfixheight
+nobackup            nocursorline          foldlevelstart=-1   key=                mouse=              rulerformat=        spelllang=en        timeoutlen=1000   nowinfixwidth
+  backupcopy=auto     debug=              foldmethod=manual   keymap=             mousemodel=popup    scroll=23           spellsuggest=best notitle               winminheight=1
+  backupext=~       nodelcombine          foldminlines=1      keymodel=           mousetime=500     noscrollbind        nosplitbelow          titlelen=85         winminwidth=1
+  backupskip=/tmp/*   dictionary=         foldnestmax=20      keywordprg=man    nonumber              scrolljump=1      nosplitright          titlestring=        winwidth=20
+nobinary            nodiff                formatexpr=         langmap=            numberwidth=4       scrolloff=0         startofline       nottimeout            wrap
+nobomb                diffexpr=           formatoptions=tcq   langmenu=           omnifunc=         nosecure              statusline=         ttimeoutlen=-1      wrapmargin=0
+  bufhidden=          diffopt=filler      formatprg=          laststatus=2        operatorfunc=       selectmode=         suffixesadd=        ttybuiltin          wrapscan
+  buflisted         nodigraph             fsync             nolazyredraw        nopaste               shell=/bin/bash     swapfile            ttyfast             write
+  buftype=            display=          nogdefault          nolinebreak           pastetoggle=        shellcmdflag=-c     swapsync=fsync      ttymouse=xterm    nowriteany
+  cdpath=,,           eadirection=both    helpheight=20       lines=49            patchexpr=          shellquote=         switchbuf=          ttyscroll=999       writebackup
+  cedit=^F          noedcompatible        helplang=en       nolisp                patchmode=          shelltemp           synmaxcol=3000      undolevels=1000     writedelay=0
+  charconvert=        encoding=utf-8    nohidden            nolist              nopreserveindent      shellxquote=        syntax=vim          updatecount=200
+nocindent             endofline           history=20          listchars=eol:$     previewheight=12  noshiftround          tabline=            updatetime=4000
+  cinoptions=         equalalways       nohkmap               loadplugins       nopreviewwindow       shiftwidth=3        tabpagemax=10       verbose=0
+  cmdheight=1         equalprg=         nohkmapp              magic               printdevice=      noshortname           tabstop=3           verbosefile=
+  cmdwinheight=7    noerrorbells        nohlsearch            makeef=             printencoding=      showbreak=          tagbsearch          virtualedit=
+  backupdir=.,~/tmp,~/
+  breakat= ^I!@*-+;:,./?
+  casemap=internal,keepascii
+  cinkeys=0{,0},0),:,0#,!^F,o,O,e
+  cinwords=if,else,while,do,for,switch
+  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+  commentstring=/*%s*/
+  complete=.,w,b,u,t,i
+  completeopt=menu,preview
+  define=^\s*#\s*define
+  directory=.,~/tmp,/var/tmp,/tmp
+  errorfile=errors.err
+  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-Gfrom %f:%l:%c,%-Gfrom %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
+  fileencoding=utf-8
+  fileencodings=ucs-bom,utf-8,default,latin1
+  fileformats=unix,dos
+  fillchars=vert:|,fold:-
+  foldmarker={{{,}}}
+  foldopen=block,hor,mark,percent,quickfix,search,tag,undo
+  foldtext=foldtext()
+  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
+  grepformat=%f:%l:%m,%f:%l%m,%f  %l%m
+  grepprg=grep -n $* /dev/null
+  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block
+  helpfile=/usr/share/vim/vim72/doc/help.txt
+  highlight=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine
+  include=^\s*#\s*include
+  isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=
+  isident=@,48-57,_,192-255
+  iskeyword=@,48-57,_,192-255
+  lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object
+  matchpairs=(:),{:},[:]
+  maxmempattern=1000
+  mkspellmem=460000,2000,500
+  nrformats=octal,hex
+  paragraphs=IPLPPPQPP TPHPLIPpLpItpplpipbp
+  path=.,/usr/include,,
+  printexpr=system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error
+  printheader=%<%f%h%m%=Page %N
+  printoptions=paper:letter
+  rightleftcmd=search
+  runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
+  scrollopt=ver,jump
+  sections=SHNHH HUnhsh
+  selection=inclusive
+  sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
+  shellpipe=2>&1| tee
+  shellredir=>%s 2>&1
+  shortmess=filnxtToO
+  spellcapcheck=[.?!]\_[\])'"^I ]\+
+  suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
+  tags=./tags,./TAGS,tags,TAGS
+  titleold=Thanks for flying Vim
+  ttytype=screen.linux
+  viewdir=~/.vim/view
+  viewoptions=folds,options,cursor
+  viminfo='100,<50,s10,h
\ No newline at end of file
diff --git a/etc/vim/stats/setglob.all b/etc/vim/stats/setglob.all
new file mode 100644 (file)
index 0000000..d92d750
--- /dev/null
@@ -0,0 +1,31 @@
+
+--- Global option values ---
+noarabic              cinoptions=       noexpandtab           foldmethod=manual noinfercase           modifiable        norightleft           spelllang=en        thesaurus=
+  autoindent          completefunc=       fileencoding=       foldminlines=1      key=              nomodified            scroll=0            statusline=       nowinfixheight
+noautoread          nocopyindent          fileformat=unix     foldnestmax=20      keymap=           nonumber            noscrollbind          suffixesadd=      nowinfixwidth
+nobinary            nocursorcolumn        filetype=           formatexpr=         keywordprg=man      numberwidth=4       shiftwidth=3        swapfile            wrap
+nobomb              nocursorline          foldcolumn=0        iminsert=0        nolinebreak           omnifunc=         noshortname           synmaxcol=3000      wrapmargin=0
+  bufhidden=          dictionary=         foldenable          imsearch=0        nolisp              nopreserveindent    nosmartindent         syntax=help
+  buflisted         nodiff                foldexpr=0          includeexpr=      nolist              nopreviewwindow       softtabstop=0       tabstop=3
+  buftype=            endofline           foldignore=#        indentexpr=         makeprg=make        quoteescape=\     nospell             notextmode
+nocindent             equalprg=           foldlevel=0         indentkeys=         modeline          noreadonly            spellfile=          textwidth=0
+  cinkeys=0{,0},0),:,0#,!^F,o,O,e
+  cinwords=if,else,while,do,for,switch
+  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+  commentstring=/*%s*/
+  complete=.,w,b,u,t,i
+  define=^\s*#\s*define
+  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-Gfrom %f:%l:%c,%-Gfrom %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
+  foldmarker={{{,}}}
+  foldtext=foldtext()
+  formatoptions=tcql
+  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
+  grepprg=grep -n $* /dev/null
+  include=^\s*#\s*include
+  iskeyword=@,48-57,_,192-255
+  matchpairs=(:),{:},[:]
+  nrformats=octal,hex
+  path=.,/usr/include,,
+  rightleftcmd=search
+  spellcapcheck=[.?!]\_[\])'"^I ]\+
+  tags=./tags,./TAGS,tags,TAGS
\ No newline at end of file
diff --git a/etc/vim/stats/setloc.all b/etc/vim/stats/setloc.all
new file mode 100644 (file)
index 0000000..fce24f6
--- /dev/null
@@ -0,0 +1,26 @@
+
+--- Local option values ---
+noarabic              completefunc=     noexpandtab           foldnestmax=20    noinfercase         nomodified            scroll=23           suffixesadd=      nowinfixwidth
+  autoindent        nocopyindent          fileformat=unix     formatexpr=         key=              nonumber            noscrollbind          swapfile            wrap
+--autoread          nocursorcolumn        filetype=vim        formatoptions=tcq   keymap=             numberwidth=4       shiftwidth=3        synmaxcol=3000      wrapmargin=0
+nobinary            nocursorline          foldcolumn=0        grepprg=            keywordprg=         omnifunc=         noshortname           syntax=vim
+nobomb                define=             foldenable          iminsert=0        nolinebreak           path=             nosmartindent         tabstop=3
+  bufhidden=          dictionary=         foldexpr=0          imsearch=0        nolisp              nopreserveindent      softtabstop=0       tags=
+  buflisted         nodiff                foldignore=#        include=          nolist              nopreviewwindow     nospell             notextmode
+  buftype=            endofline           foldlevel=0         includeexpr=        makeprg=            quoteescape=\       spellfile=          textwidth=0
+nocindent             equalprg=           foldmethod=manual   indentexpr=         modeline          noreadonly            spelllang=en        thesaurus=
+  cinoptions=         errorformat=        foldminlines=1      indentkeys=         modifiable        norightleft           statusline=       nowinfixheight
+  cinkeys=0{,0},0),:,0#,!^F,o,O,e
+  cinwords=if,else,while,do,for,switch
+  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+  commentstring=/*%s*/
+  complete=.,w,b,u,t,i
+  fileencoding=utf-8
+  foldmarker={{{,}}}
+  foldtext=foldtext()
+  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
+  iskeyword=@,48-57,_,192-255
+  matchpairs=(:),{:},[:]
+  nrformats=octal,hex
+  rightleftcmd=search
+  spellcapcheck=[.?!]\_[\])'"^I ]\+
\ No newline at end of file
diff --git a/etc/vim/syntax/puppet.vim b/etc/vim/syntax/puppet.vim
new file mode 100644 (file)
index 0000000..9605210
--- /dev/null
@@ -0,0 +1,115 @@
+" puppet syntax file
+" Filename:     puppet.vim
+" Language:     puppet configuration file
+" Maintainer:   Luke Kanies <luke@madstop.com>
+" URL:
+" Last Change:
+" Version:
+"
+
+" Copied from the cfengine, ruby, and perl syntax files
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" match class/definition/node declarations
+syn region  puppetDefine        start="^\s*\(class\|define\|node\)\s" end="{" contains=puppetDefType,puppetDefName,puppetDefArguments,puppetNodeRe
+syn keyword puppetDefType       class define node inherits contained
+syn region  puppetDefArguments  start="(" end=")" contained contains=puppetArgument,puppetString
+syn match   puppetArgument      "\w\+" contained
+syn match   puppetArgument      "\$\w\+" contained
+syn match   puppetArgument      "'[^']+'" contained
+syn match   puppetArgument      '"[^"]+"' contained
+syn match   puppetDefName       "\w\+" contained
+syn match   puppetNodeRe        "/.*/" contained
+
+" match 'foo' in 'class foo { ...'
+" match 'foo::bar' in 'class foo::bar { ...'
+" match 'Foo::Bar' in 'Foo::Bar["..."]
+"FIXME: "Foo-bar" doesn't get highlighted as expected, although "foo-bar" does.
+syn match   puppetInstance      "[A-Za-z0-9_-]\+\(::[A-Za-z0-9_-]\+\)*\s*{" contains=puppetTypeName,puppetTypeDefault
+syn match   puppetInstance      "[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*[[{]" contains=puppetTypeName,puppetTypeDefault
+syn match   puppetInstance      "[A-Z][a-z_-]\+\(::[A-Z][a-z_-]\+\)*\s*<\?<|" contains=puppetTypeName,puppetTypeDefault
+syn match   puppetTypeName      "[a-z]\w*" contained
+syn match   puppetTypeDefault   "[A-Z]\w*" contained
+
+" match 'foo' in 'foo => "bar"'
+syn match   puppetParam         "\w\+\s*[=+]>" contains=puppetParamName
+syn match   puppetParamName     "\w\+" contained
+
+" match 'present' in 'ensure => present'
+" match '2755' in 'mode => 2755'
+" don't match 'bar' in 'foo => bar'
+syn match   puppetParam         "\w\+\s*[=+]>\s*[a-z0-9]\+" contains=puppetParamString,puppetParamName
+syn match   puppetParamString   "[=+]>\s*\w\+" contains=puppetParamKeyword,puppetParamSpecial,puppetParamDigits contained
+syn keyword puppetParamKeyword  present absent purged latest installed running stopped mounted unmounted role configured file directory link contained
+syn keyword puppetParamSpecial  true false undef contained
+syn match   puppetParamDigits   "[0-9]\+"
+
+" match 'template' in 'content => template("...")'
+syn match   puppetParam         "\w\+\s*[=+]>\s*\w\+\s*(" contains=puppetFunction,puppetParamName
+" statements
+syn region  puppetFunction      start="^\s*\(alert\|crit\|debug\|emerg\|err\|fail\|include\|info\|notice\|realize\|require\|search\|tag\|warning\)\s*(" end=")" contained contains=puppetString
+" rvalues
+syn region  puppetFunction      start="^\s*\(defined\|file\|fqdn_rand\|generate\|inline_template\|regsubst\|sha1\|shellquote\|split\|sprintf\|tagged\|template\|versioncmp\)\s*(" end=")" contained contains=puppetString
+
+syn match   puppetVariable      "$[a-zA-Z0-9_:]\+"
+syn match   puppetVariable      "${[a-zA-Z0-9_:]\+}"
+
+" match anything between simple/double quotes.
+" don't match variables if preceded by a backslash.
+syn region  puppetString        start=+'+ skip=+\\\\\|\\'+ end=+'+
+syn region  puppetString        start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=puppetVariable,puppetNotVariable
+syn match   puppetString        "/[^/]*/"
+syn match   puppetNotVariable   "\\$\w\+" contained
+syn match   puppetNotVariable   "\\${\w\+}" contained
+
+syn keyword puppetKeyword       import inherits include
+syn keyword puppetControl       case default if else elsif
+syn keyword puppetSpecial       true false undef
+
+" comments last overriding everything else
+syn match   puppetComment       "\s*#.*$" contains=puppetTodo
+syn region  puppetComment       start="/\*" end="\*/" contains=puppetTodo extend
+syn keyword puppetTodo          TODO NOTE FIXME XXX BUG HACK contained
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_puppet_syn_inits")
+  if version < 508
+    let did_puppet_syn_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+
+  HiLink puppetVariable             Identifier
+  HiLink puppetType                 Identifier
+  HiLink puppetKeyword              Define
+  HiLink puppetComment              Comment
+  HiLink puppetString               String
+  HiLink puppetParamKeyword         String
+  HiLink puppetParamDigits          String
+  HiLink puppetNotVariable          String
+  HiLink puppetParamSpecial         Special
+  HiLink puppetSpecial              Special
+  HiLink puppetTodo                 Todo
+  HiLink puppetControl              Statement
+  HiLink puppetDefType              Define
+  HiLink puppetDefName              Type
+  HiLink puppetNodeRe               Type
+  HiLink puppetTypeName             Statement
+  HiLink puppetTypeDefault          Type
+  HiLink puppetParamName            Identifier
+  HiLink puppetArgument             Identifier
+  HiLink puppetFunction             Function
+
+  delcommand HiLink
+endif
+
+let b:current_syntax = "puppet"
diff --git a/etc/vim/template.html b/etc/vim/template.html
new file mode 100644 (file)
index 0000000..50dd2e2
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+       <head>
+               <title></title>
+               <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+               <meta name="Copyright" content="Copyright (C) %date% %authorname%"/>
+               <meta name="Author" content="%authorname%" />
+               <meta name="Generator" content="vim (Vi IMproved editor; http://www.vim.org/)" />
+       </head>
+       <body>
+       </body>
+</html>
diff --git a/etc/vim/templates/bash.tt b/etc/vim/templates/bash.tt
new file mode 100644 (file)
index 0000000..b0709a0
--- /dev/null
@@ -0,0 +1,119 @@
+#!/usr/bin/env bash
+#################################################################################
+#
+# [% user.me_now %] - [% user.copyright %]
+# [% var.filename %]
+#
+#################################################################################
+
+#set -o errexit
+#set -o nounset
+#set -o pipefail
+#set -o xtrace
+# disable shell expansion so * is passed to each command
+#set -f
+#declare -r NAME="${0##*/}"
+declare -r NAME="$(basename "${0}")"
+declare -r DIR_NAME="$(cd "$(dirname "${0}")"; echo $(pwd))"
+declare -r FILE_NAME="${DIR_NAME}/${NAME}"
+
+################################################################################
+#
+# Default value options
+#
+#################################################################################
+VERBOSE=0
+DEBUG=0
+
+################################################################################
+#
+# Functions
+#
+#################################################################################
+usage() {
+echo "
+=head1 NAME
+
+${NAME}
+
+=head1 SYNOPSIS
+
+Example shell script with embedded POD documentation
+
+  -v, --verbose
+  --debug        
+  -h, --help      Print this help
+
+=head1 DESCRIPTION
+
+Long description
+
+=head1 SEE ALSO
+
+https://intra.semantico.net/wiki/
+
+=head1 LICENSE
+
+[% user.copyright_laius %]
+
+=head1 AUTHOR
+
+[% user.author %]
+"
+}
+
+err() {
+  exit_code=$1
+  msg=$2
+  echo "ERR: $msg" >&2
+  exit $exit_code
+}
+
+warn() {
+  msg=$1
+  echo "WARN: $msg" >&2
+}
+
+verbose() {
+  msg=$1
+
+  level=$2
+  [ -z "$level" ] && level=1
+  level=$(($level-1))
+
+  [ "$VERBOSE" -gt "$level" ] || return
+
+  echo "VERBOSE: $msg" >&2
+}
+
+#################################################################################
+#
+# Args
+#
+#################################################################################
+#shopt -s extglob
+while [ $# -gt 0 ]; do
+
+  case "$1" in
+
+    -*help|-h) usage | pod2text --width 250; exit 0 ;;
+    --man) usage | pod2man | man -l -; exit 0 ;;
+
+    --verbose|-v) VERBOSE=$(($VERBOSE+1)) ;;
+
+    --debug) DEBUG=$(($DEBUG+1)) ;;
+
+    *) echo "Unknow option: $1 at $0!"; exit -1; ;;
+
+  esac
+  shift
+
+done
+
+#################################################################################
+#
+# Main
+#
+#################################################################################
+echo Hi
+
diff --git a/etc/vim/templates/css.tt b/etc/vim/templates/css.tt
new file mode 100644 (file)
index 0000000..1881e39
--- /dev/null
@@ -0,0 +1,5 @@
+@charset "UTF-8";
+/*
+# [% user.me_now %] - [% user.copyright %]
+# [% var.filename %]
+*/
diff --git a/etc/vim/templates/daemon.tt b/etc/vim/templates/daemon.tt
new file mode 100644 (file)
index 0000000..81fd07f
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+#################################################################################
+#
+# [% user.me_now %] - [% user.copyright %]
+# [% var.filename %]
+#
+#################################################################################
+NAME=`basename "$0"`
+PATH="$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
+PATH="$PATH:/home/www/web-shell"
+cd /home/www/web-shell
+
+DAEMON_NAME="webshell.py"
+DAEMON_OPTIONS=" \
+       -i 127.0.0.1 \
+       -p 8023 \
+       -t xterm-color \
+       --ssl-disable \
+       -u nobody \
+       -d \
+"
+
+function daemon_init {
+       test -z "$DAEMON_LIB" && DAEMON_LIB=`echo "$DAEMON_NAME"|sed -r -e 's/^(.)/\U\1/g' -e 's/\.(\w+)$//'`
+}
+
+function daemon_pid {
+       DAEMON_PID=`pidof -sx $DAEMON_NAME`
+       return $?
+       return `pidof -x $DAEMON_NAME`
+}
+
+function daemon_start {
+       if daemon_pid &> /dev/null; then
+               echo "$DAEMON_LIB is already up"
+               return 2
+       fi
+
+       eval $DAEMON_NAME $DAEMON_OPTIONS
+
+       sleep 1
+       daemon_status || return 1
+       return 0
+}
+
+function daemon_stop {
+       if ! daemon_pid &> /dev/null; then
+               echo "$DAEMON_LIB is already down"
+               return 2
+       fi
+
+       killall $DAEMON_NAME
+
+       sleep 1
+       daemon_status && return 1
+       return 0
+}
+
+function daemon_status {
+       if daemon_pid &> /dev/null; then
+               echo "$DAEMON_LIB is up (pid $DAEMON_PID)"
+               return 0
+       else
+               echo "$DAEMON_LIB is down"
+               return 1
+       fi
+}
+
+daemon_init
+
+case "$1" in
+       start) daemon_start ;;
+
+       stop) daemon_stop ;;
+
+       reload) true ;;
+
+       restart)
+               daemon_stop
+               sleep 2
+               daemon_start
+       ;;
+
+       status) daemon_status ;;
+
+       *)
+               echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
+               exit 1
+       ;;
+
+esac
+
+exit
diff --git a/etc/vim/templates/daemon.tt.bak b/etc/vim/templates/daemon.tt.bak
new file mode 100644 (file)
index 0000000..e3704c2
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+[% programname=input("Program name: ")
+   log4perl=choice('with Log::Log4perl: ', 'no', 'yes')
+-%]
+fetchmail=`which fetchmail`
+
+case "$1" in
+
+'start')
+       if pidof fetchmail &>/dev/null; then
+               echo "Fetchmail is already running"
+               exit 1
+       fi
+       if $fetchmail -f $fetchmailrc; then
+               echo "Fetchmail is up"
+               exit 0
+               else
+               echo "Fetchmail can not start"
+               exit 2
+       fi
+;;
+
+'stop')
+       if !(pidof fetchmail &>/dev/null); then
+               echo "Fetchmail is already down"
+               exit 1
+       fi
+       if $fetchmail -q; then
+               echo "Fetchmail is down"
+               exit 0
+       else
+               echo "Fetchmail can not stop"
+               exit 2
+       fi
+;;
+
+'restart')
+       $0 stop
+       sleep 2
+       $0 start
+;;
+
+'status')
+       if pidof fetchmail &>/dev/null; then
+               echo "Fetchmail is up"
+               exit 0
+       else
+               echo "Fetchmail is down"
+               exit 1
+       fi
+;;
+
+*)
+       echo "usage $0 start|stop|restart|status"
+       exit -1
+;;
+
+esac
+
+exit
diff --git a/etc/vim/templates/html.tt b/etc/vim/templates/html.tt
new file mode 100644 (file)
index 0000000..3fdde28
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+
+       <title>[% var.filename %] - [% user.me_now %]</title>
+
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <link href="" rel="stylesheet" type="text/css" />
+       <script type="text/javascript" src=""></script>
+
+  <meta name="Copyright" content="[% user.copyright %]"/>
+  <meta name="Author" content="[% user.name %]" />
+
+</head>
+
+<body>
+
+       <h1>[% var.filename %] - [% user.me_now %]</h1>
+</body>
+
+</html>
diff --git a/etc/vim/templates/perl.tt b/etc/vim/templates/perl.tt
new file mode 100644 (file)
index 0000000..4a8eed5
--- /dev/null
@@ -0,0 +1,189 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+#################################################################################
+#
+# VERSION
+#
+#################################################################################
+my $VERSION = '0.0.1';
+# [% user.me_now %]
+# - create script
+
+#################################################################################
+#
+# GLOBALS
+#
+#################################################################################
+my ($NAME) = $0 =~ m,([^/]+)$,;
+
+#################################################################################
+#
+# ARGS
+#
+#################################################################################
+my $VERBOSE = $main::VERBOSE = 1;
+my $DEBUG = $main::DEBUG = 0;
+
+my %Opt; get_options(\%Opt);
+help() unless @ARGV;
+$main::_DATA_ = undef;
+
+#################################################################################
+#
+# BEGIN
+#
+#################################################################################
+use Data::Dumper;
+
+#################################################################################
+#
+# END
+#
+#################################################################################
+exit 0;
+
+#################################################################################
+#
+# Functions
+#
+#################################################################################
+sub help {
+#------------------------------------------------------------------------------
+# Print help and exit
+#------------------------------------------------------------------------------
+
+       require 'Pod/Usage.pm' unless $INC{'Pod/Usage.pm'};
+       require 'Pod/Perldoc.pm' unless $INC{'Pod/Perldoc.pm'};
+
+       # Substitutions
+       sub pod_env {
+               my $v = '';
+               eval '$v = ref(\\'.$_[0].') eq "ARRAY" ? join(" ",'.$_[0].') : '.$_[0].'; return defined $v ? $v : qq|UNDEF|;';
+               return $v;
+       }
+
+       $main::_DATA_ =~ s/([@\$][A-Z_]+)/pod_env($1)/eg;
+
+       # Create tmp
+  my $in_file = (-e '/dev/shm' ? '/dev/shm' : '/tmp')."/$NAME.$$";
+  my $in;
+  open($in,">$in_file") or die "$NAME: Can't write into $in_file: $!";
+  print $in $main::_DATA_;
+       close $in;
+
+       # Output
+       open(STDOUT,"|perl -pe 's/\.$$//g'".(($ENV{PAGER}||'') eq 'less' ? "|less -FRi" : ""));
+       my $opts = {
+               -input => $in_file,
+               -ouput => \*STDOUT,
+               -exitval => 'noexit',
+               -sections => [qw(SYNOPSIS DESCRIPTION OPTIONS)],
+               -verbose => ($Opt{'help'} ? 99 : 3),
+       };
+
+       Pod::Usage::pod2usage($opts);
+  close STDOUT;
+  unlink $in_file if $in_file and -e $in_file;
+
+       exit 0;
+}
+
+#------------------------------------------------------------------------------
+# Print version and exit
+#------------------------------------------------------------------------------
+sub version { print "$NAME: version [$VERSION]\n"; exit 0; }
+
+#------------------------------------------------------------------------------
+# Get options from pod
+#------------------------------------------------------------------------------
+sub get_options {
+
+       use Getopt::Long qw(:config no_ignore_case no_auto_abbrev);
+
+       my @Opt;
+
+       sub pod_opt {
+               local $_;
+               my $o = shift;
+               $o =~ s/(=.|[\+\-\!]$)//;
+               $o = join(", ",map{"-$_"} split(/[\|,:;]/,$o));
+               return "$o";
+       }
+
+       while (<DATA>) {
+               s/option\[([^\]]+)\]/push(@Opt,$1) and pod_opt($1)/eg;
+               $main::_DATA_ .= $_;
+       }
+
+       GetOptions($_[0],@Opt) || exit -1;
+
+       help() if $_[0]{'help'} or $_[0]{'man'};
+       version() if $_[0]{'version'};
+
+       $main::VERBOSE = $VERBOSE = $_[0]{'verbose'} if defined $_[0]{'verbose'};
+       $main::DEBUG = $DEBUG = $_[0]{'debug'} if defined $_[0]{'debug'};
+
+}
+
+__DATA__
+
+=head1 NAME
+
+$NAME - Script to do ...
+
+=head1 SYNOPSIS
+
+Quick usage:
+
+=over
+
+=item $NAME --verbose
+
+=item $NAME --help
+
+=back
+
+=head1 DESCRIPTION
+
+...
+
+=head1 OPTIONS
+
+=over 2
+
+=item B<option[verbose|v+]> Verbose mode: increase the verbosity level.
+
+=item B<option[debug+]>        Debug mode: increase the verbosity level.
+
+=item B<option[version|V]>  Print version (default: $VERSION)
+
+=item B<option[help|h|?]> Print a brief help message and exits.
+
+=item B<option[man]>          Prints the manual page and exits.
+
+=back
+
+=cut
+
+=head1 EXAMPLES
+
+...
+
+=head1 REQUIRES
+
+Getopt::Std, Pod::Usage
+
+=head1 COPYRIGHT AND LICENSE
+
+[% user.copyright_laius %]
+
+=head1 SEE ALSO
+
+perl(1), http://perldoc.perl.org/perlpodstyle.html
+
+=head1 AUTHOR
+
+[% user.author %]
+
+=cut
diff --git a/etc/vim/templates/php.tt b/etc/vim/templates/php.tt
new file mode 100644 (file)
index 0000000..559ec13
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env php
+<?php
+/**
+* @copyright [% user.copyright %]
+* @author [% user.author %]
+*
+* [% var.filename %]
+*/
+
+echo '<?xml version="1.0" encoding="utf-8"?>';
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+
+       <title></title>
+
+       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <link href="" rel="stylesheet" type="text/css" />
+       <script type="text/javascript" src=""></script>
+
+</head>
+
+<body>
+
+</body>
+
+</html>
diff --git a/etc/vim/templates/puppet.tt b/etc/vim/templates/puppet.tt
new file mode 100644 (file)
index 0000000..8868bb2
--- /dev/null
@@ -0,0 +1,81 @@
+# = Class: example_class
+#
+# Full description of class example_class here.
+#
+# == Parameters
+#
+# Document parameters here.
+#
+# [*ntp_servers*]
+#   Explanation of what this parameter affects and what it defaults to.
+#   e.g. "Specify one or more upstream ntp servers as an array."
+#
+# == Variables
+#
+# Here you should define a list of variables that this module would require.
+#
+# [*enc_ntp_servers*]
+#   Explanation of how this variable affects the funtion of this class and if it
+#   has a default. e.g. "The parameter enc_ntp_servers must be set by the
+#   External Node Classifier as a comma separated list of hostnames." (Note,
+#   global variables should not be used in preference to class parameters  as of
+#   Puppet 2.6.)
+#
+# == Examples
+#
+#  class { 'example_class':
+#    ntp_servers > [ 'pool.ntp.org', 'ntp.local.company.com' ]
+#  }
+#
+# == Authors
+#
+# [% user.author %]
+#
+# == Copyright
+#
+# [% user.copyright %]
+#
+class example_class {
+  $class_infos = sem('class_infos')
+  $head_comment = sem('head_comment')
+
+}
+
+# = Define: example_resource
+#
+# Full description of defined resource type example_resource here.
+#
+# == Parameters
+#
+# Document parameters here
+#
+# [*namevar*]
+#   If there is a parameter that defaults to the value of the title string
+#   when not explicitly set, you must always say so.  This parameter can be
+#   referred to as a "namevar," since it's functionally equivalent to the
+#   namevar of a core resource type.
+#
+# [*basedir*]
+#   Description of this variable.  For example, "This parameter sets the
+#   base directory for this resource type.  It should not contain a trailing
+#   slash."
+#
+# == Examples
+#
+# Provide some examples on how to use this type:
+#
+#   example_class::example_resource { 'namevar':
+#     basedir > '/tmp/src',
+#   }
+#
+# == Authors
+#
+# [% user.author %]
+#
+# == Copyright
+#
+# [% user.copyright %]
+#
+define example_class::example_resource($basedir) {
+
+}
diff --git a/etc/vim/templates/sh.tt b/etc/vim/templates/sh.tt
new file mode 120000 (symlink)
index 0000000..017553f
--- /dev/null
@@ -0,0 +1 @@
+bash.tt
\ No newline at end of file
diff --git a/etc/vim/templates/sql.tt b/etc/vim/templates/sql.tt
new file mode 100644 (file)
index 0000000..7901400
--- /dev/null
@@ -0,0 +1,12 @@
+--
+-- @copyright [% user.copyright %] # [% user.me_now %]
+-- [% var.filename %]
+--
+SELECT
+
+1
+
+WHERE
+       1=1
+
+;
diff --git a/etc/vim/view/=+usr=+share=+vim=+vim72=+doc=+options.txt= b/etc/vim/view/=+usr=+share=+vim=+vim72=+doc=+options.txt=
new file mode 100644 (file)
index 0000000..5c9052d
--- /dev/null
@@ -0,0 +1,104 @@
+let s:so_save = &so | let s:siso_save = &siso | set so=0 siso=0
+argglobal
+setlocal keymap=
+setlocal noarabic
+setlocal autoindent
+setlocal nobinary
+setlocal bufhidden=
+setlocal nobuflisted
+setlocal buftype=help
+setlocal nocindent
+setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
+setlocal cinoptions=
+setlocal cinwords=if,else,while,do,for,switch
+setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+setlocal commentstring=/*%s*/
+setlocal complete=.,w,b,u,t,i
+setlocal completefunc=
+setlocal nocopyindent
+setlocal nocursorcolumn
+setlocal nocursorline
+setlocal define=
+setlocal dictionary=
+setlocal nodiff
+setlocal equalprg=
+setlocal errorformat=
+setlocal noexpandtab
+if &filetype != 'help'
+setlocal filetype=help
+endif
+setlocal foldcolumn=0
+setlocal nofoldenable
+setlocal foldexpr=0
+setlocal foldignore=#
+setlocal foldlevel=0
+setlocal foldmarker={{{,}}}
+setlocal foldmethod=manual
+setlocal foldminlines=1
+setlocal foldnestmax=20
+setlocal foldtext=foldtext()
+setlocal formatexpr=
+setlocal formatoptions=tcql
+setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
+setlocal grepprg=
+setlocal iminsert=0
+setlocal imsearch=0
+setlocal include=
+setlocal includeexpr=
+setlocal indentexpr=
+setlocal indentkeys=
+setlocal noinfercase
+setlocal iskeyword=!-~,^*,^\16|,^\",192-255
+setlocal keywordprg=
+setlocal nolinebreak
+setlocal nolisp
+setlocal nolist
+setlocal makeprg=
+setlocal matchpairs=(:),{:},[:]
+setlocal nomodeline
+setlocal nomodifiable
+setlocal nrformats=octal,hex
+setlocal nonumber
+setlocal numberwidth=4
+setlocal omnifunc=
+setlocal path=
+setlocal nopreserveindent
+setlocal nopreviewwindow
+setlocal quoteescape=\\
+setlocal readonly
+setlocal norightleft
+setlocal rightleftcmd=search
+setlocal noscrollbind
+setlocal shiftwidth=3
+setlocal noshortname
+setlocal nosmartindent
+setlocal softtabstop=0
+setlocal nospell
+setlocal spellcapcheck=[.?!]\\_[\\])'\"\       \ ]\\+
+setlocal spellfile=
+setlocal spelllang=en
+setlocal statusline=
+setlocal suffixesadd=
+setlocal swapfile
+setlocal synmaxcol=3000
+if &syntax != 'help'
+setlocal syntax=help
+endif
+setlocal tabstop=8
+setlocal tags=
+setlocal textwidth=0
+setlocal thesaurus=
+setlocal nowinfixheight
+setlocal nowinfixwidth
+setlocal wrap
+setlocal wrapmargin=0
+silent! normal! zE
+let s:l = 7286 - ((22 * winheight(0) + 11) / 23)
+if s:l < 1 | let s:l = 1 | endif
+exe s:l
+normal! zt
+7286
+normal! 019l
+let &so = s:so_save | let &siso = s:siso_save
+doautoall SessionLoadPost
+" vim: set ft=vim :
diff --git a/etc/vim/vim-shortcurts b/etc/vim/vim-shortcurts
new file mode 100644 (file)
index 0000000..2aa1b2f
--- /dev/null
@@ -0,0 +1,741 @@
+#!/usr/bin/env bash
+#################################################################################
+#
+# NB 21.10.11
+#
+# Script to use in ~/.vimrc
+#
+# Vim: escape: s/\([\`\$\\]\)/\\\1/g
+# Vim: functions: r!perl -ne 'print "$1\n" if /^function (.*)_\w+\s*$/' %
+#
+#
+# SEE ALSO:
+#
+# Functions: http://vimdoc.sourceforge.net/htmldoc/eval.html#functions
+# Functions: http://vim.wikia.com/wiki/Write_your_own_Vim_function
+# MappingKeys: http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_1%29
+# Nav: http://www.thegeekstuff.com/2009/03/8-essential-vim-editor-navigation-fundamentals/
+# Toc: http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
+#
+#################################################################################
+#exec echo "DEBUG:$@"
+#exec echo -n '#'
+
+##################################################################################
+#
+# Globals
+#
+#################################################################################
+ME="NB"
+COPYRIGHT="(C) $YEAR Nicolas Boisselier"
+
+TAG="_THERE_"
+TYPES="all|php|perl|bash|sh|vim|ini|sql|xml|html"
+
+YEAR=$(date +\%Y)
+NOW=$(date +\%d.\%m.\%y)
+
+ME_NOW="$ME $NOW"
+#COPYRIGHT_LAIUS="This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself."
+#Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed
+#This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
+COPYRIGHT_LAIUS="Copyright $COPYRIGHT
+
+This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+See <http://www.gnu.org/licenses/>."
+#echo $FILE;
+
+NAME=`echo $0 | sed 's,^.*/,,'`
+
+##################################################################################
+#
+#
+# Functions
+#
+#
+#################################################################################
+
+#################################################################################
+#
+# Functions - Internal / ALL_*
+#
+#################################################################################
+function all_list { # all_l
+perl -ne '
+       next unless ($_,$o) = (/^function\s+(\w+)\s+\{(?:\s*#\s*(\S+))?/);
+       /^(all_|_|foo)/ and next;
+       @_ = /^((?:('$TYPES')_)?(.*?))\s*$/;
+       push(@f,[$1, ($2||""), ($2 ? $3 : ""), ($o ? $o : "")]);
+       END {
+               @f = sort {
+                       ($a->[1] cmp $b->[1])
+                       || ($a->[0] cmp $b->[0])
+               } @f;
+               print map {join("\t",@$_)."\n"} @f;
+       }
+' $0;
+}
+
+function all_comment_new {
+       printf '%s' "`${1}_comment_char` $TAG - $ME_NOW"
+}
+
+function all_comment_line {
+       #printf '%s ' "`${1}_comment_char`"
+       #set|grep _comment_char
+       printf '%s ' "`${1}_comment_char` $ME_NOW"
+}
+
+function all_comment_line_toggle {
+       #declare e="`${1}_comment_char` $ME_NOW"
+       declare e="`all_comment_line $1`"
+       perl -pe 's/^/zaza/'
+       #perl -pe '$e=qq|'"$e"'|; s/^\Q$e\E// or s/^/$e/'
+       #printf '%s ' "`${1}_comment_char`"
+       #printf '%s ' "`${1}_comment_char` $ME_NOW"
+}
+
+function all_inputlist {
+       list=`all_list`
+
+       i=0
+       for l in $list; do
+               i=$(($i+1));
+               echo " [$i] - $l"
+       done
+
+}
+
+function all_choose {
+       declare r list fct
+
+       #list=`help noexit | perl -ne 'next if /^Usage/m ... /\s*\n$/m; s/^(\s+)\-/"  [".($i++ + 1)."] -"/egm; s/xxx_/auto_/; print'`
+       list=`help noexit | perl -ne 'next if /^Usage/m ... /\s*\n$/m; s/^(\s+)\-/"  ".($i++ + 1)."."/egm; s/xxx_/auto_/; print'`
+
+       printf "%s\n\n" "$list"
+return
+       read -e -p "Wich number ? : " -t 20  r
+
+       test "$r" -gt "0" &>/dev/null || exit 1
+
+       fct=`echo "$list"|perl -ne '/^\s*\['$r'\] -\s*(.*)\s*$/ and print "$1\n" and last'`
+       test -z "$fct" && exit 1
+
+       echo $fct
+exit
+}
+
+
+function help {
+all_list|perl -e ' @all = map{chomp($_); [split(/\t/,$_)] } <>;
+use Data::Dumper;
+#warn Dumper \\@all;
+print "Usage: '$NAME' [-help] [ACTION] [PARAMS]\n";
+
+print "\nCommun Functions:\n",map("\t- ".$_->[0]."\n",grep{!$_->[1]} @all);
+
+my @lang = sort grep{$_ and !$lang{$_}++} map{$_->[1]} @all;
+my @fct = sort grep{$_ and !$fct{$_}++} map{$_->[2]} @all;
+my $col = 1
+   + (( sort{$a<$b} map {length($_)} @lang ))[0]
+   + (( sort{$a<$b} map {length($_)} @fct ))[0]
+;
+#print "$col\n";
+
+my $fmt = "| %-${col}s ";
+#$fmt = "| %s";
+
+print "\nLangage/Type file Functions\n"
+   ,"\n"
+   ,"\tTypes: ".join(", ",@lang)."\n"
+   ,"\tFunctions: ".join(", ",map{"auto_$_ FILE"}@fct)."\n"
+   ,"\n"
+       #,map{"\t- xxx_".$_."\n"} @fct
+;
+
+for my $f (@fct) {
+   for my $l (@lang) {
+      printf("$fmt",$l."_".$f);
+   }
+   print " |\n";
+}
+
+#print "\nActions: ".join(", ",map{"xxx_".$_->[2]} grep{$_->[2] and !$t{$_->[3]}++} @all)."\n";
+' 2>&1
+[ "$1" == "noexit" ] && return
+exit
+}
+
+function all_err {
+       echo "$0: ERR: $1" 1>&2
+       exit 1
+}
+
+
+#################################################################################
+#
+# Functions - Generics
+#
+#################################################################################
+function me_now { echo "$ME_NOW"; }
+
+function file_type {
+
+       [ -z "$1" ] && all_err "Usage: file_type FILE"
+
+       #
+       # By name
+       #
+       case $1 in
+
+               *.bash|*.sh|*procmail*|*mutt*|*.conf|*my.cnf) echo sh; return ;;
+
+               *.pm|*.pl) echo perl; return ;;
+
+               *.ini) echo ini; return ;;
+
+               *.php|*.inc|*.css|*.js|*named.conf*) echo php; return ;;
+
+               *.sql) echo sql; return ;;
+
+               *vimrc*) echo vim; return ;;
+
+               *.cfg*) echo ini; return ;;
+
+       esac
+
+       #
+       # By Ext
+       #
+       [ -e "$1" ] || return 1
+       [ -e "$1" ] || all_err "file_type can't find $1"
+       type=`file --dereference -b $1`
+
+       case $type in
+
+               sql) echo sql ;;
+
+               xml|*XML*document*) echo xml ;;
+
+               sgml|*SGML*document*) echo sgml ;;
+
+               html|htm|*HTML*document*) echo html ;;
+
+               *"perl"*|pl|pm) echo perl ;;
+
+               *"php"*|*[pP][hH][pP]*script*) echo php ;;
+
+               *"bash"*|"Bourne-Again shell script text executable"|sh|*"shell script ttype executable"*) echo bash ;;
+
+               txt|*ASCII*ttype) echo txt ;;
+
+               *)
+                       if false && test -x "$1"; then
+                               echo "sh"
+                       else
+                               echo "$type"
+                       fi
+               ;;
+
+       esac;
+
+}
+
+function all_file_short {
+       FILE_SHORT="$FILE"
+       [ -z "$IZI_ROOT_DIR" ] || FILE_SHORT=`echo "$FILE_SHORT"|sed "s@^$IZI_ROOT_DIR@~izideal@"`
+       TYPE=`file_type $FILE`
+}
+
+function include_template {
+   declare file=$1
+   test -e "$file" || return 1
+
+               if test -e "$FILE"; then # && ! test -x "$FILE"; then
+
+                       ch=`chmod -v +x "$FILE" 2>&1`
+         [ -z "$ch" ] || echo "# $ch"
+
+                       #echo "# Todo: chmod -v +x $FILE"
+               fi
+
+#exec echo ">>DEBUG $@"
+   sed \
+      -e "s/\\t/\\t/g" \
+      -e "s^<FILE>^$FILE_SHORT^g" \
+      -e "s^.auto_file^$FILE^g" \
+      -e "s^.me_now.^$ME_NOW^g" \
+      -e "s^<\(WHO\|ME\)>^$ME^g" \
+      -e "s^<\(NOW\|DATE\)>^$NOW^g" \
+      -e "s^<COPYRIGHT>^$COPYRIGHT^g" \
+   "$file" | perl -pe "\$s=qq|$COPYRIGHT_LAIUS|; s^<COPYRIGHT_LAIUS>^\$s^g"
+   return 0
+}
+
+# Hello
+
+function izi_2globales {
+#if [ $# -gt 0 ]; then
+#fi
+   false && perl -pe \
+      'for (@ARGV) {' \
+      '}' \
+      'BEGIN {@RGV = map {-e $_ ? $_ : ""} @ARGV;};' \
+      's/\$(GLOB|Page|ADMIN_USER|SEARCH_PAGE_NAME|DB_CON|MEMORY_DEBUG|TRANSLATIONS)/\$GLOBALS[$1]/g' \
+   $@
+   true && echo -e "$@" | sed -e \
+   's/\$\(GLOB\|Page\|ADMIN_USER\|SEARCH_PAGE_NAME\|DB_CON\|MEMORY_DEBUG\|TRANSLATIONS\)/\$GLOBALS[\1]/g'
+
+}
+
+#################################################################################
+#
+# Functions - ALL_
+#
+#################################################################################
+##################################################################################
+#
+# Functions - TYPE_
+#
+#################################################################################
+
+##################################################################################
+#
+# Functions - XML_
+#
+#################################################################################
+
+function xml_comment_char {
+       html_comment_char
+}
+
+function xml_comment_new {
+       html_comment_new
+}
+
+function xml_comment_line {
+       html_comment_line
+}
+
+function xml_create {
+       html_create
+}
+
+#################################################################################
+#
+# Functions - HTML_
+#
+#################################################################################
+
+function html_comment_char {
+       printf '%s' "<!-- -->"
+}
+
+function html_comment_new {
+       printf '%s ' "<!-- $ME_NOW - $TAG -->"
+}
+
+function html_comment_line {
+       html_comment_new
+}
+
+function html_create {
+       include_template /home/bin/default.html || cat << EOF
+cat << EOF
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+       <head>
+               <title></title>
+               <meta name="author" content="$ME" />';
+               <meta name="copyright" content="Nicolas Boisselier" />';
+       </head>
+       <body></body>
+</html>
+EOF
+}
+
+##################################################################################
+#
+# Functions - PERL_
+#
+#################################################################################
+
+function perl_comment_new {
+       all_comment_new perl
+}
+
+function perl_comment_line {
+       all_comment_line perl
+}
+
+function perl_create {
+       include_template /home/bin/default.pl || cat << EOF
+cat << EOF
+#!/usr/bin/perl -w
+#################################################################################
+#
+# $ME_NOW
+#
+#################################################################################
+use strict;
+EOF
+}
+
+function perl_comment_char {
+printf '%s' "#"
+}
+
+function perl_function_new {
+cat << EOF
+sub foo {
+#------------------------------------------------------------------------------
+# $ME_NOW
+#------------------------------------------------------------------------------
+}
+EOF
+}
+
+#################################################################################
+#
+# Functions - SQL_
+#
+#################################################################################
+
+function sql_comment_new {
+       all_comment_new sql
+}
+
+function sql_comment_line {
+       all_comment_line sql
+}
+
+function sql_create {
+cat << EOF
+/*
+$ME_NOW
+*/
+EOF
+}
+
+function sql_comment_char {
+printf '%s' "--"
+}
+
+function sql_function_new {
+cat << EOF
+
+/*
+$ME_NOW
+**/
+DELIMITER //
+DROP FUNCTION IF EXISTS url2idaffi;
+CREATE FUNCTION url2idaffi(purl text)
+RETURNS text DETERMINISTIC
+BEGIN
+RETURN (SELECT id FROM affi WHERE purl REGEXP download_regex LIMIT 1);
+END//
+DELIMITER ;
+}
+EOF
+}
+
+#################################################################################
+#
+# Functions - INI_
+#
+#################################################################################
+
+function ini_comment_new {
+       all_comment_new ini
+}
+
+function ini_comment_line {
+       all_comment_line ini
+}
+
+function ini_function_new {
+cat << EOF
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;$ME_NOW
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+[foo]
+EOF
+}
+
+function ini_comment_char {
+printf '%s' ";"
+}
+
+function ini_create {
+cat << EOF
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; $ME_NOW
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+EOF
+}
+
+#################################################################################
+#
+# Functions - PHP_
+#
+# See: http://manual.phpdoc.org/HTMLSmartyConverter/PHP/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblock
+#
+#################################################################################
+
+function php_comment_new {
+       all_comment_new php
+}
+
+function php_comment_line {
+       all_comment_line php
+}
+
+function php_function_new {
+cat << EOF
+/**
+* @copyright $ME $NOW
+* Php Function Template
+*
+* @param datatype1|datatype2 \$paramname description
+* @return datatype1|datatype2 description
+*/
+function foo() {
+}
+EOF
+}
+
+function php_comment_char {
+printf '%s' "//"
+}
+
+function php_create {
+cat << EOF
+#!/usr/bin/env php
+<?php
+/**
+* @copyright $COPYRIGHT # $ME $NOW
+* $FILE_SHORT
+*/
+
+?>
+EOF
+}
+
+#################################################################################
+#
+# Functions - VIM_
+#
+#################################################################################
+
+function vim_create {
+       cat << EOF
+#################################################################################
+#
+# $ME_NOW
+# $FILE
+#
+#################################################################################
+EOF
+}
+
+function vim_comment_new {
+       all_comment_new vim
+}
+
+function vim_comment_line {
+       all_comment_line vim
+}
+
+function vim_comment_char {
+       printf '%s' '"'
+}
+
+function vim_function_new {
+#`vim_comment_char` $ME_NOW
+cat << EOF
+function foo(...)
+endfunction
+EOF
+}
+
+#################################################################################
+#
+# Functions - BASH_
+#
+#################################################################################
+
+function bash_comment_new {
+       all_comment_new bash
+}
+
+function bash_comment_line {
+       all_comment_line bash
+}
+
+function bash_comment_char {
+   printf '%s' '#'
+}
+
+function bash_create { # bash_c
+       include_template /home/bin/default.sh || cat << EOF
+#!/usr/bin/env bash
+#################################################################################
+#
+# $ME_NOW
+# $FILE
+#
+#################################################################################
+NAME=\`echo $0 | sed "s,^.*/,,"\`
+EOF
+}
+
+function bash_function_new {
+cat << EOF
+function foo {
+#------------------------------------------------------------------------------
+# $ME_NOW
+#------------------------------------------------------------------------------
+}
+EOF
+
+}
+
+#################################################################################
+#
+# Main - 
+#
+#################################################################################
+
+# $GLOB['zaza'];
+
+#exec echo "$@"
+
+
+#################################################################################
+#
+# Args
+#
+#################################################################################
+CMD=$1
+shift
+ARGS=$@
+FILE="$0"
+
+[ -z "$CMD" ] && help
+
+all_file_short
+#[ -e "$1" ] && TYPE=`file_type $1`
+declare eval='
+case "$CMD" in
+       help|h|-h|-help)  help ;;
+       all_*) ${CMD} ${ARGS} ;;
+       # Types file
+       auto_*) # Usage auto_* FILE [option1, option2, ...]
+               if false && [ -z "$1" ]; then
+                       $CMD $ARGS
+                       continue
+               fi
+
+               TYPE=`file_type $1`
+               FILE="$1" && all_file_short
+               shift
+
+               case "$TYPE" in
+                       sh) TYPE=bash;;
+                       txt) TYPE=bash;;
+                       '$TYPES') ;;
+                       *)
+                               if test -x "$FILE" &>/dev/null; then
+                                       TYPE=bash
+                               else
+                                       all_err "Unknow file type: $TYPE ($TYPES)"
+                               fi
+                       ;;
+               esac
+               CMD=`echo "$CMD"|sed s/^auto/$TYPE/`
+               ARGS=$@
+
+               case "$CMD" in
+                       *_comment_line_toggle) all_comment_line_toggle $TYPE $ARGS ;;
+                       *) $CMD $ARGS ;;
+               esac
+       ;;
+'
+
+# Functions
+for f in `all_list |awk '{print $1}'`; do
+       eval="$eval
+       $f) $f \$ARGS ;;"
+done
+
+eval="$eval"'
+       -D|debug) echo "$eval" ;;
+       *) all_err "Unknow command: $CMD" ;;
+esac
+'
+eval "$eval"
+exit
+
+# TODEL - NB 09.08.12
+false && $CMD $ARGS|perl -e 'chomp($_=join("",<>)); s/^\s*(.*?)\s*$/$1/; print'
+#exec echo "$eval"
+case "$CMD" in
+
+       -D|debug)  exec echo "$eval"; all_list |awk '{print $1}';;
+       help|h|-h|-help)  help ;;
+
+       # Commun
+
+       all_*) ${CMD} ${ARGS} ;;
+
+       me_now) me_now $ARGS ;;
+
+       file_type) file_type $ARGS ;;
+
+       izi_2globales) ${CMD} ${ARGS} ;;
+
+       include_template) exec echo ${CMD} ${ARGS} ;;
+
+       # Types file
+       auto_*) # Usage auto_* FILE [option1, option2, ...]
+               if true || [ -e "$1" ]; then
+                       TYPE=`file_type $1`
+                       FILE="$1" && all_file_short
+               fi
+               shift
+
+               eval "
+               case \"$TYPE\" in
+                       sh) TYPE=bash;;
+                       txt) TYPE=bash;;
+                       $TYPES) ;;
+                       *)
+                               if test -x \"$FILE\" &>/dev/null; then
+                                       TYPE=bash
+                               else
+                                       all_err \"Unknow file type: $TYPE ($TYPES)\"
+                               fi
+                       ;;
+               esac
+               "
+               CMD=`echo "$CMD"|sed s/^auto/$TYPE/`
+               ARGS=$@
+
+               $CMD $ARGS|perl -e 'chomp($_=join("",<>)); s/^\s*(.*?)\s*$/$1/; print'
+       ;;
+
+
+       *_c) _comment_new $ARGS ;;
+       *_comment_new) $CMD $ARGS ;;
+       *_comment_line) $CMD $ARGS ;;
+       *_comment_char) $CMD $ARGS ;;
+       *_create) $CMD $ARGS ;;
+       *_function_new) $CMD $ARGS ;;
+
+       *) all_err "Unknow command: $CMD" ;;
+
+esac
diff --git a/etc/vim/vim-shortcurts-stdin b/etc/vim/vim-shortcurts-stdin
new file mode 100644 (file)
index 0000000..795a709
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+BEGIN {
+       ($VIM) = $0 =~ m,^(.*)-stdin$,;
+       #$CMD = shift;
+       %EXP = (
+               'globals' => ''
+       );
+       @LIST = `$VIM all_list`;
+}
+#die @LIST;
+#s/\$\(GLOB\|Page\|ADMIN_USER\|SEARCH_PAGE_NAME\|DB_CON\|MEMORY_DEBUG\|TRANSLATIONS\)/\$GLOBALS[\1]/g
+
+#my 
+#open(VIM,"
+@IN = <>;
+#while (<>) { warn $_; }
+
+$i=1;
+print map { "[".($i++)."] $_" } @LIST;
+print "Enter your name and press [ENTER]: ";
+$i=<>;
+$CMD = $LIST[$i-1];
+die "$VIM:$CMD";
+
+open(VIM,"| $VIM all_stdin $CMD");
+
+foreach (@IN) {
+       print VIM $_;
+}
+
diff --git a/etc/vim/vim-shortcurts.new b/etc/vim/vim-shortcurts.new
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/etc/vim/vim-template-0.3.0.zip b/etc/vim/vim-template-0.3.0.zip
new file mode 100644 (file)
index 0000000..c3f57ea
Binary files /dev/null and b/etc/vim/vim-template-0.3.0.zip differ
diff --git a/etc/vim/vimplate-dump b/etc/vim/vimplate-dump
new file mode 100644 (file)
index 0000000..0ab5e11
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+require $ENV{HOME}.'/.vimplaterc';
+
+
+print map {
+       $v=$Config::user->{nico}{$_};
+       $v=~ s/\n/\\n/g;
+       $v=~ s/(')/\\$1/g;
+
+       "let g:File['$_'] = ".qq|'$v'\n|;
+
+} keys %{ $Config::user->{nico} }