aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/main.c2
-rw-r--r--test/functional/terminal/edit_spec.lua23
2 files changed, 24 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index a2aca65001..92e8774ec4 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
}
// open terminals when opening files that start with term://
- do_cmdline_cmd("autocmd BufReadCmd term://* "
+ do_cmdline_cmd("autocmd BufReadCmd term://* nested "
":call termopen( "
// Capture the command string
"matchstr(expand(\"<amatch>\"), "
diff --git a/test/functional/terminal/edit_spec.lua b/test/functional/terminal/edit_spec.lua
new file mode 100644
index 0000000000..924f90e8f8
--- /dev/null
+++ b/test/functional/terminal/edit_spec.lua
@@ -0,0 +1,23 @@
+local helpers = require('test.functional.helpers')
+
+local nvim_dir = helpers.nvim_dir
+local command = helpers.command
+local meths = helpers.meths
+local clear = helpers.clear
+local eq = helpers.eq
+
+describe(':edit term://*', function()
+ before_each(function()
+ clear()
+ meths.set_option('shell', nvim_dir .. '/shell-test')
+ end)
+
+ it('runs TermOpen event', function()
+ meths.set_var('termopen_runs', {})
+ command('autocmd TermOpen * :call add(g:termopen_runs, expand("<amatch>"))')
+ command('edit term://')
+ termopen_runs = meths.get_var('termopen_runs')
+ eq(1, #termopen_runs)
+ eq(termopen_runs[1], termopen_runs[1]:match('^term://.//%d+:$'))
+ end)
+end)