Merge pull request #6808 from nelstrom/normal-mode-terminal

Make :terminal remain in normal mode when created
This commit is contained in:
James McCoy 2017-08-21 19:46:43 -04:00 committed by GitHub
commit 9ff0cc7085
5 changed files with 22 additions and 23 deletions

View File

@ -212,7 +212,6 @@ g8 Print the hex values of the bytes used in the
Equivalent to: > Equivalent to: >
:enew :enew
:call termopen('{cmd}') :call termopen('{cmd}')
:startinsert
< <
See |termopen()|. See |termopen()|.

View File

@ -9835,7 +9835,7 @@ static void ex_terminal(exarg_T *eap)
if (*eap->arg != NUL) { // Run {cmd} in 'shell'. if (*eap->arg != NUL) { // Run {cmd} in 'shell'.
char *name = (char *)vim_strsave_escaped(eap->arg, (char_u *)"\"\\"); char *name = (char *)vim_strsave_escaped(eap->arg, (char_u *)"\"\\");
snprintf(ex_cmd, sizeof(ex_cmd), snprintf(ex_cmd, sizeof(ex_cmd),
":enew%s | call termopen(\"%s\") | startinsert", ":enew%s | call termopen(\"%s\")",
eap->forceit ? "!" : "", name); eap->forceit ? "!" : "", name);
xfree(name); xfree(name);
} else { // No {cmd}: run the job with tokenized 'shell'. } else { // No {cmd}: run the job with tokenized 'shell'.
@ -9857,7 +9857,7 @@ static void ex_terminal(exarg_T *eap)
shell_free_argv(argv); shell_free_argv(argv);
snprintf(ex_cmd, sizeof(ex_cmd), snprintf(ex_cmd, sizeof(ex_cmd),
":enew%s | call termopen([%s]) | startinsert", ":enew%s | call termopen([%s])",
eap->forceit ? "!" : "", shell_argv + 1); eap->forceit ? "!" : "", shell_argv + 1);
} }

View File

@ -677,12 +677,12 @@ describe("pty process teardown", function()
-- Exiting should terminate all descendants (PTY, its children, ...). -- Exiting should terminate all descendants (PTY, its children, ...).
screen:expect([[ screen:expect([[
| ^ |
[Process exited 0] | [Process exited 0] |
| |
| |
| |
-- TERMINAL -- | |
]]) ]])
end) end)
end) end)

View File

@ -72,10 +72,10 @@ describe(':terminal (with fake shell)', function()
terminal_with_fake_shell() terminal_with_fake_shell()
wait() wait()
screen:expect([[ screen:expect([[
ready $ | ^ready $ |
[Process exited 0] | [Process exited 0] |
| |
-- TERMINAL -- | :terminal |
]]) ]])
end) end)
@ -96,10 +96,10 @@ describe(':terminal (with fake shell)', function()
terminal_with_fake_shell() terminal_with_fake_shell()
wait() wait()
screen:expect([[ screen:expect([[
jeff $ | ^jeff $ |
[Process exited 0] | [Process exited 0] |
| |
-- TERMINAL -- | :terminal |
]]) ]])
end) end)
@ -107,10 +107,10 @@ describe(':terminal (with fake shell)', function()
terminal_with_fake_shell('echo hi') terminal_with_fake_shell('echo hi')
wait() wait()
screen:expect([[ screen:expect([[
ready $ echo hi | ^ready $ echo hi |
| |
[Process exited 0] | [Process exited 0] |
-- TERMINAL -- | :terminal echo hi |
]]) ]])
end) end)
@ -119,10 +119,10 @@ describe(':terminal (with fake shell)', function()
terminal_with_fake_shell('echo hi') terminal_with_fake_shell('echo hi')
wait() wait()
screen:expect([[ screen:expect([[
jeff $ echo hi | ^jeff $ echo hi |
| |
[Process exited 0] | [Process exited 0] |
-- TERMINAL -- | :terminal echo hi |
]]) ]])
end) end)
@ -130,10 +130,10 @@ describe(':terminal (with fake shell)', function()
terminal_with_fake_shell([[echo 'hello' \ "world"]]) terminal_with_fake_shell([[echo 'hello' \ "world"]])
wait() wait()
screen:expect([[ screen:expect([[
ready $ echo 'hello' \ "world" | ^ready $ echo 'hello' \ "world" |
| |
[Process exited 0] | [Process exited 0] |
-- TERMINAL -- | :terminal echo 'hello' \ "world" |
]]) ]])
end) end)
@ -166,10 +166,10 @@ describe(':terminal (with fake shell)', function()
terminal_with_fake_shell() terminal_with_fake_shell()
wait() wait()
screen:expect([[ screen:expect([[
ready $ | ^ready $ |
[Process exited 0] | [Process exited 0] |
| |
-- TERMINAL -- | :terminal |
]]) ]])
eq('term://', string.match(eval('bufname("%")'), "^term://")) eq('term://', string.match(eval('bufname("%")'), "^term://"))
helpers.feed([[<C-\><C-N>]]) helpers.feed([[<C-\><C-N>]])
@ -184,10 +184,10 @@ describe(':terminal (with fake shell)', function()
it('works with gf', function() it('works with gf', function()
terminal_with_fake_shell([[echo "scripts/shadacat.py"]]) terminal_with_fake_shell([[echo "scripts/shadacat.py"]])
screen:expect([[ screen:expect([[
ready $ echo "scripts/shadacat.py" | ^ready $ echo "scripts/shadacat.py" |
| |
[Process exited 0] | [Process exited 0] |
-- TERMINAL -- | :terminal echo "scripts/shadacat.py" |
]]) ]])
helpers.feed([[<C-\><C-N>]]) helpers.feed([[<C-\><C-N>]])
eq('term://', string.match(eval('bufname("%")'), "^term://")) eq('term://', string.match(eval('bufname("%")'), "^term://"))

View File

@ -287,8 +287,8 @@ describe('tui focus event handling', function()
feed_data(':terminal\n') feed_data(':terminal\n')
feed_data('\027[I') feed_data('\027[I')
screen:expect([[ screen:expect([[
ready $ | {1:r}eady $ |
[Process exited 0]{1: } | [Process exited 0] |
| |
| |
| |
@ -297,8 +297,8 @@ describe('tui focus event handling', function()
]]) ]])
feed_data('\027[O') feed_data('\027[O')
screen:expect([[ screen:expect([[
ready $ | {1:r}eady $ |
[Process exited 0]{1: } | [Process exited 0] |
| |
| |
| |