Access to the terminal while you are on Vim
Is there a way to access the terminal while using Vim?
I do not like to open another terminal or save and exit the current terminal.
vim process background
add a comment |
Is there a way to access the terminal while using Vim?
I do not like to open another terminal or save and exit the current terminal.
vim process background
Open a new tab? (Ctrl + Shift + T)
– Wilf
Jul 12 '14 at 12:44
2
How many times do that :) I do not like to do that D:
– Mohammad Reza Rezwani
Jul 12 '14 at 12:49
1
Have you tried using a terminal window manager like tmux?
– jrg♦
Jul 15 '14 at 20:46
add a comment |
Is there a way to access the terminal while using Vim?
I do not like to open another terminal or save and exit the current terminal.
vim process background
Is there a way to access the terminal while using Vim?
I do not like to open another terminal or save and exit the current terminal.
vim process background
vim process background
edited Aug 18 '14 at 15:17
Mohammad Reza Rezwani
asked Jul 12 '14 at 12:39
Mohammad Reza RezwaniMohammad Reza Rezwani
3,6442359110
3,6442359110
Open a new tab? (Ctrl + Shift + T)
– Wilf
Jul 12 '14 at 12:44
2
How many times do that :) I do not like to do that D:
– Mohammad Reza Rezwani
Jul 12 '14 at 12:49
1
Have you tried using a terminal window manager like tmux?
– jrg♦
Jul 15 '14 at 20:46
add a comment |
Open a new tab? (Ctrl + Shift + T)
– Wilf
Jul 12 '14 at 12:44
2
How many times do that :) I do not like to do that D:
– Mohammad Reza Rezwani
Jul 12 '14 at 12:49
1
Have you tried using a terminal window manager like tmux?
– jrg♦
Jul 15 '14 at 20:46
Open a new tab? (Ctrl + Shift + T)
– Wilf
Jul 12 '14 at 12:44
Open a new tab? (Ctrl + Shift + T)
– Wilf
Jul 12 '14 at 12:44
2
2
How many times do that :) I do not like to do that D:
– Mohammad Reza Rezwani
Jul 12 '14 at 12:49
How many times do that :) I do not like to do that D:
– Mohammad Reza Rezwani
Jul 12 '14 at 12:49
1
1
Have you tried using a terminal window manager like tmux?
– jrg♦
Jul 15 '14 at 20:46
Have you tried using a terminal window manager like tmux?
– jrg♦
Jul 15 '14 at 20:46
add a comment |
7 Answers
7
active
oldest
votes
You can send vim the SIGTSTP signal. You do this by pressing ctrl+z. Vim will get suspended in the background, and you can use the terminal. Type fg
in the terminal to resume with vim.
Bonus tip: This works on nearly all terminal applications. Use bg
to enable the application to continue running in the background.
21
Or just%
instead offg
. Or%1
,%2
, etc. if you have many background jobs.jobs
command will list them. (Assumingbash
as the shell.)
– Ruslan
Jul 12 '14 at 16:26
4
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
add a comment |
In vim, just type:
:!sh
:!
launches an external process -- in this case sh
, another shell. Control will return to vim once you exit the shell. If you want to use the shell concurrently with vim, add &
to the end of the sh command:
:!sh&
8
Or just use:shell
.
– wchargin
Jul 12 '14 at 15:54
2
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
That's nice but what about when the command is running a server, likehttp-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.
– Costa
Dec 5 '16 at 19:36
add a comment |
You can use the :shell
command (or the short form :sh
). From :help :shell
:
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
By default, on Ubuntu, this will give you bash. type exit
to return to vim when you're done.
add a comment |
As addition to all answers.
You can install ConqueTerm plugin
This plugin provide ability to run interactive programs inside vim buffers.
After installation you can add this 2 lines to your .vimrc
:
:nnoremap <S-w> :q!<CR>
:nnoremap <S-t> :ConqueTermSplit bash<CR>
And you will be able to run bash
by pressing Shift + T, and close current Conque tab by pressing Shift + W
It is perferct if you need fast open/close bash
.
Here is gif that showing how it is look like
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
add a comment |
Since recent vim you can now do:
:terminal
This was initially added in Vim 8.0.693, but with lots of bugs. See :help terminal
:
WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
The terminal feature is optional, use this to check if your Vim has it:
echo has('terminal')
If the result is "1" you have it.
[...]
The terminal feature requires the +multi_byte, +job and +channel features.
==============================================================================
1. Basic use terminal-use
This feature is for running a terminal emulator in a Vim window. A job can be
started connected to the terminal emulator. For example, to run a shell:
:term bash
Or to run a debugger:
:term gdb vim
The job runs asynchronously from Vim, the window will be updated to show
output from the job, also while editing in any other window.
add a comment |
Another option with either screen or byobu is to open a tab within those programs. These programs make it fairly easy to keep a terminal-session c.q. shell open and switch between those screens with the keyboard.
add a comment |
With new version of vim 8.1 all you need to do is just :terminal
and voila!
(this is built in)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f496822%2faccess-to-the-terminal-while-you-are-on-vim%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can send vim the SIGTSTP signal. You do this by pressing ctrl+z. Vim will get suspended in the background, and you can use the terminal. Type fg
in the terminal to resume with vim.
Bonus tip: This works on nearly all terminal applications. Use bg
to enable the application to continue running in the background.
21
Or just%
instead offg
. Or%1
,%2
, etc. if you have many background jobs.jobs
command will list them. (Assumingbash
as the shell.)
– Ruslan
Jul 12 '14 at 16:26
4
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
add a comment |
You can send vim the SIGTSTP signal. You do this by pressing ctrl+z. Vim will get suspended in the background, and you can use the terminal. Type fg
in the terminal to resume with vim.
Bonus tip: This works on nearly all terminal applications. Use bg
to enable the application to continue running in the background.
21
Or just%
instead offg
. Or%1
,%2
, etc. if you have many background jobs.jobs
command will list them. (Assumingbash
as the shell.)
– Ruslan
Jul 12 '14 at 16:26
4
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
add a comment |
You can send vim the SIGTSTP signal. You do this by pressing ctrl+z. Vim will get suspended in the background, and you can use the terminal. Type fg
in the terminal to resume with vim.
Bonus tip: This works on nearly all terminal applications. Use bg
to enable the application to continue running in the background.
You can send vim the SIGTSTP signal. You do this by pressing ctrl+z. Vim will get suspended in the background, and you can use the terminal. Type fg
in the terminal to resume with vim.
Bonus tip: This works on nearly all terminal applications. Use bg
to enable the application to continue running in the background.
edited Jul 17 '14 at 13:21
answered Jul 12 '14 at 12:49
noletinoleti
3,6281823
3,6281823
21
Or just%
instead offg
. Or%1
,%2
, etc. if you have many background jobs.jobs
command will list them. (Assumingbash
as the shell.)
– Ruslan
Jul 12 '14 at 16:26
4
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
add a comment |
21
Or just%
instead offg
. Or%1
,%2
, etc. if you have many background jobs.jobs
command will list them. (Assumingbash
as the shell.)
– Ruslan
Jul 12 '14 at 16:26
4
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
21
21
Or just
%
instead of fg
. Or %1
, %2
, etc. if you have many background jobs. jobs
command will list them. (Assuming bash
as the shell.)– Ruslan
Jul 12 '14 at 16:26
Or just
%
instead of fg
. Or %1
, %2
, etc. if you have many background jobs. jobs
command will list them. (Assuming bash
as the shell.)– Ruslan
Jul 12 '14 at 16:26
4
4
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
I vote for the ^z (and later fg) method, because this can be used in almost all shell processes - it's not a vim thing, it's a how-to-use-shell trick that is incredibly useful in other contexts.
– dman
Jul 14 '14 at 10:12
add a comment |
In vim, just type:
:!sh
:!
launches an external process -- in this case sh
, another shell. Control will return to vim once you exit the shell. If you want to use the shell concurrently with vim, add &
to the end of the sh command:
:!sh&
8
Or just use:shell
.
– wchargin
Jul 12 '14 at 15:54
2
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
That's nice but what about when the command is running a server, likehttp-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.
– Costa
Dec 5 '16 at 19:36
add a comment |
In vim, just type:
:!sh
:!
launches an external process -- in this case sh
, another shell. Control will return to vim once you exit the shell. If you want to use the shell concurrently with vim, add &
to the end of the sh command:
:!sh&
8
Or just use:shell
.
– wchargin
Jul 12 '14 at 15:54
2
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
That's nice but what about when the command is running a server, likehttp-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.
– Costa
Dec 5 '16 at 19:36
add a comment |
In vim, just type:
:!sh
:!
launches an external process -- in this case sh
, another shell. Control will return to vim once you exit the shell. If you want to use the shell concurrently with vim, add &
to the end of the sh command:
:!sh&
In vim, just type:
:!sh
:!
launches an external process -- in this case sh
, another shell. Control will return to vim once you exit the shell. If you want to use the shell concurrently with vim, add &
to the end of the sh command:
:!sh&
answered Jul 12 '14 at 13:22
sbellsbell
45133
45133
8
Or just use:shell
.
– wchargin
Jul 12 '14 at 15:54
2
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
That's nice but what about when the command is running a server, likehttp-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.
– Costa
Dec 5 '16 at 19:36
add a comment |
8
Or just use:shell
.
– wchargin
Jul 12 '14 at 15:54
2
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
That's nice but what about when the command is running a server, likehttp-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.
– Costa
Dec 5 '16 at 19:36
8
8
Or just use
:shell
.– wchargin
Jul 12 '14 at 15:54
Or just use
:shell
.– wchargin
Jul 12 '14 at 15:54
2
2
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
This is the best answer for most purposes.
– Frank Conry
Jul 13 '14 at 4:08
That's nice but what about when the command is running a server, like
http-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.– Costa
Dec 5 '16 at 19:36
That's nice but what about when the command is running a server, like
http-server
and it prints out logs that I want to view? I'd like to be able to switch over to my files, make edits, then switch back to the logs.– Costa
Dec 5 '16 at 19:36
add a comment |
You can use the :shell
command (or the short form :sh
). From :help :shell
:
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
By default, on Ubuntu, this will give you bash. type exit
to return to vim when you're done.
add a comment |
You can use the :shell
command (or the short form :sh
). From :help :shell
:
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
By default, on Ubuntu, this will give you bash. type exit
to return to vim when you're done.
add a comment |
You can use the :shell
command (or the short form :sh
). From :help :shell
:
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
By default, on Ubuntu, this will give you bash. type exit
to return to vim when you're done.
You can use the :shell
command (or the short form :sh
). From :help :shell
:
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
By default, on Ubuntu, this will give you bash. type exit
to return to vim when you're done.
answered Jul 12 '14 at 17:17
evilsoupevilsoup
3,3691322
3,3691322
add a comment |
add a comment |
As addition to all answers.
You can install ConqueTerm plugin
This plugin provide ability to run interactive programs inside vim buffers.
After installation you can add this 2 lines to your .vimrc
:
:nnoremap <S-w> :q!<CR>
:nnoremap <S-t> :ConqueTermSplit bash<CR>
And you will be able to run bash
by pressing Shift + T, and close current Conque tab by pressing Shift + W
It is perferct if you need fast open/close bash
.
Here is gif that showing how it is look like
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
add a comment |
As addition to all answers.
You can install ConqueTerm plugin
This plugin provide ability to run interactive programs inside vim buffers.
After installation you can add this 2 lines to your .vimrc
:
:nnoremap <S-w> :q!<CR>
:nnoremap <S-t> :ConqueTermSplit bash<CR>
And you will be able to run bash
by pressing Shift + T, and close current Conque tab by pressing Shift + W
It is perferct if you need fast open/close bash
.
Here is gif that showing how it is look like
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
add a comment |
As addition to all answers.
You can install ConqueTerm plugin
This plugin provide ability to run interactive programs inside vim buffers.
After installation you can add this 2 lines to your .vimrc
:
:nnoremap <S-w> :q!<CR>
:nnoremap <S-t> :ConqueTermSplit bash<CR>
And you will be able to run bash
by pressing Shift + T, and close current Conque tab by pressing Shift + W
It is perferct if you need fast open/close bash
.
Here is gif that showing how it is look like
As addition to all answers.
You can install ConqueTerm plugin
This plugin provide ability to run interactive programs inside vim buffers.
After installation you can add this 2 lines to your .vimrc
:
:nnoremap <S-w> :q!<CR>
:nnoremap <S-t> :ConqueTermSplit bash<CR>
And you will be able to run bash
by pressing Shift + T, and close current Conque tab by pressing Shift + W
It is perferct if you need fast open/close bash
.
Here is gif that showing how it is look like
edited Jul 15 '14 at 4:56
answered Jul 14 '14 at 11:38
c0rpc0rp
6,90612657
6,90612657
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
add a comment |
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
can you please consider updating the posts? The links you mentioned seems outdated
– ggulgulia
Sep 25 '18 at 12:37
add a comment |
Since recent vim you can now do:
:terminal
This was initially added in Vim 8.0.693, but with lots of bugs. See :help terminal
:
WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
The terminal feature is optional, use this to check if your Vim has it:
echo has('terminal')
If the result is "1" you have it.
[...]
The terminal feature requires the +multi_byte, +job and +channel features.
==============================================================================
1. Basic use terminal-use
This feature is for running a terminal emulator in a Vim window. A job can be
started connected to the terminal emulator. For example, to run a shell:
:term bash
Or to run a debugger:
:term gdb vim
The job runs asynchronously from Vim, the window will be updated to show
output from the job, also while editing in any other window.
add a comment |
Since recent vim you can now do:
:terminal
This was initially added in Vim 8.0.693, but with lots of bugs. See :help terminal
:
WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
The terminal feature is optional, use this to check if your Vim has it:
echo has('terminal')
If the result is "1" you have it.
[...]
The terminal feature requires the +multi_byte, +job and +channel features.
==============================================================================
1. Basic use terminal-use
This feature is for running a terminal emulator in a Vim window. A job can be
started connected to the terminal emulator. For example, to run a shell:
:term bash
Or to run a debugger:
:term gdb vim
The job runs asynchronously from Vim, the window will be updated to show
output from the job, also while editing in any other window.
add a comment |
Since recent vim you can now do:
:terminal
This was initially added in Vim 8.0.693, but with lots of bugs. See :help terminal
:
WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
The terminal feature is optional, use this to check if your Vim has it:
echo has('terminal')
If the result is "1" you have it.
[...]
The terminal feature requires the +multi_byte, +job and +channel features.
==============================================================================
1. Basic use terminal-use
This feature is for running a terminal emulator in a Vim window. A job can be
started connected to the terminal emulator. For example, to run a shell:
:term bash
Or to run a debugger:
:term gdb vim
The job runs asynchronously from Vim, the window will be updated to show
output from the job, also while editing in any other window.
Since recent vim you can now do:
:terminal
This was initially added in Vim 8.0.693, but with lots of bugs. See :help terminal
:
WARNING: THIS IS ONLY PARTLY IMPLEMENTED, ANYTHING CAN STILL CHANGE
The terminal feature is optional, use this to check if your Vim has it:
echo has('terminal')
If the result is "1" you have it.
[...]
The terminal feature requires the +multi_byte, +job and +channel features.
==============================================================================
1. Basic use terminal-use
This feature is for running a terminal emulator in a Vim window. A job can be
started connected to the terminal emulator. For example, to run a shell:
:term bash
Or to run a debugger:
:term gdb vim
The job runs asynchronously from Vim, the window will be updated to show
output from the job, also while editing in any other window.
edited Aug 31 '17 at 9:50
muru
1
1
answered Aug 31 '17 at 9:23
gautehgauteh
16112
16112
add a comment |
add a comment |
Another option with either screen or byobu is to open a tab within those programs. These programs make it fairly easy to keep a terminal-session c.q. shell open and switch between those screens with the keyboard.
add a comment |
Another option with either screen or byobu is to open a tab within those programs. These programs make it fairly easy to keep a terminal-session c.q. shell open and switch between those screens with the keyboard.
add a comment |
Another option with either screen or byobu is to open a tab within those programs. These programs make it fairly easy to keep a terminal-session c.q. shell open and switch between those screens with the keyboard.
Another option with either screen or byobu is to open a tab within those programs. These programs make it fairly easy to keep a terminal-session c.q. shell open and switch between those screens with the keyboard.
answered Jul 15 '14 at 7:11
immeëmosolimmeëmosol
1478
1478
add a comment |
add a comment |
With new version of vim 8.1 all you need to do is just :terminal
and voila!
(this is built in)
add a comment |
With new version of vim 8.1 all you need to do is just :terminal
and voila!
(this is built in)
add a comment |
With new version of vim 8.1 all you need to do is just :terminal
and voila!
(this is built in)
With new version of vim 8.1 all you need to do is just :terminal
and voila!
(this is built in)
answered Jan 5 at 6:56
neelabalanneelabalan
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f496822%2faccess-to-the-terminal-while-you-are-on-vim%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Open a new tab? (Ctrl + Shift + T)
– Wilf
Jul 12 '14 at 12:44
2
How many times do that :) I do not like to do that D:
– Mohammad Reza Rezwani
Jul 12 '14 at 12:49
1
Have you tried using a terminal window manager like tmux?
– jrg♦
Jul 15 '14 at 20:46