From 82b02ae2f2af439a8c678ed6b55a43121055f279 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 12 Oct 2024 11:23:31 +0200 Subject: fix(runtime): clean up one-off scripts Problem: Some runtime files no longer spark joy. Solution: Kondo the place up. Still sparks _some_ joy (moved to new `runtime/scripts` folder): * `macros/less.*` * `mswin.vim` * `tools/emoji_list.lua` No longer sparks joy (removed): * `macmap.vim` (gvimrc file; not useful in Nvim) * `tools/check_colors.vim` (no longer useful with new default colorscheme and treesitter) * `macros/editexisting.vim` (throws error on current Nvim) * `macros/justify.vim` (obsolete shim for `packadd! justify`) * `macros/matchit.vim` (same) * `macros/shellmenu.vim` (same) * `macros/swapmous.vim` (same) --- runtime/scripts/mswin.vim | 149 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 runtime/scripts/mswin.vim (limited to 'runtime/scripts/mswin.vim') diff --git a/runtime/scripts/mswin.vim b/runtime/scripts/mswin.vim new file mode 100644 index 0000000000..689bc792cf --- /dev/null +++ b/runtime/scripts/mswin.vim @@ -0,0 +1,149 @@ +" Set options and add mapping such that Vim behaves a lot like MS-Windows +" +" Maintainer: The Vim Project +" Last Change: 2024 Mar 13 +" Former Maintainer: Bram Moolenaar + +" Bail out if this isn't wanted. +if exists("g:skip_loading_mswin") && g:skip_loading_mswin + finish +endif + +" set the 'cpoptions' to its Vim default +if 1 " only do this when compiled with expression evaluation + let s:save_cpo = &cpoptions +endif +set cpo&vim + +" set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows +set selection=exclusive +set selectmode=mouse,key +set mousemodel=popup +set keymodel=startsel,stopsel + +" backspace and cursor keys wrap to previous/next line +set backspace=indent,eol,start whichwrap+=<,>,[,] + +" backspace in Visual mode deletes selection +vnoremap d + +" the better solution would be to use has("clipboard_working"), +" but that may not be available yet while starting up, so let's just check if +" clipboard support has been compiled in and assume it will be working :/ +if has("clipboard") + " 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 + map "+gP + map "+gP + + cmap + + cmap + +else + " Use the unnamed register when clipboard support not available + + " 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 +" Visual mode without the +virtualedit feature. They are pasted as if they +" were characterwise instead. +" Uses the paste.vim autoload script. +" Use CTRL-G u to have CTRL-Z only undo the paste. + +if has("clipboard") + exe 'inoremap