comparison runtime/doc/terminal.txt @ 18170:4ac8161e92e0 v8.1.2080

patch 8.1.2080: the terminal API is limited and can't be disabled Commit: https://github.com/vim/vim/commit/d2842ea60bd608b7f9ec93c77d3f36a8e3bf5fe9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 26 23:08:54 2019 +0200 patch 8.1.2080: the terminal API is limited and can't be disabled Problem: The terminal API is limited and can't be disabled. Solution: Add term_setapi() to set the function prefix. (Ozaki Kiichi, closes #2907)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 Sep 2019 23:15:05 +0200
parents 1e5672da6a69
children 375a7ecdb351
comparison
equal deleted inserted replaced
18169:6ad8949a205d 18170:4ac8161e92e0
1 *terminal.txt* For Vim version 8.1. Last change: 2019 Sep 20 1 *terminal.txt* For Vim version 8.1. Last change: 2019 Sep 26
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
220 ++cols={width} Use {width} for the terminal window 220 ++cols={width} Use {width} for the terminal window
221 width. If the terminal uses the full 221 width. If the terminal uses the full
222 Vim width (no window left or right of 222 Vim width (no window left or right of
223 the terminal window) this value is 223 the terminal window) this value is
224 ignored. 224 ignored.
225 ++eof={text} when using [range]: text to send after 225 ++eof={text} When using [range]: text to send after
226 the last line was written. Cannot 226 the last line was written. Cannot
227 contain white space. A CR is 227 contain white space. A CR is
228 appended. For MS-Windows the default 228 appended. For MS-Windows the default
229 is to send CTRL-D. 229 is to send CTRL-D.
230 E.g. for a shell use "++eof=exit" and 230 E.g. for a shell use "++eof=exit" and
232 codes can be used like with `:map`, 232 codes can be used like with `:map`,
233 e.g. "<C-Z>" for CTRL-Z. 233 e.g. "<C-Z>" for CTRL-Z.
234 ++type={pty} (MS-Windows only): Use {pty} as the 234 ++type={pty} (MS-Windows only): Use {pty} as the
235 virtual console. See 'termwintype' 235 virtual console. See 'termwintype'
236 for the values. 236 for the values.
237 ++api={expr} Permit the function name starting with
238 {expr} to be called as |terminal-api|
239 function. If {expr} is empty then no
240 function can be called.
237 241
238 If you want to use more options use the |term_start()| 242 If you want to use more options use the |term_start()|
239 function. 243 function.
240 If you want to split the window vertically, use: > 244 If you want to split the window vertically, use: >
241 :vertical terminal 245 :vertical terminal
698 means the character CTRL-X. 702 means the character CTRL-X.
699 703
700 Can also be used as a |method|: > 704 Can also be used as a |method|: >
701 GetBufnr()->term_sendkeys(keys) 705 GetBufnr()->term_sendkeys(keys)
702 706
707
708 term_setapi({buf}, {expr}) *term_setapi()*
709 Set the function name prefix to be used for the |terminal-api|
710 function in terminal {buf}. For example: >
711 :call term_setapi(buf, "Myapi_")
712 :call term_setapi(buf, "")
713 <
714 The default is "Tapi_". When {expr} is an empty string then
715 no |terminal-api| function can be used for {buf}.
703 716
704 term_setansicolors({buf}, {colors}) *term_setansicolors()* 717 term_setansicolors({buf}, {colors}) *term_setansicolors()*
705 Set the ANSI color palette used by terminal {buf}. 718 Set the ANSI color palette used by terminal {buf}.
706 {colors} must be a List of 16 valid color names or hexadecimal 719 {colors} must be a List of 16 valid color names or hexadecimal
707 color codes, like those accepted by |highlight-guifg|. 720 color codes, like those accepted by |highlight-guifg|.
841 "ansi_colors" A list of 16 color names or hex codes 854 "ansi_colors" A list of 16 color names or hex codes
842 defining the ANSI palette used in GUI 855 defining the ANSI palette used in GUI
843 color modes. See |g:terminal_ansi_colors|. 856 color modes. See |g:terminal_ansi_colors|.
844 "tty_type" (MS-Windows only): Specify which pty to 857 "tty_type" (MS-Windows only): Specify which pty to
845 use. See 'termwintype' for the values. 858 use. See 'termwintype' for the values.
859 "term_api" function name prefix for the
860 |terminal-api| function. See
861 |term_setapi()|.
846 862
847 Can also be used as a |method|: > 863 Can also be used as a |method|: >
848 GetCommand()->term_start() 864 GetCommand()->term_start()
849 865
850 < {only available when compiled with the |+terminal| feature} 866 < {only available when compiled with the |+terminal| feature}
900 call {funcname} {argument} 916 call {funcname} {argument}
901 917
902 Call a user defined function with {argument}. 918 Call a user defined function with {argument}.
903 The function is called with two arguments: the buffer number 919 The function is called with two arguments: the buffer number
904 of the terminal and {argument}, the decoded JSON argument. 920 of the terminal and {argument}, the decoded JSON argument.
905 The function name must start with "Tapi_" to avoid 921 By default, the function name must start with "Tapi_" to avoid
906 accidentally calling a function not meant to be used for the 922 accidentally calling a function not meant to be used for the
907 terminal API. 923 terminal API. This can be changed with |term_setapi()|.
908 The user function should sanity check the argument. 924 The user function should sanity check the argument.
909 The function can use |term_sendkeys()| to send back a reply. 925 The function can use |term_sendkeys()| to send back a reply.
910 Example in JSON: > 926 Example in JSON: >
911 ["call", "Tapi_Impression", ["play", 14]] 927 ["call", "Tapi_Impression", ["play", 14]]
912 < Calls a function defined like this: > 928 < Calls a function defined like this: >