Commits

Tamas Kovacs committed 43b1063

Added "Clear REPL" entry to the REPL menu, mapped to <Leader>-

  • Participants
  • Parent commits 1fbf88c

Comments (0)

Files changed (3)

     *  Set Package
     *  Previous Input
     *  Next Input
+    *  Clear REPL
 
 For more information see the included documentation.
  

File doc/slimv.txt

-*slimv.txt*                    Slimv                 Last Change: 06 Jul 2012
+*slimv.txt*                    Slimv                 Last Change: 14 Jul 2012
 
 Slimv                                                                  *slimv*
                                Version 0.9.8
     <C-C>   <C-C>    Interrupt Lisp Process
     ,<Up>   ,rp      Previous Input
     ,<Down> ,rn      Next Input
-    ,z      ,rr      Refresh REPL Buffer
+    ,-      ,rc      Clear REPL
 
 Note:
 Some mappings accept an optional "x prefix (where x is a register name)

File ftplugin/slimv.vim

 " slimv.vim:    The Superior Lisp Interaction Mode for VIM
 " Version:      0.9.8
-" Last Change:  13 Jul 2012
+" Last Change:  14 Jul 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'/      :call SlimvSendCommand(1)<CR>'
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'<Up>   :call SlimvPreviousCommand()<CR>'
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'<Down> :call SlimvNextCommand()<CR>'
+        execute 'noremap <buffer> <silent> ' . g:slimv_leader.'-      :call SlimvClearReplBuffer()<CR>'
     elseif g:slimv_keybindings == 2
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'rs     :call SlimvSendCommand(0)<CR>'
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'ro     :call SlimvSendCommand(1)<CR>'
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'rp     :call SlimvPreviousCommand()<CR>'
         execute 'noremap <buffer> <silent> ' . g:slimv_leader.'rn     :call SlimvNextCommand()<CR>'
+        execute 'noremap <buffer> <silent> ' . g:slimv_leader.'rc     :call SlimvClearReplBuffer()<CR>'
     endif
 
     if g:slimv_repl_wrap
     call SlimvRefreshReplBuffer()
 endfunction
 
+" Clear the contents of the REPL buffer, keeping the last prompt only
+function! SlimvClearReplBuffer()
+    if b:repl_prompt_line > 1
+        execute "normal! gg0d" . (b:repl_prompt_line-1) . "GG$"
+        let b:repl_prompt_line = 1
+    endif
+endfunction
+
 " Open a new Inspect buffer
 function SlimvOpenInspectBuffer()
     call SlimvOpenBuffer( g:slimv_inspect_name )
     amenu &REPL.-REPLSep-                              :
     amenu &REPL.&Previous-Input                        :call SlimvPreviousCommand()<CR>
     amenu &REPL.&Next-Input                            :call SlimvNextCommand()<CR>
+    amenu &REPL.Clear-&REPL                            :call SlimvClearReplBuffer()<CR>
 endfunction
 
 " =====================================================================