Mercurial > vim
diff runtime/doc/eval.txt @ 16704:a927fdf9a4b0 v8.1.1354
patch 8.1.1354: getting a list of text lines is clumsy
commit https://github.com/vim/vim/commit/f5842c5a533346c4ff41ff666e465c85f1de35d5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 19 18:41:26 2019 +0200
patch 8.1.1354: getting a list of text lines is clumsy
Problem: Getting a list of text lines is clumsy.
Solution: Add the =<< assignment. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4386)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 May 2019 18:45:05 +0200 |
parents | ca1814eeecf5 |
children | c002c4899529 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -11416,6 +11416,44 @@ 7. Commands *expression-commands* Like above, but append/add/subtract the value for each |List| item. + *:let=<<* *:let-heredoc* *E990* *E991* +:let {var-name} =<< [trim] {marker} +text... +text... +{marker} + Set internal variable {var-name} to a List containing + the lines of text bounded by the string {marker}. + {marker} must not contain white space. + The last line should end only with the {marker} string + without any other character. Watch out for white + space after {marker}! + If {marker} is not supplied, then "." is used as the + default marker. + + Any white space characters in the lines of text are + preserved. If "trim" is specified before {marker}, + then all the leading indentation exactly matching the + leading indentation before `let` is stripped from the + input lines and the line containing {marker}. Note + that the difference between space and tab matters + here. + + If {var-name} didn't exist yet, it is created. + Cannot be followed by another command, but can be + followed by a comment. + + Examples: > + let var1 =<< END + Sample text 1 + Sample text 2 + Sample text 3 + END + + let data =<< trim DATA + 1 2 3 4 + 5 6 7 8 + DATA +< *E121* :let {var-name} .. List the value of variable {var-name}. Multiple variable names may be given. Special names recognized