forked from vphantom/vim-obsession
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVim.E-Tech
99 lines (71 loc) · 3.22 KB
/
Vim.E-Tech
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
#@vim.E-Tech
#create new files
#compile
#Follow YAML File Format
#YAML file consists of the following data types
Scalars: Scalars are values like Strings, Integers, Booleans, etc.
Sequences: Sequences are lists with each item starting with a hyphen (-). Lists can also be nested.
Mappings: Mapping gives the ability to list keys with values.
#Features Edit
Indented delimiting Edit
Because YAML primarily relies on outline indentation for structure, it is especially resistant to delimiter collision. YAML's insensitivity to quotation marks and braces in scalar values means one may embed XML, JSON or even YAML documents inside a YAML document by simply indenting it in a block literal (using | or >):
---
example: >
HTML goes into YAML without modification
message: |
<blockquote style="font: italic 1em serif">
<p>"Three is always greater than two,
even for large values of two"</p>
<p>--Author Unknown</p>
</blockquote>
date: 2022-04-08
#[A, B, C]
Associative Array: An associative array is surrounded by curly brackets ({…}). The keys and values are separated by colon(:) and each pair is separated by comma (,).
{name: John Smith, age: 20}
Strings: String can be written with or without double-quotes (") or single-quotes (’).
Sample String
"Sample String"
'Sample String'
Scalar Block content: Scalar content can be written in block notation by using the following:
|: All live breaks are significant.
>: Each line break is folded to space. It removes the leading whitespace for each line.
data: |
YAML
(YAML Ain't Markup Language)
is a data-serialization language
data: ?
YAML (YAML Ain't Markup Language)
is a data-serialization language
Multiple Documents: Multiple documents are separated by three hyphens (—) in a single stream. Hyphens indicate the start of the document. Hyphens are also used to separate directives from document content. The end of the document is indicated by three dots (…).
---
Document 1
---
Document 2
...
Type: To specify the type of value, double exclamation marks (!!) are used.
a: !!float 123
b: !!str 123
Tag: To assign a tag to a note, an ampersand (&) is used and to reference that node, an asterisk (*) is used.
name: John Smith
bill-to: &id01
street: |
123 Tornado Alley
Suite 16
city: East Centerville
state: KS
state: KS
ship-to: *id01
Directives: YAML documents can be preceded by directives in a stream. Directives begin with a percent sign (%) followed by the name and then the parameters separated by spaces.
%YAML 1.2
---
Document content
YAML file example
Here you can see a docker yaml file example below:
topology:
database_node_name: docker_controller
docker_controller_node_name: docker_controller
self_service_portal_node_name: docker_controller
kvm_compute_node_names: kvm_compute1
docker_compute_node_names: docker_compute1
YAML vs JSON
Basically, both JSON and YAML are developed to provide a human-readable data interchange format. The YAML is realized as a superset of JSON format. It means that we can parse JSON using a YAML parser. Although the practical implementation of this theory is little tricky. Therefore, some basic differences between YAML and JSON are given below: