Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 1 | " Vim support file to help with paste mappings and menus |
Christian Brabandt | e978b45 | 2023-08-13 10:33:05 +0200 | [diff] [blame] | 2 | " Maintainer: The Vim Project <https://github.com/vim/vim> |
| 3 | " Last Change: 2023 Aug 10 |
| 4 | " Former Maintainer: Bram Moolenaar <Bram@vim.org> |
Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 5 | |
| 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 Moolenaar | 314dd79 | 2019-02-03 15:27:20 +0100 | [diff] [blame] | 9 | let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} |
| 10 | let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] |
| 11 | let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP" |
Bram Moolenaar | 0fd9289 | 2006-03-09 22:27:48 +0000 | [diff] [blame] | 12 | |
Bram Moolenaar | 314dd79 | 2019-02-03 15:27:20 +0100 | [diff] [blame] | 13 | func! 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 |
| 26 | endfunc |