Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.0. Last change: 2017 Mar 27 +*eval.txt* For Vim version 8.0. Last change: 2017 Apr 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4379,12 +4379,14 @@ getcurpos() Get the position of the curs includes an extra item in the list: [bufnum, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the - cursor vertically. + cursor vertically. Also see |getpos()|. + This can be used to save and restore the cursor position: > let save_cursor = getcurpos() MoveTheCursorAround call setpos('.', save_cursor) -< +< Note that this only works within the window. See + |winrestview()| for restoring more state. *getcwd()* getcwd([{winnr} [, {tabnr}]]) The result is a String, which is the name of the current @@ -4682,13 +4684,16 @@ gettabwinvar({tabnr}, {winnr}, {varname} < *getwinposx()* getwinposx() The result is a Number, which is the X coordinate in pixels of - the left hand side of the GUI Vim window. The result will be - -1 if the information is not available. + the left hand side of the GUI Vim window. Also works for an + xterm. + The result will be -1 if the information is not available. + The value can be used with `:winpos`. *getwinposy()* getwinposy() The result is a Number, which is the Y coordinate in pixels of - the top of the GUI Vim window. The result will be -1 if the - information is not available. + the top of the GUI Vim window. Also works for an xterm. + The result will be -1 if the information is not available. + The value can be used with `:winpos`. getwininfo([{winid}]) *getwininfo()* Returns information about windows as a List with Dictionaries. @@ -5304,13 +5309,29 @@ json_decode({string}) *json_decode() in Vim values. See |json_encode()| for the relation between JSON and Vim values. The decoding is permissive: - - A trailing comma in an array and object is ignored. + - A trailing comma in an array and object is ignored, e.g. + "[1, 2, ]" is the same as "[1, 2]". - More floating point numbers are recognized, e.g. "1." for - "1.0". - However, a duplicate key in an object is not allowed. *E938* - The result must be a valid Vim type: - - An empty object member name is not allowed. - - Duplicate object member names are not allowed. + "1.0", or "001.2" for "1.2". Special floating point values + "Infinity" and "NaN" (capitalization ignored) are accepted. + - Leading zeroes in integer numbers are ignored, e.g. "012" + for "12" or "-012" for "-12". + - Capitalization is ignored in literal names null, true or + false, e.g. "NULL" for "null", "True" for "true". + - Control characters U+0000 through U+001F which are not + escaped in strings are accepted, e.g. " " (tab + character in string) for "\t". + - Backslash in an invalid 2-character sequence escape is + ignored, e.g. "\a" is decoded as "a". + - A correct surrogate pair in JSON strings should normally be + a 12 character sequence such as "\uD834\uDD1E", but + json_decode() silently accepts truncated surrogate pairs + such as "\uD834" or "\uD834\u" + *E938* + A duplicate key in an object, valid in rfc7159, is not + accepted by json_decode() as the result must be a valid Vim + type, e.g. this fails: {"a":"b", "a":"c"} + json_encode({expr}) *json_encode()* Encode {expr} as JSON and return this as a string. @@ -7879,7 +7900,6 @@ test_override({name}, {val}) *test_ov name effect when {val} is non-zero ~ redraw disable the redrawing() function - silent_mode enable silent mode (like using |-s| after |-e|) char_avail disable the char_avail() function ALL clear all overrides ({val} is not used) @@ -8473,7 +8493,7 @@ listcmds Compiled with commands for the and the argument list |arglist|. localmap Compiled with local mappings and abbr. |:map-local| lua Compiled with Lua interface |Lua|. -mac Any Macintosh version of Vim. +mac Any Macintosh version of Vim, but not all OS X. macunix Compiled for OS X, with darwin osx Compiled for OS X, with or without darwin menu Compiled with support for |:menu|. @@ -10650,6 +10670,22 @@ missing: > : echo "You will _never_ see this message" :endif +To execute a command only when the |+eval| feature is disabled requires a trick, +as this example shows: > + if 1 + nnoremap : :" + endif + normal :set history=111<CR> + if 1 + nunmap : + endif + +The "<CR>" here is a real CR character, type CTRL-V Enter to get it. + +When the |+eval| feature is available the ":" is remapped to add a double +quote, which has the effect of commenging-out the command. without the +|+eval| feature the nnoremap command is skipped and the command is executed. + ============================================================================== 11. The sandbox *eval-sandbox* *sandbox* *E48*