paste.vim 723 B

123456789101112131415161718192021222324252627
  1. " Vim support file to help with paste mappings and menus
  2. " Maintainer: The Vim Project <https://github.com/vim/vim>
  3. " Last Change: 2023 Aug 10
  4. " Former Maintainer: Bram Moolenaar <Bram@vim.org>
  5. " Define the string to use for items that are present both in Edit, Popup and
  6. " Toolbar menu. Also used in mswin.vim.
  7. let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
  8. let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
  9. let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
  10. func! paste#Paste()
  11. let ove = &ve
  12. set ve=all
  13. normal! `^
  14. if @+ != ''
  15. normal! "+gP
  16. endif
  17. let c = col(".")
  18. normal! i
  19. if col(".") < c " compensate for i<ESC> moving the cursor left
  20. normal! l
  21. endif
  22. let &ve = ove
  23. endfunc