runtime(mswin): Use unnamed register when clipboard not working (#13813)

Commit: 
https://github.com/vim/vim/commit/d9ebd46bd090c598adc82e683b4462909f2d4ea5
Author: Shixian Li <[email protected]>
Date:   Sun Mar 3 23:41:46 2024 +0800

    runtime(mswin): Use unnamed register when clipboard not working 
(https://github.com/vim/vim/issues/13813)
    
    * Use unnamed register while clipboard not exist
    * Do not need to specify the unnamed register explicitly
    fixes: #13809
    
    Signed-off-by: Shixian Li <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/mswin.vim b/runtime/mswin.vim
index 1c28cadac..3c10c0a6d 100644
--- a/runtime/mswin.vim
+++ b/runtime/mswin.vim
@@ -1,7 +1,7 @@
 " Set options and add mapping such that Vim behaves a lot like MS-Windows
 "
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Mar 3
 " Former Maintainer:   Bram Moolenaar <[email protected]>
 
 " Bail out if this isn't wanted.
@@ -24,7 +24,7 @@ set backspace=indent,eol,start whichwrap+=<,>,[,]
 " backspace in Visual mode deletes selection
 vnoremap <BS> d
 
-if has("clipboard")
+if has("clipboard_working")
     " CTRL-X and SHIFT-Del are Cut
     vnoremap <C-X> "+x
     vnoremap <S-Del> "+x
@@ -39,6 +39,23 @@ if has("clipboard")
 
     cmap <C-V>         <C-R>+
     cmap <S-Insert>            <C-R>+
+else
+    " Use unnamed register while clipboard not exist
+
+    " CTRL-X and SHIFT-Del are Cut
+    vnoremap <C-X>   x
+    vnoremap <S-Del> x
+
+    " CTRL-C and CTRL-Insert are Copy
+    vnoremap <C-C>      y
+    vnoremap <C-Insert> y
+
+    " CTRL-V and SHIFT-Insert are Paste
+    noremap <C-V>      gP
+    noremap <S-Insert> gP
+
+    inoremap <C-V>      <C-R>"
+    inoremap <S-Insert> <C-R>"
 endif
 
 " Pasting blockwise and linewise selections is not possible in Insert and
@@ -47,7 +64,7 @@ endif
 " Uses the paste.vim autoload script.
 " Use CTRL-G u to have CTRL-Z only undo the paste.
 
-if 1
+if has("clipboard_working")
     exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
     exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
 endif

-- 
-- 
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/E1rgo1V-00EgY3-PQ%40256bit.org.

Raspunde prin e-mail lui