annotate runtime/plugin/rrhelper.vim @ 22309:59a0d8be7c65

Added tag v8.2.1703 for changeset 19e0784ef76916f0c6816cf123fd971711822b76
author Bram Moolenaar <Bram@vim.org>
date Thu, 17 Sep 2020 20:00:07 +0200
parents f177a6431514
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim plugin with helper function(s) for --remote-wait
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Maintainer: Flemming Madsen <fma@cci.dk>
1623
53938adac247 updated for version 7.2a
vimboss
parents: 7
diff changeset
3 " Last Change: 2008 May 29
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Has this already been loaded?
2325
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
6 if exists("loaded_rrhelper") || !has("clientserver")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 let loaded_rrhelper = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " Setup answers for a --remote-wait client who will assume
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " a SetupRemoteReplies() function in the command server
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
2325
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
14 function SetupRemoteReplies()
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
15 let cnt = 0
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
16 let max = argc()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
2325
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
18 let id = expand("<client>")
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
19 if id == 0
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
20 return
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
21 endif
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
22 while cnt < max
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
23 " Handle same file from more clients and file being more than once
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
24 " on the command line by encoding this stuff in the group name
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
25 let uniqueGroup = "RemoteReply_".id."_".cnt
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
2325
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
27 " Path separators are always forward slashes for the autocommand pattern.
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
28 " Escape special characters with a backslash.
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
29 let f = substitute(argv(cnt), '\\', '/', "g")
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
30 if exists('*fnameescape')
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
31 let f = fnameescape(f)
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
32 else
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
33 let f = escape(f, " \t\n*?[{`$\\%#'\"|!<")
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
34 endif
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
35 execute "augroup ".uniqueGroup
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
36 execute "autocmd ".uniqueGroup." BufUnload ". f ." call DoRemoteReply('".id."', '".cnt."', '".uniqueGroup."', '". f ."')"
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
37 let cnt = cnt + 1
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
38 endwhile
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
39 augroup END
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
40 endfunc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
2325
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
42 function DoRemoteReply(id, cnt, group, file)
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
43 call server2client(a:id, a:cnt)
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
44 execute 'autocmd! '.a:group.' BufUnload '.a:file
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
45 execute 'augroup! '.a:group
f177a6431514 Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
Bram Moolenaar <bram@vim.org>
parents: 1623
diff changeset
46 endfunc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 " vim: set sw=2 sts=2 :