Mercurial > vim
comparison runtime/doc/eval.txt @ 14019:dc67449d648c v8.1.0027
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
commit https://github.com/vim/vim/commit/f273245f6433d5d43a5671306b520a3230c35787
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 3 14:47:35 2018 +0200
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Problem: Difficult to make a plugin that feeds a line to a job.
Solution: Add the nitial code for the "prompt" buftype.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Jun 2018 15:00:07 +0200 |
parents | 665fe1f419b0 |
children | acb2dc112b06 |
comparison
equal
deleted
inserted
replaced
14018:c3064aaf53fb | 14019:dc67449d648c |
---|---|
2292 pathshorten({expr}) String shorten directory names in a path | 2292 pathshorten({expr}) String shorten directory names in a path |
2293 perleval({expr}) any evaluate |Perl| expression | 2293 perleval({expr}) any evaluate |Perl| expression |
2294 pow({x}, {y}) Float {x} to the power of {y} | 2294 pow({x}, {y}) Float {x} to the power of {y} |
2295 prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} | 2295 prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} |
2296 printf({fmt}, {expr1}...) String format text | 2296 printf({fmt}, {expr1}...) String format text |
2297 prompt_addtext({buf}, {expr}) none add text to a prompt buffer | |
2298 prompt_setprompt({buf}, {text}) none set prompt text | |
2299 prompt_setcallback({buf}, {expr}) none set prompt callback function | |
2297 pumvisible() Number whether popup menu is visible | 2300 pumvisible() Number whether popup menu is visible |
2298 pyeval({expr}) any evaluate |Python| expression | 2301 pyeval({expr}) any evaluate |Python| expression |
2299 py3eval({expr}) any evaluate |python3| expression | 2302 py3eval({expr}) any evaluate |python3| expression |
2300 pyxeval({expr}) any evaluate |python_x| expression | 2303 pyxeval({expr}) any evaluate |python_x| expression |
2301 range({expr} [, {max} [, {stride}]]) | 2304 range({expr} [, {max} [, {stride}]]) |
2302 List items from {expr} to {max} | 2305 List items from {expr} to {max} |
2303 readfile({fname} [, {binary} [, {max}]]) | 2306 readfile({fname} [, {binary} [, {max}]]) |
2304 List get list of lines from file {fname} | 2307 List get list of lines from file {fname} |
2305 reg_executing() Number get the executing register name | 2308 reg_executing() String get the executing register name |
2306 reg_recording() String get the recording register name | 2309 reg_recording() String get the recording register name |
2307 reltime([{start} [, {end}]]) List get time value | 2310 reltime([{start} [, {end}]]) List get time value |
2308 reltimefloat({time}) Float turn the time value into a Float | 2311 reltimefloat({time}) Float turn the time value into a Float |
2309 reltimestr({time}) String turn time value into a String | 2312 reltimestr({time}) String turn time value into a String |
2310 remote_expr({server}, {string} [, {idvar} [, {timeout}]]) | 2313 remote_expr({server}, {string} [, {idvar} [, {timeout}]]) |
4648 getline({lnum} [, {end}]) | 4651 getline({lnum} [, {end}]) |
4649 Without {end} the result is a String, which is line {lnum} | 4652 Without {end} the result is a String, which is line {lnum} |
4650 from the current buffer. Example: > | 4653 from the current buffer. Example: > |
4651 getline(1) | 4654 getline(1) |
4652 < When {lnum} is a String that doesn't start with a | 4655 < When {lnum} is a String that doesn't start with a |
4653 digit, line() is called to translate the String into a Number. | 4656 digit, |line()| is called to translate the String into a Number. |
4654 To get the line under the cursor: > | 4657 To get the line under the cursor: > |
4655 getline(".") | 4658 getline(".") |
4656 < When {lnum} is smaller than 1 or bigger than the number of | 4659 < When {lnum} is smaller than 1 or bigger than the number of |
4657 lines in the buffer, an empty string is returned. | 4660 lines in the buffer, an empty string is returned. |
4658 | 4661 |
6471 | 6474 |
6472 *E766* *E767* | 6475 *E766* *E767* |
6473 The number of {exprN} arguments must exactly match the number | 6476 The number of {exprN} arguments must exactly match the number |
6474 of "%" items. If there are not sufficient or too many | 6477 of "%" items. If there are not sufficient or too many |
6475 arguments an error is given. Up to 18 arguments can be used. | 6478 arguments an error is given. Up to 18 arguments can be used. |
6479 | |
6480 | |
6481 prompt_setprompt({buf}, {text}) *prompt_setprompt()* | |
6482 Set prompt for buffer {buf} to {text}. You most likely want | |
6483 {text} to end in a space. | |
6484 The result is only visible if {buf} has 'buftype' set to | |
6485 "prompt". Example: > | |
6486 call prompt_setprompt(bufnr(''), 'command: ') | |
6487 | |
6488 | |
6489 prompt_setcallback({buf}, {expr}) *prompt_setcallback()* | |
6490 Set prompt callback for buffer {buf} to {expr}. This has only | |
6491 effect if {buf} has 'buftype' set to "prompt". | |
6492 The callback is invoked when pressing Enter. The current | |
6493 buffer will always be the prompt buffer. A new line for a | |
6494 prompt is added before invoking the callback, thus the prompt | |
6495 for which the callback was invoked will be in the last but one | |
6496 line. | |
6497 If the callback wants to add text to the buffer, it must | |
6498 insert it above the last line, since that is where the current | |
6499 prompt is. This can also be done asynchronously. | |
6500 The callback is invoked with one argument, which is the text | |
6501 that was entered at the prompt. This can be an empty string | |
6502 if the user only typed Enter. | |
6503 Example: > | |
6504 call prompt_setcallback(bufnr(''), function('s:TextEntered')) | |
6505 func s:TextEntered(text) | |
6506 if a:text == 'exit' || a:text == 'quit' | |
6507 stopinsert | |
6508 close | |
6509 else | |
6510 call append(line('$') - 1, 'Entered: "' . a:text . '"') | |
6511 " Reset 'modified' to allow the buffer to be closed. | |
6512 set nomodified | |
6513 endif | |
6514 endfunc | |
6476 | 6515 |
6477 | 6516 |
6478 pumvisible() *pumvisible()* | 6517 pumvisible() *pumvisible()* |
6479 Returns non-zero when the popup menu is visible, zero | 6518 Returns non-zero when the popup menu is visible, zero |
6480 otherwise. See |ins-completion-menu|. | 6519 otherwise. See |ins-completion-menu|. |