Mercurial > vim
changeset 7742:5f6f35a3cb12
commit https://github.com/vim/vim/commit/705ada1aff27ecd9c47c690df817d043c2ceb5e2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 24 17:56:50 2016 +0100
Update a few runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Jan 2016 18:00:06 +0100 |
parents | 74b54a066bff |
children | 6069f43cea4e |
files | runtime/doc/eval.txt runtime/doc/if_mzsch.txt runtime/doc/tags runtime/indent/vim.vim |
diffstat | 4 files changed, 60 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2016 Jan 23 +*eval.txt* For Vim version 7.4. Last change: 2016 Jan 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1412,6 +1412,9 @@ v:exception The value of the exception m *v:false* *false-variable* v:false A Number with value zero. Used to put "false" in JSON. See |jsonencode()|. + When used as a string this evaluates to "false". > + echo v:false +< false ~ *v:fcs_reason* *fcs_reason-variable* v:fcs_reason The reason why the |FileChangedShell| event was triggered. @@ -1489,7 +1492,7 @@ v:foldstart Used for 'foldtext': first l v:hlsearch Variable that indicates whether search highlighting is on. Setting it makes sense only if 'hlsearch' is enabled which requires |+extra_search|. Setting this variable to zero acts - the like |:nohlsearch| command, setting it to one acts like > + like the |:nohlsearch| command, setting it to one acts like > let &hlsearch = &hlsearch < Note that the value is restored when returning from a function. |function-search-undo|. @@ -1549,10 +1552,18 @@ v:mouse_col Column number for a mouse cl *v:none* *none-variable* v:none An empty String. Used to put an empty item in JSON. See |jsonencode()|. + When used as a number this evaluates to zero. + When used as a string this evaluates to "none". > + echo v:none +< none ~ *v:null* *null-variable* v:null An empty String. Used to put "null" in JSON. See |jsonencode()|. + When used as a number this evaluates to zero. + When used as a string this evaluates to "null". > + echo v:null +< null ~ *v:oldfiles* *oldfiles-variable* v:oldfiles List of file names that is loaded from the |viminfo| file on @@ -1722,7 +1733,9 @@ v:throwpoint The point where the excepti *v:true* *true-variable* v:true A Number with value one. Used to put "true" in JSON. See |jsonencode()|. - + When used as a string this evaluates to "true". > + echo v:true +< true ~ *v:val* *val-variable* v:val Value of the current item of a |List| or |Dictionary|. Only valid while evaluating the expression used with |map()| and @@ -4234,17 +4247,26 @@ join({list} [, {sep}]) *join()* The opposite function is |split()|. jsondecode({string}) *jsondecode()* - TODO + This parses a JSON formatted string and returns the equivalent + in Vim values. See |jsonencode()| for the relation between + JSON and Vim values. + The decoding is permissive: + - A trailing comma in an array and object is ignored. + - An empty item in an array results in v:none. + - When an object name is not a string it is converted to a + string. E.g. the number 123 is used as the string "123". + - More floating point numbers are recognized, e.g. "1." for + "1.0". jsonencode({expr}) *jsonencode()* - Encodode {expr} as JSON and return this as a string. + Encode {expr} as JSON and return this as a string. The encoding is specified in: http://www.ietf.org/rfc/rfc4627.txt Vim values are converted as follows: Number decimal number Float floating point number String in double quotes (possibly null) - Funcref nothing + Funcref not possible, error List as an array (possibly null); when used recursively: [] Dict as an object (possibly null); when @@ -4253,6 +4275,13 @@ jsonencode({expr}) *jsonencode()* v:true "true" v:none nothing v:null "null" + Note that using v:none is permitted, although the JSON + standard does not allow empty items. This can be useful for + omitting items in an array: + [0,,,,,5] ~ + This is much more efficient than: + [0,null,null,null,null,5] ~ + But a strict JSON parser will not accept it. keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in @@ -6615,6 +6644,8 @@ type({expr}) The result is a Number, dep List: 3 Dictionary: 4 Float: 5 + Boolean: 6 (v:false and v:true) + None 7 (v:null and v:none) To avoid the magic numbers it should be used this way: > :if type(myvar) == type(0) :if type(myvar) == type("") @@ -6622,6 +6653,8 @@ type({expr}) The result is a Number, dep :if type(myvar) == type([]) :if type(myvar) == type({}) :if type(myvar) == type(0.0) + :if type(myvar) == type(v:false) + :if type(myvar) == type(v:none undofile({name}) *undofile()* Return the name of the undo file that would be used for a file
--- a/runtime/doc/if_mzsch.txt +++ b/runtime/doc/if_mzsch.txt @@ -1,4 +1,4 @@ -*if_mzsch.txt* For Vim version 7.4. Last change: 2016 Jan 16 +*if_mzsch.txt* For Vim version 7.4. Last change: 2016 Jan 24 VIM REFERENCE MANUAL by Sergey Khorev @@ -265,7 +265,7 @@ directly from Scheme. For instance: > < ============================================================================== -7. Dynamic loading *mzscheme-dynamic* *E815* +7. Dynamic loading *mzscheme-dynamic* *E815* On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version| output then includes |+mzscheme/dyn|. @@ -294,7 +294,7 @@ to set the environment variable as the f PLTCONFIGDIR=C:\Racket63\etc < ============================================================================== -8. MzScheme setup *mzscheme-setup* +8. MzScheme setup *mzscheme-setup* *E895* Vim requires "racket/base" module for if_mzsch core (fallback to "scheme/base" if it doesn't exist), "r5rs" module for test and "raco ctool" command for
--- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4422,6 +4422,7 @@ E891 eval.txt /*E891* E892 eval.txt /*E892* E893 eval.txt /*E893* E894 eval.txt /*E894* +E895 if_mzsch.txt /*E895* E90 message.txt /*E90* E91 options.txt /*E91* E92 message.txt /*E92* @@ -5730,6 +5731,7 @@ extend() eval.txt /*extend()* extension-removal cmdline.txt /*extension-removal* extensions-improvements todo.txt /*extensions-improvements* f motion.txt /*f* +false-variable eval.txt /*false-variable* faq intro.txt /*faq* farsi farsi.txt /*farsi* farsi-fonts farsi.txt /*farsi-fonts* @@ -6786,6 +6788,8 @@ javascript-cinoptions indent.txt /*javas javascript-indenting indent.txt /*javascript-indenting* join() eval.txt /*join()* jsbterm-mouse options.txt /*jsbterm-mouse* +jsondecode() eval.txt /*jsondecode()* +jsonencode() eval.txt /*jsonencode()* jtags tagsrch.txt /*jtags* jump-motions motion.txt /*jump-motions* jumplist motion.txt /*jumplist* @@ -7435,6 +7439,7 @@ no-eval-feature eval.txt /*no-eval-featu no_buffers_menu gui.txt /*no_buffers_menu* non-greedy pattern.txt /*non-greedy* non-zero-arg eval.txt /*non-zero-arg* +none-variable eval.txt /*none-variable* normal-index index.txt /*normal-index* not-compatible usr_01.txt /*not-compatible* not-edited editing.txt /*not-edited* @@ -7442,6 +7447,7 @@ notation intro.txt /*notation* notepad gui_w32.txt /*notepad* nr2char() eval.txt /*nr2char()* nroff.vim syntax.txt /*nroff.vim* +null-variable eval.txt /*null-variable* number_relativenumber options.txt /*number_relativenumber* numbered-function eval.txt /*numbered-function* o insert.txt /*o* @@ -8509,6 +8515,7 @@ toolbar-icon gui.txt /*toolbar-icon* toupper() eval.txt /*toupper()* tr() eval.txt /*tr()* trojan-horse starting.txt /*trojan-horse* +true-variable eval.txt /*true-variable* trunc() eval.txt /*trunc()* try-conditionals eval.txt /*try-conditionals* try-echoerr eval.txt /*try-echoerr* @@ -8618,6 +8625,7 @@ v:dying eval.txt /*v:dying* v:errmsg eval.txt /*v:errmsg* v:errors eval.txt /*v:errors* v:exception eval.txt /*v:exception* +v:false eval.txt /*v:false* v:fcs_choice eval.txt /*v:fcs_choice* v:fcs_reason eval.txt /*v:fcs_reason* v:fname_diff eval.txt /*v:fname_diff* @@ -8637,6 +8645,8 @@ v:lnum eval.txt /*v:lnum* v:mouse_col eval.txt /*v:mouse_col* v:mouse_lnum eval.txt /*v:mouse_lnum* v:mouse_win eval.txt /*v:mouse_win* +v:none eval.txt /*v:none* +v:null eval.txt /*v:null* v:oldfiles eval.txt /*v:oldfiles* v:operator eval.txt /*v:operator* v:option_new eval.txt /*v:option_new* @@ -8658,6 +8668,7 @@ v:swapname eval.txt /*v:swapname* v:termresponse eval.txt /*v:termresponse* v:this_session eval.txt /*v:this_session* v:throwpoint eval.txt /*v:throwpoint* +v:true eval.txt /*v:true* v:val eval.txt /*v:val* v:var eval.txt /*v:var* v:version eval.txt /*v:version*
--- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Dec 12 +" Last Change: 2016 Jan 24 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -58,19 +58,19 @@ function GetVimIndentIntern() if exists("g:vim_indent_cont") let ind = ind + g:vim_indent_cont else - let ind = ind + &sw * 3 + let ind = ind + shiftwidth() * 3 endif elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END' - let ind = ind + &sw + let ind = ind + shiftwidth() else " A line starting with :au does not increment/decrement indent. if prev_text !~ '^\s*au\%[tocmd]' let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') if i >= 0 - let ind += &sw + let ind += shiftwidth() if strpart(prev_text, i, 1) == '|' && has('syntax_items') \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' - let ind -= &sw + let ind -= shiftwidth() endif endif endif @@ -82,7 +82,7 @@ function GetVimIndentIntern() let i = match(prev_text, '[^\\]|\s*\(ene\@!\)') if i > 0 && prev_text !~ '^\s*au\%[tocmd]' if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif @@ -90,7 +90,7 @@ function GetVimIndentIntern() " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " :endfun, :else and :augroup END. if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind