aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-03-08 08:58:31 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-03-25 18:57:35 -0300
commitcdedd89d228a016a4e433968702e9e3ce5165e7d (patch)
tree2a98eb4008a6033621c293f84db29cb3127f9740 /src/nvim/option.c
parent6f471fa4fc24e72e1ac75c1579970414b168381e (diff)
downloadrneovim-cdedd89d228a016a4e433968702e9e3ce5165e7d.tar.gz
rneovim-cdedd89d228a016a4e433968702e9e3ce5165e7d.tar.bz2
rneovim-cdedd89d228a016a4e433968702e9e3ce5165e7d.zip
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.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 19202030c6..3f12709521 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1746,7 +1746,7 @@ static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
static char *(p_buftype_values[]) =
-{"nofile", "nowrite", "quickfix", "help", "acwrite", NULL};
+{"nofile", "nowrite", "quickfix", "help", "acwrite", "terminal", NULL};
static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
@@ -4097,9 +4097,11 @@ did_set_string_option (
}
/* When 'buftype' is set, check for valid value. */
else if (gvarp == &p_bt) {
- if (check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK)
+ if ((curbuf->terminal && curbuf->b_p_bt[0] != 't')
+ || (!curbuf->terminal && curbuf->b_p_bt[0] == 't')
+ || check_opt_strings(curbuf->b_p_bt, p_buftype_values, FALSE) != OK) {
errmsg = e_invarg;
- else {
+ } else {
if (curwin->w_status_height) {
curwin->w_redr_status = TRUE;
redraw_later(VALID);