Mercurial > vim
comparison runtime/doc/eval.txt @ 11347:4aae8146c21f
Update runtime files.
commit https://github.com/vim/vim/commit/cd5c8f82507822467232ab71e1ebbaae19595916
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 9 20:11:58 2017 +0200
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 09 Apr 2017 20:15:03 +0200 |
parents | 327a04a762f6 |
children | 73cfcf11d983 |
comparison
equal
deleted
inserted
replaced
11346:75f4dd526eb8 | 11347:4aae8146c21f |
---|---|
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 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
4377 *getcurpos()* | 4377 *getcurpos()* |
4378 getcurpos() Get the position of the cursor. This is like getpos('.'), but | 4378 getcurpos() Get the position of the cursor. This is like getpos('.'), but |
4379 includes an extra item in the list: | 4379 includes an extra item in the list: |
4380 [bufnum, lnum, col, off, curswant] ~ | 4380 [bufnum, lnum, col, off, curswant] ~ |
4381 The "curswant" number is the preferred column when moving the | 4381 The "curswant" number is the preferred column when moving the |
4382 cursor vertically. | 4382 cursor vertically. Also see |getpos()|. |
4383 | |
4383 This can be used to save and restore the cursor position: > | 4384 This can be used to save and restore the cursor position: > |
4384 let save_cursor = getcurpos() | 4385 let save_cursor = getcurpos() |
4385 MoveTheCursorAround | 4386 MoveTheCursorAround |
4386 call setpos('.', save_cursor) | 4387 call setpos('.', save_cursor) |
4387 < | 4388 < Note that this only works within the window. See |
4389 |winrestview()| for restoring more state. | |
4388 *getcwd()* | 4390 *getcwd()* |
4389 getcwd([{winnr} [, {tabnr}]]) | 4391 getcwd([{winnr} [, {tabnr}]]) |
4390 The result is a String, which is the name of the current | 4392 The result is a String, which is the name of the current |
4391 working directory. | 4393 working directory. |
4392 Without arguments, for the current window. | 4394 Without arguments, for the current window. |
4680 :let list_is_on = gettabwinvar(1, 2, '&list') | 4682 :let list_is_on = gettabwinvar(1, 2, '&list') |
4681 :echo "myvar = " . gettabwinvar(3, 1, 'myvar') | 4683 :echo "myvar = " . gettabwinvar(3, 1, 'myvar') |
4682 < | 4684 < |
4683 *getwinposx()* | 4685 *getwinposx()* |
4684 getwinposx() The result is a Number, which is the X coordinate in pixels of | 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 | 4687 the left hand side of the GUI Vim window. Also works for an |
4686 -1 if the information is not available. | 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 *getwinposy()* | 4692 *getwinposy()* |
4689 getwinposy() The result is a Number, which is the Y coordinate in pixels of | 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 | 4694 the top of the GUI Vim window. Also works for an xterm. |
4691 information is not available. | 4695 The result will be -1 if the information is not available. |
4696 The value can be used with `:winpos`. | |
4692 | 4697 |
4693 getwininfo([{winid}]) *getwininfo()* | 4698 getwininfo([{winid}]) *getwininfo()* |
4694 Returns information about windows as a List with Dictionaries. | 4699 Returns information about windows as a List with Dictionaries. |
4695 | 4700 |
4696 If {winid} is given Information about the window with that ID | 4701 If {winid} is given Information about the window with that ID |
5302 json_decode({string}) *json_decode()* | 5307 json_decode({string}) *json_decode()* |
5303 This parses a JSON formatted string and returns the equivalent | 5308 This parses a JSON formatted string and returns the equivalent |
5304 in Vim values. See |json_encode()| for the relation between | 5309 in Vim values. See |json_encode()| for the relation between |
5305 JSON and Vim values. | 5310 JSON and Vim values. |
5306 The decoding is permissive: | 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 - More floating point numbers are recognized, e.g. "1." for | 5314 - More floating point numbers are recognized, e.g. "1." for |
5309 "1.0". | 5315 "1.0", or "001.2" for "1.2". Special floating point values |
5310 However, a duplicate key in an object is not allowed. *E938* | 5316 "Infinity" and "NaN" (capitalization ignored) are accepted. |
5311 The result must be a valid Vim type: | 5317 - Leading zeroes in integer numbers are ignored, e.g. "012" |
5312 - An empty object member name is not allowed. | 5318 for "12" or "-012" for "-12". |
5313 - Duplicate object member names are not allowed. | 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 json_encode({expr}) *json_encode()* | 5336 json_encode({expr}) *json_encode()* |
5316 Encode {expr} as JSON and return this as a string. | 5337 Encode {expr} as JSON and return this as a string. |
5317 The encoding is specified in: | 5338 The encoding is specified in: |
5318 https://tools.ietf.org/html/rfc7159.html | 5339 https://tools.ietf.org/html/rfc7159.html |
7877 when {val} is zero. | 7898 when {val} is zero. |
7878 Current supported values for name are: | 7899 Current supported values for name are: |
7879 | 7900 |
7880 name effect when {val} is non-zero ~ | 7901 name effect when {val} is non-zero ~ |
7881 redraw disable the redrawing() function | 7902 redraw disable the redrawing() function |
7882 silent_mode enable silent mode (like using |-s| after |-e|) | |
7883 char_avail disable the char_avail() function | 7903 char_avail disable the char_avail() function |
7884 ALL clear all overrides ({val} is not used) | 7904 ALL clear all overrides ({val} is not used) |
7885 | 7905 |
7886 test_settime({expr}) *test_settime()* | 7906 test_settime({expr}) *test_settime()* |
7887 Set the time Vim uses internally. Currently only used for | 7907 Set the time Vim uses internally. Currently only used for |
8471 lispindent Compiled with support for lisp indenting. | 8491 lispindent Compiled with support for lisp indenting. |
8472 listcmds Compiled with commands for the buffer list |:files| | 8492 listcmds Compiled with commands for the buffer list |:files| |
8473 and the argument list |arglist|. | 8493 and the argument list |arglist|. |
8474 localmap Compiled with local mappings and abbr. |:map-local| | 8494 localmap Compiled with local mappings and abbr. |:map-local| |
8475 lua Compiled with Lua interface |Lua|. | 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 macunix Compiled for OS X, with darwin | 8497 macunix Compiled for OS X, with darwin |
8478 osx Compiled for OS X, with or without darwin | 8498 osx Compiled for OS X, with or without darwin |
8479 menu Compiled with support for |:menu|. | 8499 menu Compiled with support for |:menu|. |
8480 mksession Compiled with support for |:mksession|. | 8500 mksession Compiled with support for |:mksession|. |
8481 modify_fname Compiled with file name modifiers. |filename-modifiers| | 8501 modify_fname Compiled with file name modifiers. |filename-modifiers| |
10648 : echo "Expression evaluation is compiled in" | 10668 : echo "Expression evaluation is compiled in" |
10649 :else | 10669 :else |
10650 : echo "You will _never_ see this message" | 10670 : echo "You will _never_ see this message" |
10651 :endif | 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 11. The sandbox *eval-sandbox* *sandbox* *E48* | 10690 11. The sandbox *eval-sandbox* *sandbox* *E48* |
10655 | 10691 |
10656 The 'foldexpr', 'formatexpr', 'includeexpr', 'indentexpr', 'statusline' and | 10692 The 'foldexpr', 'formatexpr', 'includeexpr', 'indentexpr', 'statusline' and |
10657 'foldtext' options may be evaluated in a sandbox. This means that you are | 10693 'foldtext' options may be evaluated in a sandbox. This means that you are |