From d2c9f4a86016f88a3f7b6446a216f47c6a69bb77 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 18 Jun 2010 10:49:18 -0700 Subject: [PATCH 1/2] experiment with new modeline --- vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/vimrc b/vimrc index 14363db..41cfab0 100644 --- a/vimrc +++ b/vimrc @@ -110,6 +110,7 @@ set laststatus=2 set shortmess=atI if has('statusline') set statusline=Editing:\ %r%t%m\ %=Location:\ Line\ %l/%L\ \ Col:\ %c\ (%p%%) + set statusline=%<%F\ %r[%{&ff}]%y%m\ %=\ Line\ %l\/%L\ Col:\ %c\ (%P) endif " Enable modelines only on secure vim From 39bf75e8997df55006129993f60c8a7d14d87a27 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 18 Jun 2010 13:16:20 -0700 Subject: [PATCH 2/2] freebsd.vim, for style9, noweb.vim for noweb --- vim/plugin/freebsd.vim | 66 +++++++++++++++++++++++++++++ vim/syntax/noweb.vim | 96 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 vim/plugin/freebsd.vim create mode 100644 vim/syntax/noweb.vim diff --git a/vim/plugin/freebsd.vim b/vim/plugin/freebsd.vim new file mode 100644 index 0000000..889e279 --- /dev/null +++ b/vim/plugin/freebsd.vim @@ -0,0 +1,66 @@ +" Copyright (c) 2007-2008 Sean C. Farley +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or without +" modification, are permitted provided that the following conditions +" are met: +" 1. Redistributions of source code must retain the above copyright +" notice, this list of conditions and the following disclaimer, +" without modification, immediately at the beginning of the file. +" 2. Redistributions in binary form must reproduce the above copyright +" notice, this list of conditions and the following disclaimer in the +" documentation and/or other materials provided with the distribution. +" +" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +" +" $FreeBSD: src/tools/tools/editing/freebsd.vim,v 1.2 2008/07/30 03:34:23 scf Exp $ + +" This is a plugin for Vim (tested with Vim v7.1) to follow the FreeBSD style(9) +" indentation. It registers a macro (see below) for changing a buffer's +" indentation rules but does not change the indentation of existing code. + +" Load only once. +if exists('loaded_FreeBSD') + finish +endif +let loaded_FreeBSD = 1 + +" FreeBSD mapping to switch current buffer to style(9). This is generally '\f'. +nmap f :call FreeBSD_Style() + + +" Ignore indents caused by parentheses in FreeBSD style. +function! IgnoreParenIndent() + let indent = cindent(v:lnum) + + if indent > 4000 + if cindent(v:lnum - 1) > 4000 + return indent(v:lnum - 1) + else + return indent(v:lnum - 1) + 4 + endif + else + return (indent) + endif +endfun + +" Follow the FreeBSD style(9). +function! FreeBSD_Style() + setlocal cindent + setlocal cinoptions=(4200,u4200,+0.5s,*500,:0,t0,U4200 + setlocal indentexpr=IgnoreParenIndent() + setlocal indentkeys=0{,0},0),:,0#,!^F,o,O,e + setlocal noexpandtab + setlocal shiftwidth=8 + setlocal tabstop=8 + setlocal textwidth=80 +endfun diff --git a/vim/syntax/noweb.vim b/vim/syntax/noweb.vim new file mode 100644 index 0000000..e169fef --- /dev/null +++ b/vim/syntax/noweb.vim @@ -0,0 +1,96 @@ + +" Vim syntax file +" Language: NOWEB +" Author: Xun GONG , Dirk Baechle +" Date: 2008-01-26 +" Version: 1.2 +" Derived from: cweb.vim by Andreas Scherer + +" History +" +" v1.2: Major revision, fixed bug with modern "tex.vim" +" v1.1: Corrected `current_syntax = "noweb"' to +" `current_syntax = "nw"' +" +" v1.0: Initial version + +" NOWEB is a collection of tools for "Literate Programming". +" Unlike WEB or CWEB it is not bound to a specific programming +" language like PASCAL or C. +" For more informations about NOWEB, the sources or binary distributions +" have a look at +" +" http://www.eecs.harvard.edu/~nr/noweb +" + +" For informations about "Literate Programming" in general +" +" http://www.literateprogramming.com +" +" could be a place to start. +" + +" Remove any old syntax stuff hanging around +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + + +" Like in CWEB, a NOWEB source file is treated as a TeX file +" including code chunks in between. +if version < 600 + source :p:h/tex.vim +else + runtime! syntax/tex.vim + unlet b:current_syntax +endif + +syntax include @nowebIncludedC syntax/c.vim +unlet b:current_syntax +syntax include @nowebIncludedCpp syntax/cpp.vim +unlet b:current_syntax +syntax include @nowebIncludedOcaml syntax/ocaml.vim +unlet b:current_syntax +syntax include @nowebIncludedMakefile syntax/make.vim +unlet b:current_syntax +syntax include @nowebIncludedConf syntax/conf.vim +unlet b:current_syntax + +" The reference to a chunk of code in another code chunk. +syntax match nowebCodeRef contained /<<.>>\|<<[^ ].*[^ ]>>/ + +" The code text within a code chunk. +syntax region nowebCodeBody contained start=/>>=.\|>>=$/lc=3 end=/^@ \|^@$/me=e-3 contains=nowebCodeRef + +syn region nowebTT start="\[\["hs=s+2 end="\]\]"he=e-2 +syn region nowebXX start="|"hs=s+1 end="|"he=e-1 +syn region nowebName start="<<" end=">>" oneline contains=nowebTT + +" NOWEB code chunks are defined by <>= +" and ended by the next "@" (not a "@@"!) in the first column of a line. +syntax region nowebCode start=/<<.>>=\|<<[^ ].*[^ ]>>=/ end=/^@ \|^@$/me=e-3 contains=@nowebIncludedConf, nowebName containedin=tex.*Zone +syntax region nowebCode start=/<<[^ ].*\.\(c\|h\)>>=/ end=/^@ \|^@$/me=e-3 contains=@nowebIncludedC, nowebName containedin=tex.*Zone +syntax region nowebCode start=/<<[^ ].*\.\(ml\|mli\)>>=/ end=/^@ \|^@$/me=e-3 contains=@nowebIncludedOcaml, nowebName containedin=tex.*Zone +syntax region nowebCode start=/<<[^ ].*\.\(cc\|cpp\|C\)>>=/ end=/^@ \|^@$/me=e-3 contains=@nowebIncludedCpp, nowebName containedin=tex.*Zone +syntax region nowebCode start=/<>=/ end=/^@ \|^@$/me=e-3 contains=@nowebIncludedMakefile, nowebName containedin=tex.*Zone + +" Here, we mark the beginning of a new text chunk. +" syntax match nowebStartText /<<.>>=\|<<[^ ].*[^ ]>>=/ +syntax match nowebStartText /^@ \|^@$/ + +if !exists("did_noweb_syntax_inits") + let did_noweb_syntax_inits = 1 + " The default methods for highlighting. Can be overridden later. + hi link nowebCodeRef Type + hi link nowebCodeBody Comment + hi link nowebStartText Constant + hi def link nowebTT Constant + hi def link nowebXX Constant + hi def link nowebName Type +endif + +let b:current_syntax = "noweb" + +" vim: ts=8