annotate runtime/autoload/paste.vim @ 14966:d65790af8514 v8.1.0494

patch 8.1.0494: functions do not check for a window ID in other tabs commit https://github.com/vim/vim/commit/babfcf54ae9bf9570eddf4958a553635cd589e21 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 25 13:11:16 2018 +0200 patch 8.1.0494: functions do not check for a window ID in other tabs Problem: Functions do not check for a window ID in other tabs. Solution: Also find the window ID in other than the current tab.
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Oct 2018 13:15:05 +0200
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