annotate runtime/autoload/paste.vim @ 12770:89889fea43e0

Added tag v8.0.1262 for changeset 083ae2cfcc5b13d3438d6d0489865aa3612d8c75
author Christian Brabandt <cb@256bit.org>
date Sat, 04 Nov 2017 21:00:06 +0100
parents d91cf2e26ef0
children fe57e4f0eac1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
718
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
1 " Vim support file to help with paste mappings and menus
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
2 " Maintainer: Bram Moolenaar <Bram@vim.org>
12499
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 907
diff changeset
3 " Last Change: 2017 Aug 30
718
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
4
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
5 " Define the string to use for items that are present both in Edit, Popup and
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
6 " Toolbar menu. Also used in mswin.vim and macmap.vim.
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
7
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
8 " Pasting blockwise and linewise selections is not possible in Insert and
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
9 " Visual mode without the +virtualedit feature. They are pasted as if they
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
10 " were characterwise instead. Add to that some tricks to leave the cursor in
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
11 " the right position, also for "gi".
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
12 if has("virtualedit")
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
13 let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
14 let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
12499
d91cf2e26ef0 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 907
diff changeset
15 let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
718
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
16
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
17 func! paste#Paste()
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
18 let ove = &ve
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
19 set ve=all
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
20 normal! `^
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
21 if @+ != ''
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
22 normal! "+gP
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
23 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
24 let c = col(".")
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
25 normal! i
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
26 if col(".") < c " compensate for i<ESC> moving the cursor left
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
27 normal! l
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
28 endif
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
29 let &ve = ove
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
30 endfunc
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
31 else
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
32 let paste#paste_cmd = {'n': "\"=@+.'xy'<CR>gPFx\"_2x"}
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
33 let paste#paste_cmd['v'] = '"-c<Esc>gix<Esc>' . paste#paste_cmd['n'] . '"_x'
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
34 let paste#paste_cmd['i'] = 'x<Esc>' . paste#paste_cmd['n'] . '"_s'
7b21554be7a1 updated for version 7.0219
vimboss
parents:
diff changeset
35 endif