Tamas Kovacs  committed f972735

Fixed indentation after multi-line string

(defun somefunc (n)
(format t "[~

  • Participants
  • Parent commits d58fce9
  • Branches default

Comments (0)

Files changed (2)

 Script versions
+0.9.10: Replaced 'readonly' flag with 'nomodifiable' for SLDB, Inspect, Threads buffers. Restore window and buffer if SLDB is activated during completion. Allow using Slimv and VimClojure (or other clojure filetype plugin) together. Added Restart-Frame command (thanks to Philipp Marek). Added defn- to clojure keywords (thanks to David Soria Parra). Paredit initialization on filetype instead of filename extension. Do not permanently set 'iskeyword' in paredit.vim. Paredit: added '^' macro prefix, treat #_(...) type of clojure comments as regular forms, handle VimClojure's #"" regexp syntax definition. It is now possible to remove plugin/paredit.vim. Bugfixes: Fixed missing variable error message. REPL prompt position corruption problems. Cursor positioning problems when displaying arglist. Paredit 'cc', 'Vc' did not delete line. Paredit 'd', 'c', 'vc', 'cW' cursor positioning problems. Paredit 'C' extra whitespace and trailing ". Reset indent after paredit 'cc'. Paredit 'dd', ',>' EOL problem. paredit indentation when 'indentexpr' takes no argument (thanks to Tim Pope). Keep cursor inside "" when deleting over trailing " via paredit 'cW', 'C', etc. Use &ft instead of SlimvGetFiletype() in paredit.vim.
 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 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).

File ftplugin/slimv.vim

 " slimv.vim:    The Superior Lisp Interaction Mode for VIM
-" Version:      0.9.10
-" Last Change:  28 Jan 2013
+" Version:      0.9.11
+" Last Change:  20 Apr 2013
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
         " Found opening paren in the previous line
         let line = getline(l)
         let form = strpart( line, c )
+        " Determine the length of the function part up to the 1st argument
+        let funclen = matchend( form, '\s*\S*\s*' ) + 1
         " Contract strings, remove comments
         let form = substitute( form, '".\{-}[^\\]"', '""', 'g' )
         let form = substitute( form, ';.*$', '', 'g' )
                 " The next one is an &body argument, so indent by 2 spaces from the opening '('
                 return c + 1
+            let llen = len( line )
+            if synIDattr( synID( l, llen, 0), 'name' ) =~ '[Ss]tring' && line[llen-1] != '"'
+                " Parent line ends with a multi-line string
+                " lispindent() fails to handle it correctly
+                if s:indent == '' && args_here > 0
+                    " No &body argument, ignore lispindent() and indent to the 1st argument
+                    return c + funclen - 1
+                endif
+            endif