annotate runtime/autoload/paste.vim @ 3963:1773d5aa6437 v7.3.737

updated for version 7.3.737 Problem: When using do_cmdline() recursively did_endif is not reset, causing messages to be overwritten. Solution: Reset did_endif. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Wed, 28 Nov 2012 17:34:48 +0100
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