diff options
author | James McCoy <jamessan@jamessan.com> | 2017-08-21 19:46:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-21 19:46:43 -0400 |
commit | 9ff0cc70855fc3eb11ad0162ee02e742f354d360 (patch) | |
tree | f924645168fda1146cd8947c4cdf14299ee869f4 | |
parent | 8d1ccb606d3806dcf9c4bcfdb0446d8139c0e765 (diff) | |
parent | 73286a81cfd92f334dcfa91490648fd105696fab (diff) | |
download | rneovim-9ff0cc70855fc3eb11ad0162ee02e742f354d360.tar.gz rneovim-9ff0cc70855fc3eb11ad0162ee02e742f354d360.tar.bz2 rneovim-9ff0cc70855fc3eb11ad0162ee02e742f354d360.zip |
Merge pull request #6808 from nelstrom/normal-mode-terminal
Make :terminal remain in normal mode when created
-rw-r--r-- | runtime/doc/various.txt | 1 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | test/functional/core/job_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 28 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 8 |
5 files changed, 22 insertions, 23 deletions
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index f06c062ee3..223a0135b2 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -212,7 +212,6 @@ g8 Print the hex values of the bytes used in the Equivalent to: > :enew :call termopen('{cmd}') - :startinsert < See |termopen()|. diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6e7938046a..d1405978b3 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9835,7 +9835,7 @@ static void ex_terminal(exarg_T *eap) if (*eap->arg != NUL) { // Run {cmd} in 'shell'. char *name = (char *)vim_strsave_escaped(eap->arg, (char_u *)"\"\\"); snprintf(ex_cmd, sizeof(ex_cmd), - ":enew%s | call termopen(\"%s\") | startinsert", + ":enew%s | call termopen(\"%s\")", eap->forceit ? "!" : "", name); xfree(name); } else { // No {cmd}: run the job with tokenized 'shell'. @@ -9857,7 +9857,7 @@ static void ex_terminal(exarg_T *eap) shell_free_argv(argv); snprintf(ex_cmd, sizeof(ex_cmd), - ":enew%s | call termopen([%s]) | startinsert", + ":enew%s | call termopen([%s])", eap->forceit ? "!" : "", shell_argv + 1); } diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 54e56f7f41..1b8a5b1b95 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -677,12 +677,12 @@ describe("pty process teardown", function() -- Exiting should terminate all descendants (PTY, its children, ...). screen:expect([[ - | + ^ | [Process exited 0] | | | | - -- TERMINAL -- | + | ]]) end) end) diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 9930efc402..7522f073c4 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -72,10 +72,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell() wait() screen:expect([[ - ready $ | + ^ready $ | [Process exited 0] | | - -- TERMINAL -- | + :terminal | ]]) end) @@ -96,10 +96,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell() wait() screen:expect([[ - jeff $ | + ^jeff $ | [Process exited 0] | | - -- TERMINAL -- | + :terminal | ]]) end) @@ -107,10 +107,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell('echo hi') wait() screen:expect([[ - ready $ echo hi | + ^ready $ echo hi | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo hi | ]]) end) @@ -119,10 +119,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell('echo hi') wait() screen:expect([[ - jeff $ echo hi | + ^jeff $ echo hi | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo hi | ]]) end) @@ -130,10 +130,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell([[echo 'hello' \ "world"]]) wait() screen:expect([[ - ready $ echo 'hello' \ "world" | + ^ready $ echo 'hello' \ "world" | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo 'hello' \ "world" | ]]) end) @@ -166,10 +166,10 @@ describe(':terminal (with fake shell)', function() terminal_with_fake_shell() wait() screen:expect([[ - ready $ | + ^ready $ | [Process exited 0] | | - -- TERMINAL -- | + :terminal | ]]) eq('term://', string.match(eval('bufname("%")'), "^term://")) helpers.feed([[<C-\><C-N>]]) @@ -184,10 +184,10 @@ describe(':terminal (with fake shell)', function() it('works with gf', function() terminal_with_fake_shell([[echo "scripts/shadacat.py"]]) screen:expect([[ - ready $ echo "scripts/shadacat.py" | + ^ready $ echo "scripts/shadacat.py" | | [Process exited 0] | - -- TERMINAL -- | + :terminal echo "scripts/shadacat.py" | ]]) helpers.feed([[<C-\><C-N>]]) eq('term://', string.match(eval('bufname("%")'), "^term://")) diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 21b907c8f7..34a5ac0a49 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -287,8 +287,8 @@ describe('tui focus event handling', function() feed_data(':terminal\n') feed_data('\027[I') screen:expect([[ - ready $ | - [Process exited 0]{1: } | + {1:r}eady $ | + [Process exited 0] | | | | @@ -297,8 +297,8 @@ describe('tui focus event handling', function() ]]) feed_data('\027[O') screen:expect([[ - ready $ | - [Process exited 0]{1: } | + {1:r}eady $ | + [Process exited 0] | | | | |