annotate runtime/autoload/paste.vim @ 9485:c16e207dc465 v7.4.2023

commit https://github.com/vim/vim/commit/ea3f2e7be447a8f0c4436869620f908de5e8ef1e Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 10 20:27:32 2016 +0200 patch 7.4.2023 Problem: buflist_findname_stat() may find a dummy buffer. Solution: Set the BF_DUMMY flag after loading a dummy buffer. Start finding buffers from the end of the list.
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Jul 2016 20:30:06 +0200
parents 5e168526af25
children d91cf2e26ef0
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>
907
5e168526af25 updated for version 7.0-033
vimboss
parents: 839
diff changeset
3 " Last Change: 2006 Jun 23
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']
907
5e168526af25 updated for version 7.0-033
vimboss
parents: 839
diff changeset
15 let paste#paste_cmd['i'] = 'x<BS><Esc>' . paste#paste_cmd['n'] . 'gi'
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