view runtime/autoload/paste.vim @ 32836:f0854888250f

man.vim: Uniformly place cursor at the same column with `Ctrl-t` (#12608) Commit: https://github.com/vim/vim/commit/6e5ab2b994c3356fe91e8f9b701df52146fc0985 Author: goweol <goweol@gmail.com> Date: Fri Aug 18 06:12:42 2023 +0900 man.vim: Uniformly place cursor at the same column with `Ctrl-t` (https://github.com/vim/vim/issues/12608) Functions col and cursor count each tab (0x9) as a byte, and are complementary. On the other hand, the | command motion takes into consideration how many screen columns a tab does occupy and may move cursor to a column closer to the start of line than col would report at that position. The provided changes prefer the cursor function to the | command. Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 17 Aug 2023 23:15:05 +0200
parents 4027cefc2aab
children
line wrap: on
line source

" Vim support file to help with paste mappings and menus
" Maintainer:	The Vim Project <https://github.com/vim/vim>
" Last Change:	2023 Aug 10
" Former Maintainer:	Bram Moolenaar <Bram@vim.org>

" 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.

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"

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