changeset 99:001b341ab8ad

Fix for Lawrencium files having folded sections deleted incorrectly.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 29 Jul 2014 16:34:49 -0700
parents e5ac6464a767
children 596f94a7e0fd
files plugin/lawrencium.vim
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/lawrencium.vim	Tue Jul 29 16:34:17 2014 -0700
+++ b/plugin/lawrencium.vim	Tue Jul 29 16:34:49 2014 -0700
@@ -366,8 +366,12 @@
         let l:was_buffer_empty = (line('$') == 1 && getline(1) == '')
         execute '0read!' . escape(a:command_line, '%#\')
         if l:was_buffer_empty  " (Always true?)
-            " '0read' inserts before the cursor, leaving a blank line which needs to be deleted:
-            normal! Gdd
+            " '0read' inserts before the cursor, leaving a blank line which
+            " needs to be deleted... but if there are folds in this thing, we
+            " must open them all first otherwise we could delete the whole
+            " contents of the last fold (since Vim may close them all by
+            " default).
+            normal! zRGdd
         endif
     endfunction