summaryrefslogtreecommitdiffstats
path: root/runtime/doc/terminal.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-13 18:14:48 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-13 18:14:48 +0100
commit942db23c9cb7532d68048530d749eb84ca94d0cd (patch)
tree13d89605923a2ccc490b83ae155e5791a92062a1 /runtime/doc/terminal.txt
parent0fa09676c25a0a4a01f339887b8bf40b4673621f (diff)
Update runtime files
Diffstat (limited to 'runtime/doc/terminal.txt')
-rw-r--r--runtime/doc/terminal.txt29
1 files changed, 24 insertions, 5 deletions
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index 5885cb1976..5aec3a5ae3 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1,4 +1,4 @@
-*terminal.txt* For Vim version 8.2. Last change: 2021 Jan 04
+*terminal.txt* For Vim version 8.2. Last change: 2021 Feb 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -126,11 +126,28 @@ After opening the terminal window and setting 'buftype' to "terminal" the
|TerminalWinOpen| autocommand event is triggered. This makes it possible to set
options specifically for the terminal window and buffer. Example: >
au TerminalWinOpen * setlocal bufhidden=hide
-
-There is also the |TerminalOpen| event, but this may be triggered for a hidden
-terminal, and the current window and buffer may not be for the new terminal.
+This only works properly if the terminal is not hidden.
+
+For both hidden and non-hidden terminals this works, both for buffer-local and
+window-local options: >
+ au TerminalWinOpen,BufWinEnter * if &buftype == 'terminal'
+ \ | setlocal bufhidden=hide colorcolumn=123
+ \ | endif
+Note that for a hidden terminal the options are not set until the terminal is
+no longer hidden.
+
+There is also the |TerminalOpen| event. Keep in mind this may be triggered
+for a hidden terminal, then the current window and buffer are not that of the
+new terminal.
You need to use <abuf>, which is set to the terminal buffer. Example: >
- au TerminalOpen * call setbufvar(+expand('<abuf>'), '&colorcolumn', 123)
+ au TerminalOpen * call setbufvar(expand('<abuf>')->str2nr(),
+ \ '&termwinscroll', 1000)
+For a window-local option, you need to delay setting the option until the
+terminal window has been created (this only works for a hidden terminal): >
+ au TerminalOpen * exe printf(
+ \ 'au BufWinEnter <buffer=%d> ++once setlocal colorcolumn=%d',
+ \ expand('<abuf>')->str2nr(), 123)
+For a non-hidden terminal use |TerminalWinOpen|.
Mouse events (click and drag) are passed to the terminal. Mouse move events
are only passed when Vim itself is receiving them. For a terminal that is
@@ -717,6 +734,8 @@ term_scrape({buf}, {row}) *term_scrape()*
"attr" attributes of the cell, use |term_getattr()|
to get the individual flags
"width" cell width: 1 or 2
+ For a double-width cell there is one item, thus the list can
+ be shorter than the width of the terminal.
Can also be used as a |method|: >
GetBufnr()->term_scrape(row)