Skip to content

Commit fedc7fb

Browse files
authored
Merge pull request #524 from vim-jp/add-missing-doc
Add missing doc
2 parents 40593fe + 38db89b commit fedc7fb

File tree

5 files changed

+264
-67
lines changed

5 files changed

+264
-67
lines changed

doc/vital/Data/String.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ dstring({expr}) *Vital.Data.String.dstring()*
139139
lines({str}) *Vital.Data.String.lines()*
140140
Splits into list of strings of each lines of {str}.
141141

142+
strchars({str}) *Vital.Data.String.strchars()*
143+
Returns the number of characters in String {str}.
144+
This is a polyfill of |strchars()| when it was not provided.
145+
142146
contains_multibyte({str}) *Vital.Data.String.contains_multibyte()*
143147
Return Number 1 if String {str} contains a multi-byte character,
144148
otherwise zero.

doc/vital/Mapping.txt

Lines changed: 118 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vital/Mapping.txt* Utilities for mapping.
1+
*vital/Mapping.txt* Utilities for mapping / abbreviation.
22

33
Maintainer: tyru <[email protected]>
44

@@ -12,14 +12,129 @@ INTERFACE |Vital.Mapping-interface|
1212
==============================================================================
1313
INTRODUCTION *Vital.Mapping-introduction*
1414

15-
*Vital.Mapping* is TODO
15+
*Vital.Mapping* is a utility functions related to |:map|, |:unmap|,
16+
|:abbreviate|, |:unabbreviate| commands.
1617

1718
==============================================================================
1819
INTERFACE *Vital.Mapping-interface*
1920
------------------------------------------------------------------------------
2021
FUNCTIONS *Vital.Mapping-functions*
2122

22-
TODO
23+
*Vital.Mapping.execute_abbr_command()*
24+
execute_abbr_command({mode}, {dict}, {lhs}, {rhs})
25+
Execute `get_abbr_command(mode, dict, lhs, rhs)` result.
26+
See |Mapping.get_abbr_command()|.
27+
28+
*Vital.Mapping.execute_map_command()*
29+
execute_map_command({mode}, {dict}, {lhs}, {rhs})
30+
Execute `get_map_command(mode, dict, lhs, rhs)` result.
31+
See |Mapping.get_map_command()|.
32+
33+
*Vital.Mapping.execute_unmap_command()*
34+
execute_unmap_command({mode}, {dict}, {lhs})
35+
Execute `get_unmap_command(mode, dict, lhs)` result.
36+
See |Mapping.get_unmap_command()|.
37+
38+
*Vital.Mapping.get_all_modes()*
39+
get_all_modes()
40+
Returns string which represents all mode characters ("noiclxs").
41+
NOTE: "v" is not contained. Because "x" and "s" already mean "v".
42+
43+
*Vital.Mapping.get_all_modes_list()*
44+
get_all_modes_list()
45+
Returns |List| which represents all mode characters.
46+
Same as `split(get_all_modes(), '\zs')` .
47+
See |Mapping.get_all_modes()|.
48+
49+
*Vital.Mapping.get_abbr_command()*
50+
get_abbr_command({mode}, {dict}, {lhs}, {rhs})
51+
Constructs |:abbreviate| command string.
52+
{mode} is a character of mode.
53+
{dict} is a |Dictionary| of options.
54+
{lhs} and {rhs} are strings of lhs/rhs of |:map| command.
55+
The options can be created by |Mapping.options_chars2dict()| or
56+
|maparg()|'s return value when {dict} is non-zero.
57+
58+
*Vital.Mapping.get_map_command()*
59+
get_map_command({mode}, {dict}, {lhs}, {rhs})
60+
Constructs |:map| command string.
61+
{mode} is a character of mode.
62+
{dict} is a |Dictionary| of options.
63+
{lhs} and {rhs} are strings of lhs/rhs of |:map| command.
64+
The options can be created by |Mapping.options_chars2dict()| or
65+
|maparg()|'s return value when {dict} is non-zero.
66+
67+
*Vital.Mapping.get_unabbr_command()*
68+
get_unabbr_command({mode}, {dict}, {lhs})
69+
Constructs |:unabbreviate| command string.
70+
{mode} is a character of mode.
71+
{dict} is a |Dictionary| of options.
72+
{lhs} is a string of lhs of |:map| command.
73+
The options can be created by |Mapping.options_chars2dict()| or
74+
|maparg()|'s return value when {dict} is non-zero.
75+
76+
*Vital.Mapping.get_unmap_command()*
77+
get_unmap_command({mode}, {dict}, {lhs})
78+
Constructs |:unabbreviate| command string.
79+
{mode} is a character of mode.
80+
{dict} is a |Dictionary| of options.
81+
{lhs} is a string of lhs of |:map| command.
82+
The options can be created by |Mapping.options_chars2dict()| or
83+
|maparg()|'s return value when {dict} is non-zero.
84+
85+
*Vital.Mapping.options_chars2dict()*
86+
options_chars2dict({chars})
87+
{chars} is a string which represents characters of options.
88+
The return value is a |Dictionary| which is same as |maparg()|'s
89+
return value when {dict} is non-zero.
90+
91+
chars key ~
92+
"e" expr
93+
"b" buffer
94+
"s" silent
95+
"S" script
96+
"u" unique
97+
"r" noremap (inverse)
98+
"n" nowait
99+
100+
Example: >
101+
options_chars2dict("bs") = {
102+
"expr": 0,
103+
"buffer": 1,
104+
"silent": 1,
105+
"script": 0,
106+
"unique": 0,
107+
"noremap": 1,
108+
"nowait": 0,
109+
}
110+
<
111+
*Vital.Mapping.options_chars2raw()*
112+
options_chars2raw({chars})
113+
Same as `options_dict2raw(options_chars2dict(chars))` .
114+
See |Mapping.options_dict2raw()| and |Mapping.options_chars2dict()|.
115+
116+
Example: >
117+
options_dict2chars('eb') = '<expr><buffer>'
118+
<
119+
*Vital.Mapping.options_dict2chars()*
120+
options_dict2chars({dict})
121+
Converts {dict} to characters of options.
122+
123+
Example: >
124+
options_dict2chars({'expr': 1, 'buffer': 1}) = 'eb'
125+
<
126+
*Vital.Mapping.options_dict2raw()*
127+
options_dict2raw({dict})
128+
{dict} is a |Dictionary| which represents options.
129+
See |Mapping.options_chars2dict()| for the options.
130+
131+
Example: >
132+
options_dict2raw({'expr': 1, 'buffer': 1}) = '<expr><buffer>'
133+
<
134+
*Vital.Mapping.is_mode_char()*
135+
is_mode_char({char})
136+
Returns non-zero if {char} is a character one of
137+
"v", "n", "o", "i", "c", "l", "x", "s".
23138

24139
==============================================================================
25140
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

doc/vital/Web/URI.txt

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ like_uri({str}) *Vital.Web.URI.like_uri()*
6868

6969
*Vital.Web.URI.new_default_pattern_set()*
7070
new_default_pattern_set()
71-
Returns |Vital.Web.URI-PatternSet|.
71+
Creates a new |Vital.Web.URI-PatternSet| object.
72+
73+
*Vital.Web.URI.clone_pattern_set()*
74+
clone_pattern_set({patternset})
75+
Clones a |Vital.Web.URI-PatternSet| object.
7276

7377
encode({str} [, {char-enc}]) *Vital.Web.URI.encode()*
7478
Encodes {str} to Percent-encoding string.
@@ -144,70 +148,70 @@ is_path({str})
144148
is_query({str})
145149
is_fragment({str})
146150

147-
Returns non-zero value if {str} has right syntax
148-
for each component. Returns zero otherwise.
151+
Returns non-zero value if {str} has right syntax
152+
for each component. Returns zero otherwise.
149153

150154
*Vital.Web.URI-URI.clone()*
151155
clone()
152156

153-
This method clones a URI object itself. >
154-
let s:URI = vital#{plugin-name}#new().import('Web.URI')
155-
let uri = s:URI.new('http://example.com/')
156-
let copyuri = uri.clone().relative('/a/b/c')
157-
echo uri.to_string()
158-
" => 'http://example.com/'
159-
echo copyuri.to_string()
160-
" => 'http://example.com/a/b/c'
157+
This method clones a URI object itself. >
158+
let s:URI = vital#{plugin-name}#new().import('Web.URI')
159+
let uri = s:URI.new('http://example.com/')
160+
let copyuri = uri.clone().relative('/a/b/c')
161+
echo uri.to_string()
162+
" => 'http://example.com/'
163+
echo copyuri.to_string()
164+
" => 'http://example.com/a/b/c'
161165
<
162166
*Vital.Web.URI-URI.relative()*
163167
relative({reluri})
164168

165-
This method ...
166-
* Calculates a URI from
167-
base URI and relative URI({reluri}).
168-
* Changes the URI object itself (destructive).
169-
* Returns the URI object itself.
170-
* Calls |Vital.Web.URI-URI.relative()| implicitly.
171-
172-
Example: >
173-
let s:URI = vital#{plugin-name}#new().import('Web.URI')
174-
let BASE_URI = 'http://example.com/foo/bar'
175-
let RELATIVE_URI = '../baz'
176-
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
177-
" => 'http://example.com/baz'
178-
179-
let BASE_URI = 'http://example.com/foo/bar/'
180-
let RELATIVE_URI = '../baz'
181-
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
182-
" => 'http://example.com/foo/baz'
169+
This method ...
170+
* Calculates a URI from
171+
base URI and relative URI({reluri}).
172+
* Changes the URI object itself (destructive).
173+
* Returns the URI object itself.
174+
* Calls |Vital.Web.URI-URI.relative()| implicitly.
175+
176+
Example: >
177+
let s:URI = vital#{plugin-name}#new().import('Web.URI')
178+
let BASE_URI = 'http://example.com/foo/bar'
179+
let RELATIVE_URI = '../baz'
180+
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
181+
" => 'http://example.com/baz'
182+
183+
let BASE_URI = 'http://example.com/foo/bar/'
184+
let RELATIVE_URI = '../baz'
185+
echo s:URI.new(BASE_URI).relative(RELATIVE_URI).to_string()
186+
" => 'http://example.com/foo/baz'
183187
<
184188
*Vital.Web.URI-URI.canonicalize()*
185189
canonicalize()
186190

187-
This method ...
188-
* Canonicalizes the URI.
189-
* Changes the URI object itself (destructive).
190-
* Returns the URI object itself.
191-
192-
See Web.URI.* modules for supported schemes.
193-
For example, the following four URIs
194-
becomes equivalent URI (http://example.com/).
195-
* http://example.com
196-
* http://example.com/
197-
* http://example.com:/
198-
* http://example.com:80/
199-
200-
Example: >
201-
let s:URI = vital#{plugin-name}#new().import('Web.URI')
202-
echo s:URI.new('http://example.com:80/').to_string()
203-
" => 'http://example.com/'
191+
This method ...
192+
* Canonicalizes the URI.
193+
* Changes the URI object itself (destructive).
194+
* Returns the URI object itself.
195+
196+
See Web.URI.* modules for supported schemes.
197+
For example, the following four URIs
198+
becomes equivalent URI (http://example.com/).
199+
* http://example.com
200+
* http://example.com/
201+
* http://example.com:/
202+
* http://example.com:80/
203+
204+
Example: >
205+
let s:URI = vital#{plugin-name}#new().import('Web.URI')
206+
echo s:URI.new('http://example.com:80/').to_string()
207+
" => 'http://example.com/'
204208
<
205209
*Vital.Web.URI-URI.default_port()*
206210
default_port()
207211

208-
This method returns the default port for current scheme.
209-
(e.g.: 80 for "http" scheme)
210-
See Web.URI.* modules for supported schemes.
212+
This method returns the default port for current scheme.
213+
(e.g.: 80 for "http" scheme)
214+
See Web.URI.* modules for supported schemes.
211215

212216
------------------------------------------------------------------------------
213217
PATTERNSET OBJECT *Vital.Web.URI-PatternSet*
@@ -232,28 +236,28 @@ According to RFC3986, URI allows
232236
but these characters often appears in ordinary text.
233237
This code lets the parser ignore these characters. >
234238
235-
let s:LoosePatternSet = s:URI.new_default_pattern_set()
239+
let s:LoosePatternSet = s:URI.new_default_pattern_set()
236240
237-
" Remove "'", "(", ")" from default sub_delims().
238-
function! s:LoosePatternSet.sub_delims() abort
239-
return '[!$&*+,;=]'
240-
endfunction
241+
" Remove "'", "(", ")" from default sub_delims().
242+
function! s:LoosePatternSet.sub_delims() abort
243+
return '[!$&*+,;=]'
244+
endfunction
241245
242-
" Ignore trailing string after URI.
243-
let NONE = []
244-
let ret = URI.new_from_seq_string(
245-
\ 'http://example.com)', NONE, s:LoosePatternSet)
246-
if ret isnot NONE
247-
...
248-
endif
246+
" Ignore trailing string after URI.
247+
let NONE = []
248+
let ret = URI.new_from_seq_string(
249+
\ 'http://example.com)', NONE, s:LoosePatternSet)
250+
if ret isnot NONE
251+
...
252+
endif
249253
<
250254

251255
get({component}) *Vital.Web.URI-PatternSet.get()*
252256

253-
Returns each component definition.
257+
Returns each component definition.
254258
>
255-
let s:PatternSet = s:URI.new_default_pattern_set()
256-
echo s:PatternSet.get('scheme')
259+
let s:PatternSet = s:URI.new_default_pattern_set()
260+
echo s:PatternSet.get('scheme')
257261
<
258262
Listing all customizable components here (alphabetic order).
259263
NOTE: DON'T call these methods directly.

doc/vital/Web/URI/HTTP.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
*vital/Web/URI/HTTP.txt* http scheme handler for Web.URI
2+
3+
Maintainer: tyru <[email protected]>
4+
5+
==============================================================================
6+
CONTENTS *Vital.Web.URI.HTTP-contents*
7+
8+
INTRODUCTION |Vital.Web.URI.HTTP-introduction|
9+
INTERFACE |Vital.Web.URI.HTTP-interface|
10+
Functions |Vital.Web.URI.HTTP-functions|
11+
12+
==============================================================================
13+
INTRODUCTION *Vital.Web.URI.HTTP-introduction*
14+
15+
*Vital.Web.URI.HTTP* is a http scheme handler for |Vital.Web.URI|.
16+
17+
==============================================================================
18+
INTERFACE *Vital.Web.URI.HTTP-interface*
19+
------------------------------------------------------------------------------
20+
FUNCTIONS *Vital.Web.URI.HTTP-functions*
21+
22+
canonicalize({uri}) *Vital.Web.URI.HTTP.canonicalize()*
23+
Canonicalizes {uri}. {uri} is a |Vital.Web.URI-URI| object.
24+
25+
* Set '/' to its path if its path is empty
26+
* If its port is the same as a default port of http scheme (80),
27+
make the URI's port empty
28+
29+
For example, the following four URIs are equivalent:
30+
* http://example.com
31+
* http://example.com/
32+
* http://example.com:/
33+
* http://example.com:80/
34+
This function canonicalizes them to http://example.com/ .
35+
36+
ref. https://tools.ietf.org/html/rfc3986#section-6.2.3
37+
38+
default_port()
39+
*Vital.Web.URI.HTTP.default_port()*
40+
Returns a string of a default port of http scheme ("80").
41+
42+
==============================================================================
43+
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

0 commit comments

Comments
 (0)