@@ -109,19 +109,6 @@ cat mylog.log | vims -e '^\s*$' 'dd' -l 'Vu'
109
109
- ` -l ` - Turn off exe mode, turn on line exe mode
110
110
111
111
## Example 3
112
- Resolve all git conflicts by deleting the changes on HEAD (keep the bottom code):
113
-
114
- ```
115
- cat my_conflict.cpp | vims -e '^=======$' 'V?^<<<<<<< \<enter>d' -t '%g/^>>>>>>> /d'
116
- ```
117
-
118
- - ` -e ` - Turn on exe mode
119
- - ` ^=======$ ` - Match the middle bit of a git conflict
120
- - ` V?^<<<<<<< \<enter>d ` - Highlight the line, backward search to the top of the conflict, delete it.
121
- - ` -t ` - Turn off exe mode
122
- - ` %g/^>>>>>>> /d ` - Delete remaining conflict lines
123
-
124
- ## Example 4
125
112
126
113
Add a comment (` # ` ) on every line NOT containing foo:
127
114
@@ -133,9 +120,9 @@ cat script.sh | vims -r 'foo' 'A # Comment'
133
120
- ` foo ` - Match all lines with the word "foo"
134
121
- ` A # Comment ` - At the end of the line, type " # Comment"
135
122
136
- ## Example 5
123
+ ## Example 4
137
124
138
- Say you want to move all Python classes to the bottom of a file:
125
+ Move all Python classes to the bottom of a file:
139
126
```
140
127
cat myscript.py | vims -e '^class' 'V/^\\S\<enter>kdGp'
141
128
```
@@ -145,7 +132,7 @@ cat myscript.py | vims -e '^class' 'V/^\\S\<enter>kdGp'
145
132
- ` exe ` - Execute the following, including escaped sequences (so you can call ` \<c-o> ` to mean Ctrl-o)
146
133
- ` norm V/^\S\<enter>kdGp ` Enter normal mode, visual select to the next zero-indentation line, move up a line, delete, paste it at the bottom
147
134
148
- ## Example 6
135
+ ## Example 5
149
136
150
137
Only print the last 6 lines (just like tail)
151
138
@@ -156,7 +143,7 @@ cat txt | vims -n '$-5,$p'
156
143
- ` $-5,$ ` - A range extending from 6th last line to the last line
157
144
- ` p ` - Print
158
145
159
- ## Example 7
146
+ ## Example 6
160
147
161
148
Replace all multi-whitespace sequences with a single space:
162
149
@@ -173,6 +160,20 @@ cat txt | vims -e '.' ':s/\\s\\+/ /g\<enter>'
173
160
Note the double back-slashes needed (only in the second string of a pair in an exe command!)
174
161
when you are typing a character like ` \s ` , but not like ` \<enter> ` .
175
162
163
+ ## Example 7
164
+ Resolve all git conflicts by deleting the changes on HEAD (keep the bottom code):
165
+
166
+ ```
167
+ cat my_conflict.cpp | vims -e '^=======$' 'V?^<<<<<<< \<enter>d' -t '%g/^>>>>>>> /d'
168
+ ```
169
+
170
+ - ` -e ` - Turn on exe mode
171
+ - ` ^=======$ ` - Match the middle bit of a git conflict
172
+ - ` V?^<<<<<<< \<enter>d ` - Highlight the line, backward search to the top of the conflict, delete it.
173
+ - ` -t ` - Turn off exe mode
174
+ - ` %g/^>>>>>>> /d ` - Delete remaining conflict lines
175
+
176
+
176
177
## Example 8
177
178
178
179
Uncomment all commented-out lines (comment char: ` # ` )
0 commit comments