Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
mswin.vim147 linesDownload Raw Back to vim92
1" Set options and add mapping such that Vim behaves a lot like MS-Windows2"3" Maintainer:	The Vim Project <https://github.com/vim/vim>4" Last Change:	2024 Mar 135" Former Maintainer:	Bram Moolenaar <Bram@vim.org>6 7" Bail out if this isn't wanted.8if exists("g:skip_loading_mswin") && g:skip_loading_mswin9  finish10endif11 12" set the 'cpoptions' to its Vim default13if 1	" only do this when compiled with expression evaluation14  let s:save_cpo = &cpoptions15endif16set cpo&vim17 18" set 'selection', 'selectmode', 'mousemodel' and 'keymodel' for MS-Windows19behave mswin20 21" backspace and cursor keys wrap to previous/next line22set backspace=indent,eol,start whichwrap+=<,>,[,]23 24" backspace in Visual mode deletes selection25vnoremap <BS> d26 27" the better solution would be to use has("clipboard_working"),28" but that may not be available yet while starting up, so let's just check if29" clipboard support has been compiled in and assume it will be working :/30if has("clipboard")31    " CTRL-X and SHIFT-Del are Cut32    vnoremap <C-X> "+x33    vnoremap <S-Del> "+x34 35    " CTRL-C and CTRL-Insert are Copy36    vnoremap <C-C> "+y37    vnoremap <C-Insert> "+y38 39    " CTRL-V and SHIFT-Insert are Paste40    map <C-V>		"+gP41    map <S-Insert>		"+gP42 43    cmap <C-V>		<C-R>+44    cmap <S-Insert>		<C-R>+45else46		" Use the unnamed register when clipboard support not available47 48    " CTRL-X and SHIFT-Del are Cut49    vnoremap <C-X>   x50    vnoremap <S-Del> x51 52    " CTRL-C and CTRL-Insert are Copy53    vnoremap <C-C>      y54    vnoremap <C-Insert> y55 56    " CTRL-V and SHIFT-Insert are Paste57    noremap <C-V>      gP58    noremap <S-Insert> gP59 60    inoremap <C-V>      <C-R>"61    inoremap <S-Insert> <C-R>"62endif63 64" Pasting blockwise and linewise selections is not possible in Insert and65" Visual mode without the +virtualedit feature.  They are pasted as if they66" were characterwise instead.67" Uses the paste.vim autoload script.68" Use CTRL-G u to have CTRL-Z only undo the paste.69 70if has("clipboard")71    exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']72    exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']73endif74 75imap <S-Insert>		<C-V>76vmap <S-Insert>		<C-V>77 78" Use CTRL-Q to do what CTRL-V used to do79noremap <C-Q>		<C-V>80 81" Use CTRL-S for saving, also in Insert mode (<C-O> doesn't work well when82" using completions).83noremap <C-S>		:update<CR>84vnoremap <C-S>		<C-C>:update<CR>85inoremap <C-S>		<Esc>:update<CR>gi86 87" For CTRL-V to work autoselect must be off.88" On Unix we have two selections, autoselect can be used.89if !has("unix")90  set guioptions-=a91endif92 93" CTRL-Z is Undo; not in cmdline though94noremap <C-Z> u95inoremap <C-Z> <C-O>u96 97" CTRL-Y is Redo (although not repeat); not in cmdline though98noremap <C-Y> <C-R>99inoremap <C-Y> <C-O><C-R>100 101" Alt-Space is System menu102if has("gui")103  noremap <M-Space> :simalt ~<CR>104  inoremap <M-Space> <C-O>:simalt ~<CR>105  cnoremap <M-Space> <C-C>:simalt ~<CR>106endif107 108" CTRL-A is Select all109noremap <C-A> gggH<C-O>G110inoremap <C-A> <C-O>gg<C-O>gH<C-O>G111cnoremap <C-A> <C-C>gggH<C-O>G112onoremap <C-A> <C-C>gggH<C-O>G113snoremap <C-A> <C-C>gggH<C-O>G114xnoremap <C-A> <C-C>ggVG115 116" CTRL-Tab is Next window117noremap <C-Tab> <C-W>w118inoremap <C-Tab> <C-O><C-W>w119cnoremap <C-Tab> <C-C><C-W>w120onoremap <C-Tab> <C-C><C-W>w121 122" CTRL-F4 is Close window123noremap <C-F4> <C-W>c124inoremap <C-F4> <C-O><C-W>c125cnoremap <C-F4> <C-C><C-W>c126onoremap <C-F4> <C-C><C-W>c127 128if has("gui")129  " CTRL-F is the search dialog130  noremap  <expr> <C-F> has("gui_running") ? ":promptfind\<CR>" : "/"131  inoremap <expr> <C-F> has("gui_running") ? "\<C-\>\<C-O>:promptfind\<CR>" : "\<C-\>\<C-O>/"132  cnoremap <expr> <C-F> has("gui_running") ? "\<C-\>\<C-C>:promptfind\<CR>" : "\<C-\>\<C-O>/"133 134  " CTRL-H is the replace dialog,135  " but in console, it might be backspace, so don't map it there136  nnoremap <expr> <C-H> has("gui_running") ? ":promptrepl\<CR>" : "\<C-H>"137  inoremap <expr> <C-H> has("gui_running") ? "\<C-\>\<C-O>:promptrepl\<CR>" : "\<C-H>"138  cnoremap <expr> <C-H> has("gui_running") ? "\<C-\>\<C-C>:promptrepl\<CR>" : "\<C-H>"139endif140 141" restore 'cpoptions'142set cpo&143if 1144  let &cpoptions = s:save_cpo145  unlet s:save_cpo146endif147 
codekingpro/portable-devtools · Team Ai