blob: 1ba336c2b3ee8e6d99f58892e85a2abd9c24e947 [file] [log] [blame]
Bram Moolenaar0fd92892006-03-09 22:27:48 +00001" Vim support file to help with paste mappings and menus
Christian Brabandte978b452023-08-13 10:33:05 +02002" Maintainer: The Vim Project <https://github.com/vim/vim>
3" Last Change: 2023 Aug 10
4" Former Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar0fd92892006-03-09 22:27:48 +00005
6" Define the string to use for items that are present both in Edit, Popup and
7" Toolbar menu. Also used in mswin.vim and macmap.vim.
8
Bram Moolenaar314dd792019-02-03 15:27:20 +01009let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
10let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
11let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
Bram Moolenaar0fd92892006-03-09 22:27:48 +000012
Bram Moolenaar314dd792019-02-03 15:27:20 +010013func! paste#Paste()
14 let ove = &ve
15 set ve=all
16 normal! `^
17 if @+ != ''
18 normal! "+gP
19 endif
20 let c = col(".")
21 normal! i
22 if col(".") < c " compensate for i<ESC> moving the cursor left
23 normal! l
24 endif
25 let &ve = ove
26endfunc