Commits

Steve Losh committed 2f328bb Merge

Merge.

Comments (0)

Files changed (4)

 a7ba9b3a2435f88e3ff71367de22119c67b22958 0.9.6
 02922c38bb8b1cd45ac69fad04965f37d7239f58 0.9.7
 a481ad3fbefea06300c64a73ff856619b7af8334 0.9.8
+28ef6c33a8941f16e849cc0905d93d7c80fab26d 0.9.9

ftplugin/slimv.vim

 " slimv.vim:    The Superior Lisp Interaction Mode for VIM
-" Version:      0.9.9
-" Last Change:  10 Nov 2012
+" Version:      0.9.10
+" Last Change:  11 Dec 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
     endif
     setlocal buftype=nofile
     setlocal noswapfile
-    setlocal noreadonly
+    setlocal modifiable
 endfunction
 
 " Go to the end of the screen line
 
 " End updating an otherwise readonly buffer
 function SlimvEndUpdate()
-    setlocal readonly
+    setlocal nomodifiable
     setlocal nomodified
 endfunction
 
     if exists( 'b:inspect_pos' )
         unlet b:inspect_pos
     endif
-    setlocal noreadonly
+    setlocal modifiable
     silent! %d
     call SlimvEndUpdate()
     if a:force
 " Quit Threads
 function SlimvQuitThreads()
     " Clear the contents of the Threads buffer
-    setlocal noreadonly
+    setlocal modifiable
     silent! %d
     call SlimvEndUpdate()
     b #
 " Quit Sldb
 function SlimvQuitSldb()
     " Clear the contents of the Sldb buffer
-    setlocal noreadonly
+    setlocal modifiable
     silent! %d
     call SlimvEndUpdate()
     b #
 
 " Write help text to current buffer at given line
 function SlimvHelp( line )
-    setlocal noreadonly
+    setlocal modifiable
     if exists( 'b:help_shown' )
         let help = b:help
     else
     endif
     let b:help_line = a:line
     call append( b:help_line, help )
-    call SlimvEndUpdate()
 endfunction
 
 " Toggle help
         let lines = 1
         let b:help_shown = 1
     endif
-    setlocal noreadonly
+    setlocal modifiable
     execute ":" . (b:help_line+1) . "," . (b:help_line+lines) . "d"
     call SlimvHelp( b:help_line )
+    call SlimvEndUpdate()
 endfunction
 
 " Open SLDB buffer and place cursor on the given frame
 
 " Make a fold at the cursor point in the current buffer
 function SlimvMakeFold()
-    setlocal noreadonly
+    setlocal modifiable
     normal! o    }}}kA {{{0
-    setlocal readonly
+    setlocal nomodifiable
 endfunction
 
 " Handle insert mode 'Enter' keypress in the REPL buffer
         return []
     endif
     if s:swank_connected
+        " Save current buffer and window in case a swank command causes a buffer change
+        let buf = bufnr( "%" )
+        if winnr('$') < 2
+            let win = -1
+        else
+            let win = winnr()
+        endif
+
         call SlimvFindPackage()
         if g:slimv_simple_compl
             let msg = SlimvCommandGetResponse( ':simple-completions', 'python swank_completions("' . a:base . '")', 0 )
         else
             let msg = SlimvCommandGetResponse( ':fuzzy-completions', 'python swank_fuzzy_completions("' . a:base . '")', 0 )
         endif
+
+        " Restore window and buffer, because it is not allowed to change buffer here
+        if win >= 0 && winnr() != win
+            execute win . "wincmd w"
+            let msg = ''
+        endif
+        if bufnr( "%" ) != buf
+            execute "buf " . buf
+            let msg = ''
+        endif
+
         if msg != ''
             " We have a completion list from SWANK
             let res = split( msg, '\n' )

ftplugin/swank.py

 #
 # SWANK client for Slimv
 # swank.py:     SWANK client code for slimv.vim plugin
-# Version:      0.9.9
-# Last Change:  07 Nov 2012
+# Version:      0.9.10
+# Last Change:  10 Dec 2012
 # Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 # License:      This file is placed in the public domain.
 #               No warranty, express or implied.
 
     if type(pcont[0]) != list:
         return
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     help_lines = int( vim.eval('exists("b:help_shown") ? len(b:help) : 1') )
     pos = help_lines + inspect_lines
     else:
         # No ore entries left
         vim.command("let b:inspect_more=0")
+    vim.command('call SlimvEndUpdate()')
 
 def swank_parse_inspect(struct):
     """
     global inspect_newline
 
     vim.command('call SlimvOpenInspectBuffer()')
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     title = parse_plist(struct, ':title')
     vim.command('let b:inspect_title="' + title + '"')
     Parse the SLDB output
     """
     vim.command('call SlimvOpenSldbBuffer()')
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     [thread, level, condition, restarts, frames, conts] = struct[1:7]
     buf[:] = [l for l in (unquote(condition[0]) + "\n" + unquote(condition[1])).splitlines()]
 
 def swank_parse_list_threads(tl):
     vim.command('call SlimvOpenThreadsBuffer()')
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     buf[:] = ['Threads in pid '+pid, '--------------------']
     vim.command('call SlimvHelp(2)')
     Parse frame call output
     """
     vim.command('call SlimvGotoFrame(' + action.data + ')')
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     win = vim.current.window
     line = win.cursor[0]
     'Well, let's say a missing feature: source locations are currently not available for code loaded as source.'
     """
     vim.command('call SlimvGotoFrame(' + action.data + ')')
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     win = vim.current.window
     line = win.cursor[0]
     """
     frame_num = action.data
     vim.command('call SlimvGotoFrame(' + frame_num + ')')
+    vim.command('setlocal modifiable')
     buf = vim.current.buffer
     win = vim.current.window
     line = win.cursor[0]

plugin/paredit.vim

 " paredit.vim:
 "               Paredit mode for Slimv
-" Version:      0.9.9
-" Last Change:  10 Nov 2012
+" Version:      0.9.10
+" Last Change:  10 Dec 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
         silent exe "normal! `[v`]"
     endif
 
-    if !g:paredit_mode || a:visualmode && a:type == 'block' || a:type == "\<C-V>"
+    if !g:paredit_mode || (a:visualmode && (a:type == 'block' || a:type == "\<C-V>"))
         " Block mode is too difficult to handle at the moment
         silent exe "normal! d"
         let putreg = getreg( '"' )
         if a:func == 'd'
             " Register "0 is corrupted by the above 'y' command
             call setreg( '0', save_0 ) 
+        elseif a:visualmode && len(getline("'>")) < col("'>") && len(putreg) > 0
+            " Remove extra space added at the end of line when selection=inclusive, all, or onemore
+            let putreg = putreg[:-2]
         endif
 
         " Find and keep unbalanced matched characters in the region
         endif
 
         if matched == ''
-            silent exe "normal! gvd"
+            if a:func == 'c' && (a:type == 'V' || a:type == 'char')
+                silent exe "normal! gvc"
+            else
+                silent exe "normal! gvd"
+            endif
         else
             silent exe "normal! gvc" . matched
             silent exe "normal! l"
-            if a:func == 'c'
-                silent exe "normal! " . string(len(endingwhitespace)) . "h"
+            let offs = len(matched)
+            if matched[0] =~ b:any_closing_char
+                let offs = offs + 1
+            endif
+            if a:func == 'd'
+                let offs = offs - 1
+            endif
+            if offs > 0
+                silent exe "normal! " . string(offs) . "h"
             endif
         endif
     endif
 
 " General change operator handling
 function! PareditChange( type, ... )
+    let startcol = col('.')
     let ve_save = &virtualedit
     set virtualedit=all
     call PareditOpfunc( 'c', a:type, a:0 )
+    if len(getline('.')) == 0
+        let l = line('.')
+        let expr = &indentexpr
+        if expr == ''
+            " No special 'indentexpr', call default lisp indent
+            let expr = 'lispindent(l)'
+        else
+            " Replace (v:lnum) in 'indentexpr' with (l)
+            let expr = substitute( expr, '(.*)', '(l)', 'g' )
+        endif
+        execute "call setline( l, repeat( ' ', " . expr . " ) )"
+        normal! $l
+    elseif startcol > 1
+        normal! l
+    endif
     startinsert
     let &virtualedit = ve_save
 endfunction
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.