mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
terminal: New module that implements a terminal emulator
This commit integrates libvterm with Neovim and implements a terminal emulator with nvim buffers as the display mechanism. Terminal buffers can be created using any of the following methods: - Opening a file with name following the "term://[${cwd}//[${pid}:]]${cmd}" URI pattern where: - cwd is the working directory of the process - pid is the process id. This is just for use in session files where a pid would have been assigned to the saved buffer title. - cmd is the command to run - Invoking the `:terminal` ex command - Invoking the `termopen` function which returns a job id for automating the terminal window. Some extra changes were also implemented to adapt with terminal buffers. Here's an overview: - The `main` function now sets a BufReadCmd autocmd to intercept the term:// URI and spawn the terminal buffer instead of reading the file. - terminal buffers behave as if the following local buffer options were set: - `nomodifiable` - `swapfile` - `undolevels=-1` - `bufhidden=hide` - All commands that delete buffers(`:bun`, `:bd` and `:bw`) behave the same for terminal buffers, but only work when bang is passed(eg: `:bwipeout!`) - A new "terminal" mode was added. A consequence is that a new set of mapping commands were implemented with the "t" prefix(tmap, tunmap, tnoremap...) - The `edit` function(which enters insert mode) will actually enter terminal mode if the current buffer is a terminal - The `put` operator was adapted to send data to the terminal instead of modifying the buffer directly. - A window being resized will also trigger a terminal resize if the window displays the terminal.
This commit is contained in:
@@ -2235,6 +2235,11 @@ return {
|
||||
flags=bit.bor(NEEDARG, EXTRA, TRLBAR, NOTRLCOM, CMDWIN),
|
||||
func='ex_tearoff',
|
||||
},
|
||||
{
|
||||
command='terminal',
|
||||
flags=bit.bor(BANG, FILES, CMDWIN),
|
||||
func='ex_terminal',
|
||||
},
|
||||
{
|
||||
command='tfirst',
|
||||
flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR),
|
||||
@@ -2255,6 +2260,16 @@ return {
|
||||
flags=bit.bor(BANG, TRLBAR),
|
||||
func='ex_tag',
|
||||
},
|
||||
{
|
||||
command='tmap',
|
||||
flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN),
|
||||
func='ex_map',
|
||||
},
|
||||
{
|
||||
command='tmapclear',
|
||||
flags=bit.bor(EXTRA, TRLBAR, CMDWIN),
|
||||
func='ex_mapclear',
|
||||
},
|
||||
{
|
||||
command='tmenu',
|
||||
flags=bit.bor(RANGE, NOTADR, ZEROR, EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN),
|
||||
@@ -2265,6 +2280,11 @@ return {
|
||||
flags=bit.bor(RANGE, NOTADR, BANG, TRLBAR, ZEROR),
|
||||
func='ex_tag',
|
||||
},
|
||||
{
|
||||
command='tnoremap',
|
||||
flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN),
|
||||
func='ex_map',
|
||||
},
|
||||
{
|
||||
command='topleft',
|
||||
flags=bit.bor(NEEDARG, EXTRA, NOTRLCOM),
|
||||
@@ -2290,6 +2310,11 @@ return {
|
||||
flags=bit.bor(BANG, TRLBAR, WORD1),
|
||||
func='ex_tag',
|
||||
},
|
||||
{
|
||||
command='tunmap',
|
||||
flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN),
|
||||
func='ex_unmap',
|
||||
},
|
||||
{
|
||||
command='tunmenu',
|
||||
flags=bit.bor(EXTRA, TRLBAR, NOTRLCOM, USECTRLV, CMDWIN),
|
||||
|
Reference in New Issue
Block a user