2014-07-10 21:05:51 -07:00
|
|
|
|
" Vim support file to help with paste mappings and menus
|
|
|
|
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
2019-07-28 18:16:37 -07:00
|
|
|
|
" Last Change: 2019 Jan 27
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
|
|
" Define the string to use for items that are present both in Edit, Popup and
|
|
|
|
|
" Toolbar menu. Also used in mswin.vim and macmap.vim.
|
|
|
|
|
|
2019-07-28 18:16:37 -07:00
|
|
|
|
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
|
|
|
|
|
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
|
|
|
|
|
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
2019-07-28 18:16:37 -07:00
|
|
|
|
func! paste#Paste()
|
|
|
|
|
let ove = &ve
|
|
|
|
|
set ve=all
|
|
|
|
|
normal! `^
|
|
|
|
|
if @+ != ''
|
|
|
|
|
normal! "+gP
|
|
|
|
|
endif
|
|
|
|
|
let c = col(".")
|
|
|
|
|
normal! i
|
|
|
|
|
if col(".") < c " compensate for i<ESC> moving the cursor left
|
|
|
|
|
normal! l
|
|
|
|
|
endif
|
|
|
|
|
let &ve = ove
|
|
|
|
|
endfunc
|