-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsingleton.txt
More file actions
198 lines (144 loc) · 6.13 KB
/
singleton.txt
File metadata and controls
198 lines (144 loc) · 6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
*singleton.txt* Uses Vim with singleton.
Version: 1.1
Author : thinca <thinca+vim@gmail.com>
License: zlib License
==============================================================================
CONTENTS *singleton-contents*
INTRODUCTION |singleton-introduction|
FEATURES |singleton-features|
INTERFACE |singleton-interface|
FUNCTIONS |singleton-functions|
CUSTOMIZING |singleton-customizing|
PATTERN |singleton-pattern|
MERGE DEFAULT DICT |singleton-merge-default-dict|
LIMITATION |singleton-limitation|
CHANGELOG |singleton-changelog|
==============================================================================
INTRODUCTION *singleton-introduction*
*singleton* is a Vim plugin to use Vim with singleton.
This plugin provides the following features.
1. Avoid starting with multiplex.
2. Diff mode support.
3. Stdin(|--|) support.
4. Remote edit support.
See |singleton-features| for details.
You just call a function in vimrc for use.
>
call singleton#enable()
<
And Vim exits if given files by arguments
were successfully passed to remote Vim.
Requirements:
- Vim 7.3 or later
- |+clientserver|
Latest version:
https://github.com/thinca/vim-singleton
==============================================================================
FEATURES *singleton-features*
This plugin provides the following features.
1. Avoid starting with multiple Vim instances.
When you start Vim with one or more files, and remote Vim has already started,
this plugin opens the files by the existing Vim, and exits immediately.
2. Diff mode support.
If you start Vim by |vimdiff| or with |-d| option, this plugin opens the files
by diff mode by an existing Vim.
3. Stdin(|--|) support.
When stdin is supplied to Vim, the data is sent to an existing Vim.
4. Remote edit support.
When a file that matches to specified pattern(|g:singleton#entrust_pattern|)
was passed, this plugin opens the file by an existing Vim, and wait. The edit
has finished and the buffer is closed, the first Vim is terminate.
==============================================================================
INTERFACE *singleton-interface*
------------------------------------------------------------------------------
FUNCTIONS *singleton-functions*
singleton#enable() *singleton#enable()*
Enables this plugin.
See |singleton-features| for the details.
This works only at Vim startup.
singleton#is_master() *singleton#is_master()*
Returns true if this Vim instance is master.
singleton#get_master() *singleton#get_master()*
Returns the server name of master.
Returns an empty string if master does not exist.
singleton#set_master([{server-name}][, {val}]) *singleton#set_master()*
Sets a Vim as master. The master is only one always.
If the argument is a string, it is {server-name}. If omitted, set to
current Vim.
If the argument is a number, it is {val}. Default is 1.
val mean ~
1 Makes a master.
0 Stops a master.
-1 Never sets to master.
==============================================================================
CUSTOMIZING *singleton-customizing*
g:singleton#ignore_pattern *g:singleton#ignore_pattern*
A pattern(|singleton-pattern|) for specifying the file which should
be ignored.
If you want to add key/value pair, see |singleton-merge-default-dict|.
Default: empty
g:singleton#entrust_pattern *g:singleton#entrust_pattern*
A pattern(|singleton-pattern|) for specifying the file which should
be entrusted to remote Vim.
It means, Vim waits until remote file is closed.
This is useful to get along with version control systems.
If you want to add key/value pair, see |singleton-merge-default-dict|.
Default: Files for Subversion, Git, Hg, and Bazaar.
This is large. See the variable directly for details.
g:singleton#treat_stdin *g:singleton#treat_stdin*
Is whether to treat stdin.
Default: 1
g:singleton#opener *g:singleton#opener*
A command to open a buffer.
Default: "tab drop"
g:singleton#opener_file *g:singleton#opener_file*
g:singleton#opener_entrust *g:singleton#opener_entrust*
g:singleton#opener_diff *g:singleton#opener_diff*
g:singleton#opener_stdin *g:singleton#opener_stdin*
Specialized version of opener for each situation.
If these are not defined, |g:singleton#opener| is used.
g:singleton#group *g:singleton#group*
Group name. This plugin connects to same groups only.
Default: $USER . $USERNAME
g:singleton#disable *g:singleton#disable*
Disables this plugin.
Usually, you do not need to set this variable.
You can disable this plugin from command-line argument. >
$ vim --cmd "let g:singleton#disable=1"
< Default: 0
------------------------------------------------------------------------------
PATTERN *singleton-pattern*
A pattern is one of following.
1. A string which is |regexp|.
2. A list of patterns.
All patterns are made |regexp| and joined as |regexp|.
3. A dictionary which has pattern as value.
The values as list are treated like 2.
------------------------------------------------------------------------------
MERGE DEFAULT DICT *singleton-merge-default-dict*
If you want to add key/value pair while keeping default value, you can write: >
let g:singleton#entrust_pattern = extend({
\ 'foo' : ['/path/to/foo-file', '/more/path/to/foo-file'],
\ 'bar' : '/tmp/.*bar.*',
\}, g:singleton#entrust_pattern, 'keep')
<
If you want to overwrite default value, you can write: >
let g:singleton#entrust_pattern = {
\ 'foo' : ['/path/to/foo-file', '/more/path/to/foo-file'],
\ 'bar' : '/tmp/.*bar.*',
\}
<
==============================================================================
LIMITATION *singleton-limitation*
- Vim script can not know command line arguments of vim. So, this plugin can
not change the behavior by these.
- ex: |-o| |-O| |-p| |-f| |-+| |-+/| ...
==============================================================================
CHANGELOG *singleton-changelog*
1.1 2012-12-26
- Fix the timing of |remote_foreground()|.
- Improve default value for svn.
1.0 2012-02-01
- Initial version.
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl