Mercurial > vim
diff runtime/doc/terminal.txt @ 23931:5b37a0bf7e3a
Update runtime files
Commit: https://github.com/vim/vim/commit/942db23c9cb7532d68048530d749eb84ca94d0cd
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 13 18:14:48 2021 +0100
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Feb 2021 18:15:04 +0100 |
parents | e2e2cc5d0856 |
children | 29ec2c198c8d |
line wrap: on
line diff
--- 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 se |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 +This only works properly if the terminal is not hidden. -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. +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_scrap "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)