Mirror of the Vim source from https://github.com/vim/vim
Revision | c3ba2dcc4cf4b96ddd1e3df9beacd1e11abe7868 (tree) |
---|---|
Zeit | 2007-03-09 02:12:08 |
Autor | vimboss |
Commiter | vimboss |
updated for version 7.0-214
@@ -1,4 +1,4 @@ | ||
1 | -*map.txt* For Vim version 7.0. Last change: 2006 May 03 | |
1 | +*map.txt* For Vim version 7.0. Last change: 2007 Mar 08 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -1303,12 +1303,28 @@ | ||
1303 | 1303 | <q-args>) then the value is quoted in such a way as to make it a valid value |
1304 | 1304 | for use in an expression. This uses the argument as one single value. |
1305 | 1305 | When there is no argument <q-args> is an empty string. |
1306 | - | |
1306 | + *<f-args>* | |
1307 | 1307 | To allow commands to pass their arguments on to a user-defined function, there |
1308 | 1308 | is a special form <f-args> ("function args"). This splits the command |
1309 | 1309 | arguments at spaces and Tabs, quotes each argument individually, and the |
1310 | 1310 | <f-args> sequence is replaced by the comma-separated list of quoted arguments. |
1311 | 1311 | See the Mycmd example below. If no arguments are given <f-args> is removed. |
1312 | + To embed whitespace into an argument of <f-args>, prepend a backslash. | |
1313 | +<f-args> replaces every pair of backslashes (\\) with one backslash. A | |
1314 | +backslash followed by a character other than white space or a backslash | |
1315 | +remains unmodified. Overview: | |
1316 | + | |
1317 | + command <f-args> ~ | |
1318 | + XX ab 'ab' | |
1319 | + XX a\b 'a\b' | |
1320 | + XX a\ b 'a b' | |
1321 | + XX a\ b 'a ', 'b' | |
1322 | + XX a\\b 'a\b' | |
1323 | + XX a\\ b 'a\', 'b' | |
1324 | + XX a\\\b 'a\\b' | |
1325 | + XX a\\\ b 'a\ b' | |
1326 | + XX a\\\\b 'a\\b' | |
1327 | + XX a\\\\ b 'a\\', 'b' | |
1312 | 1328 | |
1313 | 1329 | Examples > |
1314 | 1330 |
@@ -5551,6 +5551,9 @@ | ||
5551 | 5551 | mch_memmove(cmd, cmd + 1, (gap->ga_len - i) * sizeof(ucmd_T)); |
5552 | 5552 | } |
5553 | 5553 | |
5554 | +/* | |
5555 | + * split and quote args for <f-args> | |
5556 | + */ | |
5554 | 5557 | static char_u * |
5555 | 5558 | uc_split_args(arg, lenp) |
5556 | 5559 | char_u *arg; |
@@ -5567,7 +5570,12 @@ | ||
5567 | 5570 | |
5568 | 5571 | while (*p) |
5569 | 5572 | { |
5570 | - if (p[0] == '\\' && vim_iswhite(p[1])) | |
5573 | + if (p[0] == '\\' && p[1] == '\\') | |
5574 | + { | |
5575 | + len += 2; | |
5576 | + p += 2; | |
5577 | + } | |
5578 | + else if (p[0] == '\\' && vim_iswhite(p[1])) | |
5571 | 5579 | { |
5572 | 5580 | len += 1; |
5573 | 5581 | p += 2; |
@@ -5603,7 +5611,13 @@ | ||
5603 | 5611 | *q++ = '"'; |
5604 | 5612 | while (*p) |
5605 | 5613 | { |
5606 | - if (p[0] == '\\' && vim_iswhite(p[1])) | |
5614 | + if (p[0] == '\\' && p[1] == '\\') | |
5615 | + { | |
5616 | + *q++ = '\\'; | |
5617 | + *q++ = '\\'; | |
5618 | + p += 2; | |
5619 | + } | |
5620 | + else if (p[0] == '\\' && vim_iswhite(p[1])) | |
5607 | 5621 | { |
5608 | 5622 | *q++ = p[1]; |
5609 | 5623 | p += 2; |
@@ -5735,7 +5749,7 @@ | ||
5735 | 5749 | } |
5736 | 5750 | |
5737 | 5751 | break; |
5738 | - case 2: /* Quote and split */ | |
5752 | + case 2: /* Quote and split (<f-args>) */ | |
5739 | 5753 | /* This is hard, so only do it once, and cache the result */ |
5740 | 5754 | if (*split_buf == NULL) |
5741 | 5755 | *split_buf = uc_split_args(eap->arg, split_len); |
@@ -667,6 +667,8 @@ | ||
667 | 667 | static int included_patches[] = |
668 | 668 | { /* Add new patch number below this line */ |
669 | 669 | /**/ |
670 | + 214, | |
671 | +/**/ | |
670 | 672 | 213, |
671 | 673 | /**/ |
672 | 674 | 212, |