614694ef009f

vim: cram stuff
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 26 Sep 2010 20:30:44 -0400
parents a4cd3c666a79
children 13a772b92155
branches/tags (none)
files vim/.vimrc vim/syntax/cram.vim

Changes

--- a/vim/.vimrc	Sun Sep 26 18:28:43 2010 -0400
+++ b/vim/.vimrc	Sun Sep 26 20:30:44 2010 -0400
@@ -234,6 +234,8 @@
 
 " Cram tests
 au BufNewFile,BufRead *.t set filetype=cram
+let cram_fold=1
+autocmd Syntax cram setlocal foldlevel=1
 
 if has('gui_running')
     set guifont=Menlo:h12
--- a/vim/syntax/cram.vim	Sun Sep 26 18:28:43 2010 -0400
+++ b/vim/syntax/cram.vim	Sun Sep 26 20:30:44 2010 -0400
@@ -4,6 +4,12 @@
 "
 " Add the following line to your ~/.vimrc to enable:
 " au BufNewFile,BufRead *.t set filetype=cram
+"
+" If you want folding you'll need the following line as well:
+" let cram_fold=1
+"
+" You might also want to set the starting foldlevel for Cram files:
+" autocmd Syntax cram setlocal foldlevel=1
 
 if exists("b:current_syntax")
   finish
@@ -12,7 +18,7 @@
 syn include @Shell syntax/sh.vim
 
 syn match cramComment /^[^ ].*$/
-syn region cramOutput start=/^  [^$>]/ start=/^  $/ end=/\v.(\n\n*[^ ])\@=/me=s end=/  [$>]/me=e-3 end=/^$/ fold containedin=cramBlock
+syn region cramOutput start=/^  [^$>]/ start=/^  $/ end=/\v.(\n\n*[^ ])\@=/me=s end=/^  [$>]/me=e-3 end=/^$/ fold containedin=cramBlock
 syn match cramCommandStart /^  \$ / containedin=cramCommand
 syn region cramCommand start=/^  \$ /hs=s+4,rs=s+4 end=/^  [^>]/me=e-3 end=/^  $/me=e-2 containedin=cramBlock contains=@Shell keepend
 syn region cramBlock start=/^  /ms=e-2 end=/\v.(\n\n*[^ ])\@=/me=s end=/^$/me=e-1 fold keepend
@@ -21,7 +27,11 @@
 hi link cramComment Normal
 hi link cramOutput Comment
 
-set foldmethod=syntax
-syn sync maxlines=200
+if exists("cram_fold")
+  setlocal foldmethod=syntax
+endif
+
+syn sync match cramSync grouphere NONE "^$"
+syn sync maxlines=2000
 
 let b:current_syntax = "cram"