From a5e9974ed77621c224b2b8fa49f76cab954fb2c6 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 28 Apr 2017 23:19:10 +0200 Subject: [PATCH] vim-patch:50ba526fbf3e Updated runtime files. https://github.com/vim/vim/commit/50ba526fbf3e9e5e0e6b0b3086a4d5df581ebc7e vim-patch:20eeb6129d12 --- runtime/doc/autocmd.txt | 2 +- runtime/doc/eval.txt | 27 ++++++++++++++++++--------- runtime/doc/if_pyth.txt | 4 ++-- runtime/filetype.vim | 6 +++++- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 77015d35ee6058..b27a1a87633972 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1004,7 +1004,7 @@ WinLeave Before leaving a window. If the window to be *WinNew* WinNew When a new window was created. Not done for - the fist window, when Vim has just started. + the first window, when Vim has just started. Before a WinEnter event. ============================================================================== diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d65783cea0d898..c58396d889bf5f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -939,7 +939,7 @@ expr8[expr1] item of String or |List| *expr-[]* *E111* If expr8 is a Number or String this results in a String that contains the expr1'th single byte from expr8. expr8 is used as a String, expr1 as a -Number. This doesn't recognize multi-byte encodings, see |byteidx()| for +Number. This doesn't recognize multi-byte encodings, see `byteidx()` for an alternative, or use `split()` to turn the string into a list of characters. Index zero gives the first byte. This is like it works in C. Careful: @@ -1222,7 +1222,7 @@ The arguments are optional. Example: > < error function *closure* Lambda expressions can access outer scope variables and arguments. This is -often called a closure. Example where "i" a and "a:arg" are used in a lambda +often called a closure. Example where "i" and "a:arg" are used in a lambda while they exist in the function scope. They remain valid even after the function returns: > :function Foo(arg) @@ -2031,8 +2031,8 @@ expand({expr} [, {nosuf} [, {list}]]) feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer filereadable({file}) Number |TRUE| if {file} is a readable file filewritable({file}) Number |TRUE| if {file} is a writable file -filter({expr}, {string}) List/Dict remove items from {expr} where - {string} is 0 +filter({expr1}, {expr2}) List/Dict remove items from {expr1} where + {expr2} is 0 finddir({name}[, {path}[, {count}]]) String find directory {name} in {path} findfile({name}[, {path}[, {count}]]) @@ -2056,7 +2056,7 @@ garbagecollect([{atexit}]) none free memory, breaking cyclic references get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def} get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def} get({func}, {what}) any get property of funcref/partial {func} -getbufinfo( [{expr}]) List information about buffers +getbufinfo([{expr}]) List information about buffers getbufline({expr}, {lnum} [, {end}]) List lines {lnum} to {end} of buffer {expr} getbufvar({expr}, {varname} [, {def}]) @@ -2155,7 +2155,7 @@ lispindent({lnum}) Number Lisp indent for line {lnum} localtime() Number current time log({expr}) Float natural logarithm (base e) of {expr} log10({expr}) Float logarithm of Float {expr} to base 10 -map({expr}, {string}) List/Dict change each item in {expr} to {expr} +map({expr1}, {expr2}) List/Dict change each item in {expr1} to {expr} maparg({name}[, {mode} [, {abbr} [, {dict}]]]) String or Dict rhs of mapping {name} in mode {mode} @@ -3488,9 +3488,10 @@ filter({expr1}, {expr2}) *filter()* is zero remove the item from the |List| or |Dictionary|. {expr2} must be a |string| or |Funcref|. - if {expr2} is a |string|, inside {expr2} |v:val| has the value + If {expr2} is a |string|, inside {expr2} |v:val| has the value of the current item. For a |Dictionary| |v:key| has the key - of the current item. + of the current item and for a |List| |v:key| has the index of + the current item. For a |Dictionary| |v:key| has the key of the current item. Examples: > call filter(mylist, 'v:val !~ "OLD"') @@ -3513,7 +3514,11 @@ filter({expr1}, {expr2}) *filter()* return a:idx % 2 == 1 endfunc call filter(mylist, function('Odd')) -< +< It is shorter when using a |lambda|: > + call filter(myList, {idx, val -> idx * val <= 42}) +< If you do not use "val" you can leave it out: > + call filter(myList, {idx -> idx % 2 == 1}) + The operation is done in-place. If you want a |List| or |Dictionary| to remain unmodified make a copy first: > :let l = filter(copy(mylist), 'v:val =~ "KEEP"') @@ -5150,6 +5155,10 @@ map({expr1}, {expr2}) *map()* return a:key . '-' . a:val endfunc call map(myDict, function('KeyValue')) +< It is shorter when using a |lambda|: > + call map(myDict, {key, val -> key . '-' . val}) +< If you do not use "val" you can leave it out: > + call map(myDict, {key -> 'item: ' . key}) < The operation is done in-place. If you want a |List| or |Dictionary| to remain unmodified make a copy first: > diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 8d6a3e1cfa421b..e19a80059a43dd 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -696,11 +696,11 @@ functions to evaluate Python expressions and pass their values to VimL. The `:py3` and `:python3` commands work similar to `:python`. A simple check if the `:py3` command is working: > :py3 print("Hello") -< *:py3file* + To see what version of Python you have: > :py3 import sys :py3 print(sys.version) - +< *:py3file* The `:py3file` command works similar to `:pyfile`. *:py3do* The `:py3do` command works similar to `:pydo`. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index d2b770d3afe3e2..a909debf97d8bf 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2016 Sep 15 +" Last Change: 2016 Sep 22 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -805,6 +805,10 @@ au BufNewFile,BufRead *.gp,.gprc setf gp au BufNewFile,BufRead */.gnupg/options setf gpg au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg au BufNewFile,BufRead */usr/*/gnupg/options.skel setf gpg +if !empty($GNUPGHOME) + au BufNewFile,BufRead $GNUPGHOME/options setf gpg + au BufNewFile,BufRead $GNUPGHOME/gpg.conf setf gpg +endif " gnash(1) configuration files au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash