vim添加复制(crtl+c),粘贴(ctrl+v)ctrl+A 等快捷键

1  在  /usr/share/vim/vimrc文件中添加   source $VIMRUNTIME/mswin.vim

2  mswin.vim位置在 /usr/share/vim/vim72/目录下面

3  下面是mswin.vim文件的目录,没有这个文件的可以自己创建这个文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
" Set options and add mapping such that Vim behaves a lot like MS-Windows 
" Maintainer:    Bram Moolenaar <Bram@vim.org> 
" Last change:    2006 Apr 02 
   
" bail out  if  this  isn't wanted (mrsvim.vim uses  this ). 
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 
behave mswin 
   
" backspace and cursor keys wrap to previous/next line 
set backspace=indent,eol,start whichwrap+=<,>,[,] 
   
" backspace in Visual mode deletes selection 
vnoremap <BS> d 
   
" 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 
map <C-V>        "+gP 
map <S-Insert>        "+gP 
   
cmap <C-V>        <C-R>+ 
cmap <S-Insert>        <C-R>+ 
   
" 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. 
   
exe  'inoremap <script> <C-V>'  paste#paste_cmd[ 'i'
exe  'vnoremap <script> <C-V>'  paste#paste_cmd[ 'v'
   
imap <S-Insert>        <C-V> 
vmap <S-Insert>        <C-V> 
   
" Use CTRL-Q to  do  what CTRL-V used to  do 
noremap <C-Q>        <C-V> 
   
" Use CTRL-S  for  saving, also in Insert mode 
noremap <C-S>        :update<CR> 
vnoremap <C-S>        <C-C>:update<CR> 
inoremap <C-S>        <C-O>:update<CR> 
   
" For CTRL-V to work autoselect must be off. 
" On Unix we have two selections, autoselect can be used. 
if  !has( "unix"
   set guioptions-=a 
endif 
   
" CTRL-Z is Undo; not in cmdline though 
noremap <C-Z> u 
inoremap <C-Z> <C-O>u 
   
" CTRL-Y is Redo (although not repeat); not in cmdline though 
noremap <C-Y> <C-R> 
inoremap <C-Y> <C-O><C-R> 
   
" Alt-Space is System menu 
if  has( "gui"
   noremap <M-Space> :simalt ~<CR> 
   inoremap <M-Space> <C-O>:simalt ~<CR> 
   cnoremap <M-Space> <C-C>:simalt ~<CR> 
endif 
   
" CTRL-A is Select all 
noremap <C-A> gggH<C-O>G 
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G 
cnoremap <C-A> <C-C>gggH<C-O>G 
onoremap <C-A> <C-C>gggH<C-O>G 
snoremap <C-A> <C-C>gggH<C-O>G 
xnoremap <C-A> <C-C>ggVG 
   
" CTRL-Tab is Next window 
noremap <C-Tab> <C-W>w 
inoremap <C-Tab> <C-O><C-W>w 
cnoremap <C-Tab> <C-C><C-W>w 
onoremap <C-Tab> <C-C><C-W>w 
   
" CTRL-F4 is Close window 
noremap <C-F4> <C-W>c 
inoremap <C-F4> <C-O><C-W>c 
cnoremap <C-F4> <C-C><C-W>c 
onoremap <C-F4> <C-C><C-W>c 
   
" restore  'cpoptions' 
set cpo& 
if 
   let &cpoptions = s:save_cpo 
   unlet s:save_cpo 
endif 

  

原文: https://www.cnblogs.com/Ph-one/p/5620894.html

 

  • 1
    点赞
  • 0
    评论
  • 3
    收藏
  • 扫一扫,分享海报

参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值