From d9ebd46bd090c598adc82e683b4462909f2d4ea5 Mon Sep 17 00:00:00 2001 From: Shixian Li <34830785+znsoooo@users.noreply.github.com> Date: Sun, 3 Mar 2024 23:41:46 +0800 Subject: [PATCH] runtime(mswin): Use unnamed register when clipboard not working (#13813) * Use unnamed register while clipboard not exist * Do not need to specify the unnamed register explicitly fixes: #13809 Signed-off-by: Shixian Li Signed-off-by: Christian Brabandt --- runtime/mswin.vim | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 1c28cadac0e1f..3c10c0a6d8070 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 -" Last Change: 2023 Aug 10 +" Last Change: 2024 Mar 3 " Former Maintainer: Bram Moolenaar " Bail out if this isn't wanted. @@ -24,7 +24,7 @@ set backspace=indent,eol,start whichwrap+=<,>,[,] " backspace in Visual mode deletes selection vnoremap d -if has("clipboard") +if has("clipboard_working") " CTRL-X and SHIFT-Del are Cut vnoremap "+x vnoremap "+x @@ -39,6 +39,23 @@ if has("clipboard") cmap + cmap + +else + " Use unnamed register while clipboard not exist + + " CTRL-X and SHIFT-Del are Cut + vnoremap x + vnoremap x + + " CTRL-C and CTRL-Insert are Copy + vnoremap y + vnoremap y + + " CTRL-V and SHIFT-Insert are Paste + noremap gP + noremap gP + + inoremap " + inoremap " 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