Commits

Steve Losh committed af6e473 Merge

Merge.

Comments (0)

Files changed (7)

 --------------------------------------------------------------------------------
 slimv.vim
 --------------------------------------------------------------------------------
+
 Superior Lisp Interaction Mode for Vim ("SLIME for Vim")
 
 Vim script
 --------------------------------------------------------------------------------
 Description
 --------------------------------------------------------------------------------
+
 Slimv is a SWANK client for Vim, similarly to SLIME for Emacs. SWANK is a TCP server for Emacs, which runs a Common Lisp, Clojure or Scheme REPL and provides a socket interface for evaluating, compiling, debugging, profiling lisp code. The SWANK server is embedded in Slimv, but you can also use your own SWANK installation.
 
 Slimv opens the lisp REPL (Read-Eval-Print Loop) inside a Vim buffer. Lisp commands may be entered and executed in the REPL buffer, just as in a regular REPL.
 Please visit the Slimv Tutorial for a more complete introduction:
 http://kovisoft.bitbucket.org/tutorial.html
 
+Please find the most recent development version in the repository:
+https://bitbucket.org/kovisoft/slimv
+
 Here follows a list of Slimv commands, any similarity with SLIME's menu is not coincidental. :)
 
 Edit commands:
     *  Untrace All
     *  Disassemble
     *  Set Breakpoint
+    *  Break on Exception
     *  Inspect
     *  Abort
     *  Quit to Toplevel
 Script versions
 --------------------------------------------------------------------------------
 
+0.9.9: Added Paredit functions to Slimv menu (thanks to Conrad Schuler). Inspector: Use the same package when pressing [--more--], speeding up multi-part object processing, save/restore cursor position for previously visited pages. ,rc was doubly mapped, use ,- for REPL Clear. Autodetect ritz-swank. Added Break-on-Exception function for ritz-swank. Added minibuffer operations, this enables [set value] in Inspector. Added smartjumping for Clojure (thanks to dgrnbrg on bitbucket.org). Disable indenting on "set noautoindent". Pass python output to Vim script in variable instead of redirecting stdout (hopefully solves 64-bit MacVim problems). Handle [] and {} delimiters in Scheme like in Clojure. Paredit: ignore (, [, or { when preceded by \. Bugfixes: Arglist on Space after pressing 'I' in visual block mode. Indentation after multi-line subform. Problems with finding function name for arglist. Corruption when pasting large text into console Vim. Cursor positioning in REPL buffer when virtualedit=all. Multi-line entry name parsing in Inspector.
+
 0.9.8: Added autodetection for 'ccl'. Delete empty lines when re-gathering Electric Returns. Inspector: put multiple items in one line (like in Slime), highlight selectable parts and actions, hide item id-s, display "path" of inspected object. Don't extend s-expression with prefix when macroexpanding. Don't evaluate or compile the REPL buffer. Added device to the path when loading pretty printer patches for SBCL (thanks to Andrew Lyon). Added option g:slimv_repl_simple_eval and Electric Return for REPL buffer. Print arglist when pressing Space after closing parens or double quotes, also when pressing Enter. Added "Clear REPL" entry to the REPL menu (mapped to <Leader>-). Paredit: special handling of cw, cb, ciw, caw supporting repeat ('.'). Do not describe empty symbol. Prefer selecting symbol to the left when cursor is on whitespace. Added "." character to iskeyword for Lisp. Removed "." when selecting symbol for completion for Clojure. Increased fuzzy completion limit. Bugfixes: Find package/namespace when current form is in a fold. PareditToggle ckecks if buffer was registered for Paredit. Electric Return re-gathering at end of line with no virtualedit. Extra character at the end of selection using 'v('. Garbage upon pressing ')' or Enter in completion popup. Paredit 'x' at end of line when 'whichwrap' includes h,l. Arglist sometimes not displayed. Paredit Wrap when line ends in a multibyte character (thanks to Sung Pae).
 
 0.9.7: Keep cursor position on expanding [--more--] in the Inspector. Added [--all---] to Inspector for fetching all parts. Don't explicitly check for pythonXX.dll, rely on has('python'). Require 'swank-repl' for slime version above 2011-12-04 in case contribs are disabled. Identify VimClojure REPL prompt position for paredit (thanks to David Greenberg). Paredit: added <leader><Up> for Splice-killing-backward, <leader><Down> for Splice-killing-forward, <leader>I for Raise. Paredit: added 'Electric Return' feature and new option g:paredit_electric_return. Increased the distance to search for the defun start to 200 lines. Bugfixes: Positioning the cursor at the end of REPL prompt in insert mode. Handle restart/frame number above 999 (thanks to Philipp Marek). Form selection when cursor is next to the opening paren. Indentation of multi-line strings. Indentation of lines with multi-byte characters. Cursor movement while indenting.
-*paredit.txt*                   Paredit              Last Change: 06 Jul 2012
+*paredit.txt*                   Paredit              Last Change: 20 Nov 2012
 
 Paredit Mode for Vim                                  *paredit* *slimv-paredit*
-                               Version 0.9.8
+                               Version 0.9.9
 
 The paredit.vim plugin performs structured editing of s-expressions used in
 the Lisp, Clojure, Scheme programming languages. It may come as part of Slimv
 The function takes care of strings and comments, so no parenthesis and square
 bracket balancing is performed inside a string or comment.
 Please note that [] and {} pairs are not balanced for Lisp filetypes, only
-for Clojure.
+for Clojure and Scheme.
 
 The idea is taken from the paredit mode of Emacs, but not all paredit.el
 editing functions are implemented or behave exactly the same way as they do
 
 |g:paredit_electric_return|  If nonzero, electric return feature is enabled.
 
-|g:paredit_smartjump|        If nonzero, '(' and ')' also target square
-                             brackets and curly braces when editing Clojure.
+|g:paredit_smartjump|        If nonzero, '(' and ')' also target square brackets
+                             and curly braces when editing Clojure or Scheme.
 
 |g:paredit_leader|           Custom <Leader> setting for Paredit.
 
 http://img8.imageshack.us/img8/9479/openparen.gif
 
                                                           *g:paredit_smartjump*
-If nonzero, this option changes the behavior of '(' and ')' in normal and
-visual modes when editing Clojure. Rather than jumping to nearest open or close
+If nonzero, this option changes the behavior of '(' and ')' in normal and visual
+modes when editing Clojure or Scheme. Rather than jumping to nearest open or close
 parenthesis, instead the cursor will jump to the nearest '(', '[', or '{' if
 you press '(', and it will jump to the nearest ')', ']', or '}' if you press
 ')'. This option makes it much easier to navigate nested Clojure data
-structures. It does nothing if the filetype is not clojure.
+structures. It does nothing if the filetype is not clojure or Scheme.
 
                                                              *g:paredit_leader*
 This option allows a custom <Leader> setting for the Paredit keybindings.
-*slimv.txt*                    Slimv                 Last Change: 03 Nov 2012
+*slimv.txt*                    Slimv                 Last Change: 20 Nov 2012
 
 Slimv                                                                  *slimv*
                                Version 0.9.9
 ===============================================================================
 CHANGE LOG                                                    *slimv-changelog*
 
+0.9.9  - Added Paredit functions to Slimv menu (thanks to Conrad Schuler).
+       - Inspector: use the same package when pressing [--more--].
+       - Inspector: speeding up multi-part object processing.
+       - Inspector: save/restore cursor position for previously visited pages.
+       - <Leader>rc was doubly mapped, use <Leader>- for REPL Clear.
+       - Autodetect ritz-swank.
+       - Added Break-on-Exception function for ritz-swank.
+       - Added minibuffer operations, this enables [set value] in Inspector.
+       - Added smartjumping for Clojure (thanks to dgrnbrg on bitbucket.org).
+       - Disable indenting on "set noautoindent".
+       - Pass python output to Vim script in variable instead of redirecting
+         stdout (hopefully solves 64-bit MacVim problems).
+       - Handle [] and {} delimiters in Scheme like in Clojure.
+       - Paredit: ignore (, [, or { when preceded by \.
+       - Bugfix: arglist on <Space> after pressing 'I' in visual block mode.
+       - Bugfix: indentation after multi-line subform.
+       - Bugfix: problems with finding function name for arglist.
+       - Bugfix: corruption when pasting large text into console Vim.
+       - Bugfix: cursor positioning in REPL buffer when virtualedit=all.
+       - Bugfix: multi-line entry name parsing in Inspector.
+
 0.9.8  - Added autodetection for 'ccl'.
        - Delete empty lines when re-gathering Electric Returns.
        - Inspector: put multiple items in one line (like in Slime).
 Daniel Solano G�mez, Brian Kropf, Len Weincier, Andreas Salwasser,
 Jon Thacker, Andrew Hills, Jerome Baum, John Obbele, Andreas Fredriksson,
 �mer Sinan Agacan, Tobias Pflug, Chris Cahoon, Mats Rauhala, Oleg Terenchuk,
-Andrew Lyon, Andrew Smirnoff, Brett Kosinski, David Greenberg, Sung Pae
-for additional notes and contributions.
+Andrew Lyon, Andrew Smirnoff, Brett Kosinski, David Greenberg, Sung Pae,
+Conrad Schuler for additional notes and contributions.
 
 I would also like to say a big thank you to everyone donating to support
 development. This is a one-element list at the moment: :)

ftplugin/slimv.vim

 " slimv.vim:    The Superior Lisp Interaction Mode for VIM
 " Version:      0.9.9
-" Last Change:  03 Nov 2012
+" Last Change:  10 Nov 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
     syn region lispParen8 contained matchgroup=hlLevel8 start="`\=("  skip="|.\{-}|" end=")"  matchgroup=replPrompt end="^\S\+>"me=s-1,re=s-1 contains=@replListCluster,lispParen9
     syn region lispParen9 contained matchgroup=hlLevel9 start="`\=("  skip="|.\{-}|" end=")"  matchgroup=replPrompt end="^\S\+>"me=s-1,re=s-1 contains=@replListCluster,lispParen0
 
- if SlimvGetFiletype() =~ '.*clojure.*'
+ if SlimvGetFiletype() =~ '.*\(clojure\|scheme\).*'
     syn region lispParen0           matchgroup=hlLevel0 start="`\=\[" skip="|.\{-}|" end="\]" matchgroup=replPrompt end="^\S\+>"              contains=@replListCluster,lispParen1,replPrompt
     syn region lispParen1 contained matchgroup=hlLevel1 start="`\=\[" skip="|.\{-}|" end="\]" matchgroup=replPrompt end="^\S\+>"me=s-1,re=s-1 contains=@replListCluster,lispParen2
     syn region lispParen2 contained matchgroup=hlLevel2 start="`\=\[" skip="|.\{-}|" end="\]" matchgroup=replPrompt end="^\S\+>"me=s-1,re=s-1 contains=@replListCluster,lispParen3
     noremap  <buffer> <silent>        <F1>   :call SlimvToggleHelp()<CR>
     noremap  <buffer> <silent>        <CR>   :call SlimvHandleEnterInspect()<CR>
     noremap  <buffer> <silent> <Backspace>   :call SlimvSendSilent(['[-1]'])<CR>
-    execute 'noremap <buffer> <silent> ' . g:slimv_leader.'q      :call SlimvQuitInspect()<CR>'
+    execute 'noremap <buffer> <silent> ' . g:slimv_leader.'q      :call SlimvQuitInspect(1)<CR>'
 
     if version < 703
         " conceal mechanism is defined since Vim 7.3
 endfunction
 
 " Quit Inspector
-function SlimvQuitInspect()
+function SlimvQuitInspect( force )
     " Clear the contents of the Inspect buffer
+    if exists( 'b:inspect_pos' )
+        unlet b:inspect_pos
+    endif
     setlocal noreadonly
     silent! %d
     call SlimvEndUpdate()
-    call SlimvCommand( 'python swank_quit_inspector()' )
+    if a:force
+        call SlimvCommand( 'python swank_quit_inspector()' )
+    endif
     b #
 endfunction
 
 
 " Set 'iskeyword' option depending on file type
 function! s:SetKeyword()
-    if SlimvGetFiletype() =~ '.*clojure.*'
+    if SlimvGetFiletype() =~ '.*\(clojure\|scheme\).*'
         setlocal iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94,~,#,\|,&
     else
         setlocal iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94,~,#,\|,&,.,{,},[,]
             " We are outside of strings and comments, now we shall count parens
             if form[i] == '('
                 let end = ')' . end
-            elseif form[i] == '[' && SlimvGetFiletype() =~ '.*clojure.*'
+            elseif form[i] == '[' && SlimvGetFiletype() =~ '.*\(clojure\|scheme\).*'
                 let end = ']' . end
-            elseif form[i] == '{' && SlimvGetFiletype() =~ '.*clojure.*'
+            elseif form[i] == '{' && SlimvGetFiletype() =~ '.*\(clojure\|scheme\).*'
                 let end = '}' . end
-            elseif form[i] == ')' || ((form[i] == ']' || form[i] == '}') && SlimvGetFiletype() =~ '.*clojure.*')
+            elseif form[i] == ')' || ((form[i] == ']' || form[i] == '}') && SlimvGetFiletype() =~ '.*\(clojure\|scheme\).*')
                 if len( end ) == 0 || end[0] != form[i]
                     " Oops, too many closing parens or invalid closing paren
                     return 'ERROR'
     normal! 0
     let [l, c] = searchpairpos( '(', '', ')', 'bW', s:skip_sc, backline )
     if l > 0
-        if SlimvGetFiletype() =~ '.*clojure.*'
+        if SlimvGetFiletype() =~ '.*\(clojure\|scheme\).*'
             " Is this a clojure form with [] binding list?
             call winrestview( oldpos )
             let [lb, cb] = searchpairpos( '\[', '', '\]', 'bW', s:skip_sc, backline )
     execute "normal! \<CR>"
 endfunction
 
+" Restore Inspector cursor position if the referenced title has already been visited
+function SlimvSetInspectPos( title )
+    if exists( 'b:inspect_pos' ) && has_key( b:inspect_pos, a:title )
+        call winrestview( b:inspect_pos[a:title] )
+    else
+        normal! gg0
+    endif
+endfunction
+
 " Handle normal mode 'Enter' keypress in the Inspector buffer
 function! SlimvHandleEnterInspect()
     let line = getline('.')
         let line = strpart( line, c )
     endif
 
+    if exists( 'b:inspect_title' ) && b:inspect_title != ''
+        " Save cursor position in case we'll return to this page later on
+        if !exists( 'b:inspect_pos' )
+            let b:inspect_pos = {}
+        endif
+	let b:inspect_pos[b:inspect_title] = winsaveview()
+    endif
+
     if line[0] == '['
         if line =~ '^\[--more--\]$'
             " More data follows, fetch next part
             if item != ''
                 " Add item name to the object path
                 let entry = matchstr(line, '\[\d\+\]\s*\zs.\{-}\ze\s*\[\]}')
+                if entry == ''
+                    let entry = matchstr(line, '\[\d\+\]\s*\zs.*')
+                endif
+                if entry == ''
+                    let entry = 'Unknown object'
+                endif
+                if len( entry ) > 40
+                    " Crop if too long
+                    let entry = strpart( entry, 0, 37 ) . '...'
+                endif
                 let s:inspect_path = s:inspect_path + [entry]
             endif
         endif

ftplugin/swank.py

 # SWANK client for Slimv
 # swank.py:     SWANK client code for slimv.vim plugin
 # Version:      0.9.9
-# Last Change:  03 Nov 2012
+# Last Change:  07 Nov 2012
 # Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 # License:      This file is placed in the public domain.
 #               No warranty, express or implied.
 actions         = dict()        # Swank actions (like ':write-string'), by message id
 indent_info     = dict()        # Data of :indentation-update
 frame_locals    = dict()        # Map frame variable names to their index
-inspect_content = []            # Partial content of the last Inspect command
+inspect_lines   = 0             # Number of lines in the Inspector (excluding help text)
+inspect_newline = True          # Start a new line in the Inspector (for multi-part objects)
 inspect_package = ''            # Package used for the current Inspector
 
 
     """
     Parse the swank inspector content
     """
-    global inspect_content
+    global inspect_lines
+    global inspect_newline
 
-    vim.command('let oldpos=winsaveview()')
+    if type(pcont[0]) != list:
+        return
     buf = vim.current.buffer
-    # First 2 lines are filled in swank_parse_inspect()
-    buf[2:] = []
-    if type(pcont[0]) == list:
-        inspect_content = inspect_content + pcont[0]  # Append to the previous content
+    help_lines = int( vim.eval('exists("b:help_shown") ? len(b:help) : 1') )
+    pos = help_lines + inspect_lines
+    buf[pos:] = []
     istate = pcont[1]
     start  = pcont[2]
     end    = pcont[3]
     lst = []
-    linestart = 0
-    for el in inspect_content:
+    for el in pcont[0]:
         logprint(str(el))
+        newline = False
         if type(el) == list:
             if el[0] == ':action':
-                item = '{<' + unquote(el[2]) + '>'
-                tail = '<>}'
+                text = '{<' + unquote(el[2]) + '>' + unquote(el[1]) + '<>}'
             else:
-                item = '{[' + unquote(el[2]) + ']'
-                tail = '[]}'
-            lst.insert(len(lst), item)
-            linestart = -1
-            text = unquote(el[1])
-            lst.append(text + tail)
+                text = '{[' + unquote(el[2]) + ']' + unquote(el[1]) + '[]}'
+            lst.append(text)
         else:
             text = unquote(el)
             lst.append(text)
             if text == "\n":
-                linestart = len(lst)
+                newline = True
+    lines = "".join(lst).split("\n")
+    if inspect_newline or pos > len(buf):
+        buf.append(lines)
+    else:
+        buf[pos-1] = buf[pos-1] + lines[0]
+        buf.append(lines[1:])
+    inspect_lines = len(buf) - help_lines
+    inspect_newline = newline
     if int(istate) > int(end):
         # Swank returns end+1000 if there are more entries to request
-        if linestart >= 0 and linestart < len(lst) and (len(lst[linestart]) == 0 or lst[linestart][0] != '['):
-            lst[linestart:] = "[--more--]"
-        else:
-            lst.append("\n[--more--]")
-        lst.append("\n[--all---]")
-    buf = vim.current.buffer
-    buf.append([''])
-    buf.append("".join(lst).split("\n"))
+        buf.append(['', "[--more--]", "[--all---]"])
     inspect_path = vim.eval('s:inspect_path')
     if len(inspect_path) > 1:
-        ret = '[<<] Return to ' + ' -> '.join(inspect_path[:-1])
+        buf.append(['', '[<<] Return to ' + ' -> '.join(inspect_path[:-1])])
     else:
-        ret = '[<<] Exit Inspector'
-    buf.append(['', ret])
-    vim.command('normal! 3G0')
-    vim.command('call SlimvHelp(2)')
-    vim.command('call winrestview(oldpos)')
+        buf.append(['', '[<<] Exit Inspector'])
     if int(istate) > int(end):
         # There are more entries to request
         # Save current range for the next request
     """
     Parse the swank inspector output
     """
-    global inspect_content
+    global inspect_lines
+    global inspect_newline
 
     vim.command('call SlimvOpenInspectBuffer()')
     buf = vim.current.buffer
-    buf[:] = ['Inspecting ' + parse_plist(struct, ':title'), '--------------------']
+    title = parse_plist(struct, ':title')
+    vim.command('let b:inspect_title="' + title + '"')
+    buf[:] = ['Inspecting ' + title, '--------------------', '']
+    vim.command('normal! 3G0')
+    vim.command('call SlimvHelp(2)')
     pcont = parse_plist(struct, ':content')
-    inspect_content = []
+    inspect_lines = 3
+    inspect_newline = True
     swank_parse_inspect_content(pcont)
+    vim.command('call SlimvSetInspectPos("' + title + '")')
 
 def swank_parse_debug(struct):
     """
                                 pass
                             elif element == 'nil' and action and action.name == ':inspector-pop':
                                 # Quit inspector
-                                vim.command('b #')
+                                vim.command('call SlimvQuitInspect(0)')
                             elif element != 'nil' and action and action.name in to_nodisp:
                                 # Do not display output, just store it in actions
                                 action.result = unquote(params)
     swank_rex(':inspector-call-nth-action', cmd, 'nil', 't', str(n))
 
 def swank_inspector_pop():
-    # Remove the last two entries from the inspect path
+    # Remove the last entry from the inspect path
     vim.command('let s:inspect_path = s:inspect_path[:-2]')
     swank_rex(':inspector-pop', '(swank:inspector-pop)', 'nil', 't')
 

plugin/paredit.vim

 " paredit.vim:
 "               Paredit mode for Slimv
 " Version:      0.9.9
-" Last Change:  05 Nov 2012
+" Last Change:  10 Nov 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
     " Make sure to include special characters in 'iskeyword'
     " in case they are accidentally removed
     " Also define regular expressions to identify special characters used by paredit
-    if &ft =~ '.*clojure.*'
+    if &ft =~ '.*\(clojure\|scheme\).*'
         setlocal iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94,~,#,\|,&
         let b:any_matched_char   = '(\|)\|\[\|\]\|{\|}\|\"'
         let b:any_matched_pair   = '()\|\[\]\|{}\|\"\"'
         inoremap <buffer> <expr>   "            PareditInsertQuotes()
         inoremap <buffer> <expr>   <BS>         PareditBackspace(0)
         inoremap <buffer> <expr>   <Del>        PareditDel()
-        if &ft =~ '.*clojure.*' && g:paredit_smartjump
+        if &ft =~ '.*\(clojure\|scheme\).*' && g:paredit_smartjump
             nnoremap <buffer> <silent> (            :<C-U>call PareditSmartJumpOpening(0)<CR>
             nnoremap <buffer> <silent> )            :<C-U>call PareditSmartJumpClosing(0)<CR>
             vnoremap <buffer> <silent> (            <Esc>:<C-U>call PareditSmartJumpOpening(1)<CR>
         execute 'nmap     <buffer> <silent> ' . g:paredit_leader.'<Up>    d[(,S'
         execute 'nmap     <buffer> <silent> ' . g:paredit_leader.'<Down>  d])%,S'
         execute 'nmap     <buffer> <silent> ' . g:paredit_leader.'I   :<C-U>call PareditRaise()<CR>'
-        if &ft =~ '.*clojure.*'
+        if &ft =~ '.*\(clojure\|scheme\).*'
             inoremap <buffer> <expr>   [            PareditInsertOpening('[',']')
             inoremap <buffer> <silent> ]            <C-R>=(pumvisible() ? "\<lt>C-Y>" : "")<CR><C-O>:let save_ve=&ve<CR><C-O>:set ve=all<CR><C-O>:<C-U>call PareditInsertClosing('[',']')<CR><C-O>:let &ve=save_ve<CR>
             inoremap <buffer> <expr>   {            PareditInsertOpening('{','}')
         silent! unmap  <buffer> cb
         silent! unmap  <buffer> ciw
         silent! unmap  <buffer> caw
-        if &ft =~ '.*clojure.*'
+        if &ft =~ '.*\(clojure\|scheme\).*'
             silent! iunmap <buffer> [
             silent! iunmap <buffer> ]
             silent! iunmap <buffer> {
         return 0
     endif
 
-    if &ft =~ '.*clojure.*'
+    if &ft =~ '.*\(clojure\|scheme\).*'
         let b1 = searchpair( '\[', '', '\]', 'brnmW', s:skip_sc, matchb )
         let b2 = searchpair( '\[', '', '\]',  'rnmW', s:skip_sc, matchf )
         if !(b1 == b2) && !(b1 == b2 - 1 && line[c-1] == '[') && !(b1 == b2 + 1 && line[c-1] == ']')
     while 1
         let matched = tmp
         let tmp = substitute( tmp, '(\(\s*\))',   ' \1 ', 'g')
-        if &ft =~ '.*clojure.*'
+        if &ft =~ '.*\(clojure\|scheme\).*'
             let tmp = substitute( tmp, '\[\(\s*\)\]', ' \1 ', 'g')
             let tmp = substitute( tmp, '{\(\s*\)}',   ' \1 ', 'g')
         endif
         if tmp == matched
             " All paired chars eliminated
             let tmp = substitute( tmp, ')\(\s*\)(',   ' \1 ', 'g')
-            if &ft =~ '.*clojure.*'
+            if &ft =~ '.*\(clojure\|scheme\).*'
                 let tmp = substitute( tmp, '\]\(\s*\)\[', ' \1 ', 'g')
                 let tmp = substitute( tmp, '}\(\s*\){',   ' \1 ', 'g')
             endif
             normal! ddk
         endwhile
         normal! Jl
-    elseif g:paredit_electric_return && getline('.') =~ '^\s*\(\]\|}\)' && &ft =~ '.*clojure.*' 
+    elseif g:paredit_electric_return && getline('.') =~ '^\s*\(\]\|}\)' && &ft =~ '.*\(clojure\|scheme\).*' 
         " Re-gather electric returns in the current line for ']' and '}'
         normal! k
         while getline( line('.') ) =~ '^\s*$'
             normal! Jl
             return
         endif
-        if len(nextline) > 0 && nextline[0] =~ '\]\|}' && &ft =~ '.*clojure.*' 
+        if len(nextline) > 0 && nextline[0] =~ '\]\|}' && &ft =~ '.*\(clojure\|scheme\).*' 
             " Re-gather electric returns in the line of the closing ']' or '}'
             call setline( line('.'), substitute( line, '\s*$', '', 'g' ) )
             normal! Jxl
     endif
     call setpos( '.', [0, l, c, 0] )
 
-    if &ft =~ '.*clojure.*'
+    if &ft =~ '.*\(clojure\|scheme\).*'
         call PareditFindClosing( '[', ']', 0 )
         let lp = line( '.' )
         let cp = col( '.' )

syntax/scheme/slimv-syntax-scheme.vim

 " slimv-syntax-scheme.vim:
 "               Scheme syntax plugin for Slimv
-" Version:      0.9.6
-" Last Change:  24 Mar 2012
+" Version:      0.9.9
+" Last Change:  10 Nov 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
 syn keyword schemeExtSyntax     ->environment ->namestring
 syn match   schemeExtSyntax     "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+"
 syn match   schemeAtomMark      "'"
-syn match   schemeAtom          "'[^ \t()]\+" contains=schemeAtomMark
+syn match   schemeAtom          "'[^ \t()\[\]{}]\+" contains=schemeAtomMark
 syn cluster schemeListCluster   contains=schemeSyntax,schemeFunc,schemeString,schemeCharacter,schemeNumber,schemeBoolean,schemeConstant,schemeComment,schemeMultilineComment,schemeQuoted,schemeUnquote,schemeStrucRestricted,schemeOther,schemeError,schemeExtSyntax,schemeExtFunc,schemeAtom,schemeDelimiter
 
 hi def link schemeAtomMark      Delimiter
     syn region schemeParen8 contained matchgroup=hlLevel8 start="`\=(" end=")" skip="|.\{-}|" contains=@schemeListCluster,schemeParen9
     syn region schemeParen9 contained matchgroup=hlLevel9 start="`\=(" end=")" skip="|.\{-}|" contains=@schemeListCluster,schemeParen0
 
+    syn region schemeParen0           matchgroup=hlLevel0 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen1
+    syn region schemeParen1 contained matchgroup=hlLevel1 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen2
+    syn region schemeParen2 contained matchgroup=hlLevel2 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen3
+    syn region schemeParen3 contained matchgroup=hlLevel3 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen4
+    syn region schemeParen4 contained matchgroup=hlLevel4 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen5
+    syn region schemeParen5 contained matchgroup=hlLevel5 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen6
+    syn region schemeParen6 contained matchgroup=hlLevel6 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen7
+    syn region schemeParen7 contained matchgroup=hlLevel7 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen8
+    syn region schemeParen8 contained matchgroup=hlLevel8 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen9
+    syn region schemeParen9 contained matchgroup=hlLevel9 start="`\=\[" end="\]" skip="|.\{-}|" contains=@schemeListCluster,schemeParen0
+
+    syn region schemeParen0           matchgroup=hlLevel0 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen1
+    syn region schemeParen1 contained matchgroup=hlLevel1 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen2
+    syn region schemeParen2 contained matchgroup=hlLevel2 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen3
+    syn region schemeParen3 contained matchgroup=hlLevel3 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen4
+    syn region schemeParen4 contained matchgroup=hlLevel4 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen5
+    syn region schemeParen5 contained matchgroup=hlLevel5 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen6
+    syn region schemeParen6 contained matchgroup=hlLevel6 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen7
+    syn region schemeParen7 contained matchgroup=hlLevel7 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen8
+    syn region schemeParen8 contained matchgroup=hlLevel8 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen9
+    syn region schemeParen9 contained matchgroup=hlLevel9 start="`\={" end="}" skip="|.\{-}|" contains=@schemeListCluster,schemeParen0
+
     if &bg == "dark"
         hi def hlLevel0 ctermfg=red         guifg=red1
         hi def hlLevel1 ctermfg=yellow      guifg=orange1