From cdedd89d228a016a4e433968702e9e3ce5165e7d Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Sun, 8 Mar 2015 08:58:31 -0300 Subject: 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. --- src/nvim/quickfix.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/nvim/quickfix.c') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 39117b262a..8e55cced78 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2377,7 +2377,6 @@ static void qf_fill_buffer(qf_info_T *qi) KeyTyped = old_KeyTyped; } - /* * Return TRUE if "buf" is the quickfix buffer. */ @@ -2386,22 +2385,18 @@ int bt_quickfix(buf_T *buf) return buf != NULL && buf->b_p_bt[0] == 'q'; } -/* - * Return TRUE if "buf" is a "nofile" or "acwrite" buffer. - * This means the buffer name is not a file name. - */ +// Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer. +// This means the buffer name is not a file name. int bt_nofile(buf_T *buf) { return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') - || buf->b_p_bt[0] == 'a'); + || buf->b_p_bt[0] == 'a' || buf->terminal); } -/* - * Return TRUE if "buf" is a "nowrite" or "nofile" buffer. - */ +// Return TRUE if "buf" is a "nowrite", "nofile" or "terminal" buffer. int bt_dontwrite(buf_T *buf) { - return buf != NULL && buf->b_p_bt[0] == 'n'; + return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->terminal); } int bt_dontwrite_msg(buf_T *buf) -- cgit