|
1 | | -*eval.txt* For Vim version 8.0. Last change: 2017 Mar 27 |
| 1 | +*eval.txt* For Vim version 8.0. Last change: 2017 Apr 09 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -4379,12 +4379,14 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but |
4379 | 4379 | includes an extra item in the list: |
4380 | 4380 | [bufnum, lnum, col, off, curswant] ~ |
4381 | 4381 | The "curswant" number is the preferred column when moving the |
4382 | | - cursor vertically. |
| 4382 | + cursor vertically. Also see |getpos()|. |
| 4383 | + |
4383 | 4384 | This can be used to save and restore the cursor position: > |
4384 | 4385 | let save_cursor = getcurpos() |
4385 | 4386 | MoveTheCursorAround |
4386 | 4387 | call setpos('.', save_cursor) |
4387 | | -< |
| 4388 | +< Note that this only works within the window. See |
| 4389 | + |winrestview()| for restoring more state. |
4388 | 4390 | *getcwd()* |
4389 | 4391 | getcwd([{winnr} [, {tabnr}]]) |
4390 | 4392 | The result is a String, which is the name of the current |
@@ -4682,13 +4684,16 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* |
4682 | 4684 | < |
4683 | 4685 | *getwinposx()* |
4684 | 4686 | getwinposx() The result is a Number, which is the X coordinate in pixels of |
4685 | | - the left hand side of the GUI Vim window. The result will be |
4686 | | - -1 if the information is not available. |
| 4687 | + the left hand side of the GUI Vim window. Also works for an |
| 4688 | + xterm. |
| 4689 | + The result will be -1 if the information is not available. |
| 4690 | + The value can be used with `:winpos`. |
4687 | 4691 |
|
4688 | 4692 | *getwinposy()* |
4689 | 4693 | getwinposy() The result is a Number, which is the Y coordinate in pixels of |
4690 | | - the top of the GUI Vim window. The result will be -1 if the |
4691 | | - information is not available. |
| 4694 | + the top of the GUI Vim window. Also works for an xterm. |
| 4695 | + The result will be -1 if the information is not available. |
| 4696 | + The value can be used with `:winpos`. |
4692 | 4697 |
|
4693 | 4698 | getwininfo([{winid}]) *getwininfo()* |
4694 | 4699 | Returns information about windows as a List with Dictionaries. |
@@ -5304,13 +5309,29 @@ json_decode({string}) *json_decode()* |
5304 | 5309 | in Vim values. See |json_encode()| for the relation between |
5305 | 5310 | JSON and Vim values. |
5306 | 5311 | The decoding is permissive: |
5307 | | - - A trailing comma in an array and object is ignored. |
| 5312 | + - A trailing comma in an array and object is ignored, e.g. |
| 5313 | + "[1, 2, ]" is the same as "[1, 2]". |
5308 | 5314 | - More floating point numbers are recognized, e.g. "1." for |
5309 | | - "1.0". |
5310 | | - However, a duplicate key in an object is not allowed. *E938* |
5311 | | - The result must be a valid Vim type: |
5312 | | - - An empty object member name is not allowed. |
5313 | | - - Duplicate object member names are not allowed. |
| 5315 | + "1.0", or "001.2" for "1.2". Special floating point values |
| 5316 | + "Infinity" and "NaN" (capitalization ignored) are accepted. |
| 5317 | + - Leading zeroes in integer numbers are ignored, e.g. "012" |
| 5318 | + for "12" or "-012" for "-12". |
| 5319 | + - Capitalization is ignored in literal names null, true or |
| 5320 | + false, e.g. "NULL" for "null", "True" for "true". |
| 5321 | + - Control characters U+0000 through U+001F which are not |
| 5322 | + escaped in strings are accepted, e.g. " " (tab |
| 5323 | + character in string) for "\t". |
| 5324 | + - Backslash in an invalid 2-character sequence escape is |
| 5325 | + ignored, e.g. "\a" is decoded as "a". |
| 5326 | + - A correct surrogate pair in JSON strings should normally be |
| 5327 | + a 12 character sequence such as "\uD834\uDD1E", but |
| 5328 | + json_decode() silently accepts truncated surrogate pairs |
| 5329 | + such as "\uD834" or "\uD834\u" |
| 5330 | + *E938* |
| 5331 | + A duplicate key in an object, valid in rfc7159, is not |
| 5332 | + accepted by json_decode() as the result must be a valid Vim |
| 5333 | + type, e.g. this fails: {"a":"b", "a":"c"} |
| 5334 | + |
5314 | 5335 |
|
5315 | 5336 | json_encode({expr}) *json_encode()* |
5316 | 5337 | Encode {expr} as JSON and return this as a string. |
@@ -7879,7 +7900,6 @@ test_override({name}, {val}) *test_override()* |
7879 | 7900 |
|
7880 | 7901 | name effect when {val} is non-zero ~ |
7881 | 7902 | redraw disable the redrawing() function |
7882 | | - silent_mode enable silent mode (like using |-s| after |-e|) |
7883 | 7903 | char_avail disable the char_avail() function |
7884 | 7904 | ALL clear all overrides ({val} is not used) |
7885 | 7905 |
|
@@ -8473,7 +8493,7 @@ listcmds Compiled with commands for the buffer list |:files| |
8473 | 8493 | and the argument list |arglist|. |
8474 | 8494 | localmap Compiled with local mappings and abbr. |:map-local| |
8475 | 8495 | lua Compiled with Lua interface |Lua|. |
8476 | | -mac Any Macintosh version of Vim. |
| 8496 | +mac Any Macintosh version of Vim, but not all OS X. |
8477 | 8497 | macunix Compiled for OS X, with darwin |
8478 | 8498 | osx Compiled for OS X, with or without darwin |
8479 | 8499 | menu Compiled with support for |:menu|. |
@@ -10650,6 +10670,22 @@ missing: > |
10650 | 10670 | : echo "You will _never_ see this message" |
10651 | 10671 | :endif |
10652 | 10672 |
|
| 10673 | +To execute a command only when the |+eval| feature is disabled requires a trick, |
| 10674 | +as this example shows: > |
| 10675 | + if 1 |
| 10676 | + nnoremap : :" |
| 10677 | + endif |
| 10678 | + normal :set history=111<CR> |
| 10679 | + if 1 |
| 10680 | + nunmap : |
| 10681 | + endif |
| 10682 | +
|
| 10683 | +The "<CR>" here is a real CR character, type CTRL-V Enter to get it. |
| 10684 | + |
| 10685 | +When the |+eval| feature is available the ":" is remapped to add a double |
| 10686 | +quote, which has the effect of commenging-out the command. without the |
| 10687 | +|+eval| feature the nnoremap command is skipped and the command is executed. |
| 10688 | + |
10653 | 10689 | ============================================================================== |
10654 | 10690 | 11. The sandbox *eval-sandbox* *sandbox* *E48* |
10655 | 10691 |
|
|
0 commit comments