@@ -1186,6 +1186,160 @@ multiple cursors, they won't be uncommented but commented again.
11861186
11871187
11881188
1189+=================================================================
1190+= 12.1 USING MATCH MODE JUMP =
1191+=================================================================
1192+
1193+To switch to match mode from normal mode, type m. This feature
1194+is particularly useful for handling bracket pairs and their
1195+contents.
1196+
1197+There are several actions that can be performed in match mode,
1198+as indicated by the help pop-up. To jump to a matching bracket pair,
1199+simply press mm. For example on the lines below (starting with
1200+-->), move the cursor in normal mode to (, and then press mm to jump
1201+to the matching ). You can do the same on the line below: for example
1202+move to ], and press mm to jump to [ .
1203+
1204+--> you can (jump between matching parenthesis)
1205+--> or between matching [ square brackets ]
1206+--> now { you know the drill: this works with brackets too }
1207+
1208+
1209+
1210+
1211+=================================================================
1212+= 12.2 USING MATCH MODE SELECT INSIDE =
1213+=================================================================
1214+
1215+Match mode also lets you select the "inside" content between a
1216+pair of brackets or other delimiters. In the lines below:
1217+
1218+- move to the --> line, put your cursor in normal mode at any
1219+location between the parenthesis, for example at 'x', and press
1220+mi( or mi) to select the whole content inside the parenthesis
1221+(parenthesis excluded). As usual, you can then do anything you want
1222+with the selection (for example, press c to change it)
1223+
1224+--> outside and (inside x parenthesis) - and outside again
1225+
1226+Test below that you can do the same with [], or {}, or with
1227+nested combinations of these (this will act on the immediately
1228+surrounding matching pair). This also works with "" and similar
1229+
1230+--> test [ with square brackets ] !
1231+--> try ( with nested [ pairs of ( parenthesis) and "brackets" ])
1232+
1233+=================================================================
1234+= 12.3 USING MATCH MODE SELECT AROUND =
1235+=================================================================
1236+
1237+You can also select the "around" content, i.e. both the inside
1238+content and the delimiters themselves, by using the ma select.
1239+For example, move to the line under, move your cursor in normal
1240+mode to any position between the (), and select the content of
1241+the (), including the surrounding (), by typing ma( or ma). As
1242+usual, you can do anything you want with the selection, for
1243+example delete it all with ma(d .
1244+
1245+--> you ( select x around ) to include delimiters in the select
1246+
1247+This naturally works with other delimiters too:
1248+
1249+--> try [ with 'square' brackets ] too!
1250+
1251+
1252+
1253+
1254+
1255+=================================================================
1256+= 12.4 USING MATCH MODE SURROUND =
1257+=================================================================
1258+
1259+The match mode can also be used to add surrounding around the
1260+current selection. For example, move to the line below, then:
1261+ * i) select the "select all of this" line segment (for example,
1262+move in normal mode the cursor to the start of select, then enter
1263+selection mode with v , then select the 4 next words with 4e ),
1264+ * ii) press ms( or ms) to surround the selection with a pair of
1265+parenthesis.
1266+
1267+--> so, select all of this, and surround it with ()
1268+
1269+You can do the same with other delimiters: for example, ms' on
1270+WORD below to surround it with a pair of ''. You can try also
1271+with adding a surrounding pair of "", or {}, or [].
1272+
1273+--> surround this WORD !
1274+
1275+
1276+
1277+=================================================================
1278+= 12.5 USING MATCH MODE DELETE SURROUND =
1279+=================================================================
1280+
1281+You can delete surrounding pair of delimiters with the md
1282+command. On the line below, move the cursor anywhere
1283+within the pair of (), for example to the 'x', then from there,
1284+in normal mode, press md( or md) to delete the surrounding
1285+pair of parenthesis.
1286+
1287+--> delete (the x pair of parenthesis) from within!
1288+
1289+You can naturally delete other kinds of surroundings:
1290+
1291+--> delete (nested [delimiters]): "this" will delete the nearest
1292+matching surrounding pair.
1293+--> delete "layers "of" quote marks" too: this will delete the
1294+nearest previous and following quote marks
1295+
1296+Trying to delete unexisting surrounding delimiters print an error
1297+at the bottom bar and does nothing.
1298+
1299+=================================================================
1300+= 12.6 USING MATCH MODE REPLACE SURROUND =
1301+=================================================================
1302+
1303+You can replace surrounding pairs of delimiters with the mr
1304+command. On the line below, move the cursor to
1305+anywhere within the pair of (), for example on the 'x', then in
1306+normal mode, press mr([ to replace the pair of () with a pair
1307+of [].
1308+
1309+--> replace the (pair from x within), with something else
1310+
1311+This command will act on the closest enclosing pair, so you
1312+can try replacing different surrounding in the following:
1313+
1314+--> some (nested surroundings [can be replaced])
1315+--> this "works with 'other surroundings' too"
1316+
1317+You can try to replace a non existing pair: this will show
1318+an error warning at the bottom bar and do nothing.
1319+
1320+
1321+=================================================================
1322+= CHAPTER 12 RECAP =
1323+=================================================================
1324+
1325+You can enter the match mode with the m key; this will show the
1326+actions available in a popup. This will allow you to:
1327+ * jump to matching pair of delimiters with mm (you must have a
1328+ delimiter belonging to a pair under your cursor)
1329+ * select inside a pair of delimiters surrounding your cursor
1330+ (i.e. select the content but not the delimiters) with mi(
1331+ and similar
1332+ * select around a pair of delimiters surrounding your cursor
1333+ (i.e. select the content and the delimiters) with ma( and
1334+ similar
1335+ * delete surrounding delimiters with md( and similar
1336+ * add surrounding delimiters around the selection with ms(
1337+ * replace a pair of delimiters surrounding your selection with
1338+ mr([ to replace for example surrounding () with []
1339+
1340+
1341+
1342+
11891343=================================================================
11901344 This tutorial is still a work-in-progress.
11911345 More sections are planned.