Greetings:

Every time the ":Man" command is executed, it will overwrite the unnamed
register.  See the test in the patch below for the reproduction.


diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index d7ce4d8ac..1c13c8065 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -189,7 +189,7 @@ func <SID>GetPage(cmdmods, ...)
   setl buftype=nofile noswapfile

   setl fdc=0 ma nofen nonu nornu
-  silent exec "norm! 1GdG"
+  %delete _
   let unsetwidth = 0
   if empty($MANWIDTH)
     let $MANWIDTH = winwidth(0)
@@ -213,10 +213,10 @@ func <SID>GetPage(cmdmods, ...)
   endif
   " Remove blank lines from top and bottom.
   while line('$') > 1 && getline(1) =~ '^\s*$'
-    silent keepj norm! ggdd
+    1delete _
   endwhile
   while line('$') > 1 && getline('$') =~ '^\s*$'
-    silent keepj norm! Gdd
+    $delete _
   endwhile
   1
   setl ft=man nomod
diff --git a/src/testdir/test_man.vim b/src/testdir/test_man.vim
index 9de8cb474..b2fe460d6 100644
--- a/src/testdir/test_man.vim
+++ b/src/testdir/test_man.vim
@@ -111,3 +111,21 @@ func Test_local_options()
   %bw!
   set foldcolumn& number&
 endfunc
+
+" Check that the unnamed register is not overwritten.
+func Test_keep_unnamed_register()
+  %bw!
+
+  let @" = '---'
+
+  let wincnt = winnr('$')
+  Man vim
+  if wincnt == winnr('$')
+    " Vim manual page cannot be found.
+    return
+  endif
+
+  call assert_equal('---', @")
+
+  %bw!
+endfunc


-- 
Jason Franklin

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/4a08c73a-70c8-61de-dd86-5a660f575405%40quoininc.com.

Raspunde prin e-mail lui