blob: 2d787e7a1dd2a5c837293759ec84334e14149b0c [file] [log] [blame]
Bram Moolenaar0fd92892006-03-09 22:27:48 +00001" Vim support file to help with paste mappings and menus
2" Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar314dd792019-02-03 15:27:20 +01003" Last Change: 2019 Jan 27
Bram Moolenaar0fd92892006-03-09 22:27:48 +00004
5" Define the string to use for items that are present both in Edit, Popup and
6" Toolbar menu. Also used in mswin.vim and macmap.vim.
7
Bram Moolenaar314dd792019-02-03 15:27:20 +01008let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
9let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
10let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
Bram Moolenaar0fd92892006-03-09 22:27:48 +000011
Bram Moolenaar314dd792019-02-03 15:27:20 +010012func! paste#Paste()
13 let ove = &ve
14 set ve=all
15 normal! `^
16 if @+ != ''
17 normal! "+gP
18 endif
19 let c = col(".")
20 normal! i
21 if col(".") < c " compensate for i<ESC> moving the cursor left
22 normal! l
23 endif
24 let &ve = ove
25endfunc