Commits

JacekKLach committed 00b33e5

Restore cursor position before returning from SlimvIndent.

Comments (0)

Files changed (1)

ftplugin/slimv.vim

         if indent_keylists && strpart(func, 0, 1) == ':'
             if form =~ '^:\S*\s\+\S'
                 " This keyword has an associated value in the same line
+                call winrestview( oldpos )
                 return c
             else
                 " The keyword stands alone in its line with no associated value
+                call winrestview( oldpos )
                 return c + 1
             endif
         endif
         if SlimvGetFiletype() == 'clojure'
             " Fix clojure specific indentation issues not handled by the default lisp.vim
             if match( func, 'defn$' ) >= 0
+                call winrestview( oldpos )
                 return c + 1
             endif
         else
             if match( func, 'defgeneric$' ) >= 0 || match( func, 'defsystem$' ) >= 0 || match( func, 'aif$' ) >= 0
+                call winrestview( oldpos )
                 return c + 1
             endif
         endif
             silent execute 'python get_indent_info("' . func . '")'
             if s:indent != '' && s:indent == args_here
                 " The next one is an &body argument, so indent by 2 spaces from the opening '('
+                call winrestview( oldpos )
                 return c + 1
             endif
         endif
     let gap = matchend( line, '^(\s\+\S' )
     if gap >= 0
         " Align to the gap between the opening paren and the first atom
+        call winrestview( oldpos )
         return li + gap - 2
     endif
+    call winrestview( oldpos )
     return li
 endfunction