Vim: Close and return to last tab, repeat
I find myself in this situation very often:
- Open gVim with NERDTree from current working directory.
- Open a file from NERDTree using
<S-T>
so it grabs a new tab.
:tabprevious
to return to NERDTree.- Explore directories and open a second file using
<S-T>
. - Close the second file,
:q
orZZ
.
What I would have expected to happen after 5. is to return to NERDTree, but Vim always collapses the tab and opens the one to the right. This is rarely what I intended to do and would much rather have Vim keep a list of all tabs I have cycled through. So, as I close one, it pops it off the stack and focuses the next.
This can be seen in other editors, mostly IDEs, like Komodo Edit for example.
Is there a plug-in which would do this for Vim?
vim tabs vim-plugins
add a comment |
I find myself in this situation very often:
- Open gVim with NERDTree from current working directory.
- Open a file from NERDTree using
<S-T>
so it grabs a new tab.
:tabprevious
to return to NERDTree.- Explore directories and open a second file using
<S-T>
. - Close the second file,
:q
orZZ
.
What I would have expected to happen after 5. is to return to NERDTree, but Vim always collapses the tab and opens the one to the right. This is rarely what I intended to do and would much rather have Vim keep a list of all tabs I have cycled through. So, as I close one, it pops it off the stack and focuses the next.
This can be seen in other editors, mostly IDEs, like Komodo Edit for example.
Is there a plug-in which would do this for Vim?
vim tabs vim-plugins
add a comment |
I find myself in this situation very often:
- Open gVim with NERDTree from current working directory.
- Open a file from NERDTree using
<S-T>
so it grabs a new tab.
:tabprevious
to return to NERDTree.- Explore directories and open a second file using
<S-T>
. - Close the second file,
:q
orZZ
.
What I would have expected to happen after 5. is to return to NERDTree, but Vim always collapses the tab and opens the one to the right. This is rarely what I intended to do and would much rather have Vim keep a list of all tabs I have cycled through. So, as I close one, it pops it off the stack and focuses the next.
This can be seen in other editors, mostly IDEs, like Komodo Edit for example.
Is there a plug-in which would do this for Vim?
vim tabs vim-plugins
I find myself in this situation very often:
- Open gVim with NERDTree from current working directory.
- Open a file from NERDTree using
<S-T>
so it grabs a new tab.
:tabprevious
to return to NERDTree.- Explore directories and open a second file using
<S-T>
. - Close the second file,
:q
orZZ
.
What I would have expected to happen after 5. is to return to NERDTree, but Vim always collapses the tab and opens the one to the right. This is rarely what I intended to do and would much rather have Vim keep a list of all tabs I have cycled through. So, as I close one, it pops it off the stack and focuses the next.
This can be seen in other editors, mostly IDEs, like Komodo Edit for example.
Is there a plug-in which would do this for Vim?
vim tabs vim-plugins
vim tabs vim-plugins
asked May 28 '12 at 9:03
StanAngeloffStanAngeloff
4516
4516
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
To go to the first tab (presumably the one with NERDTree open), do :tabfirst
. Vim doesn't keep a list of tabs ordered by "most recently accessed" and :tabprevious
/:tabnext
only deal with the tabs on the left/right.
The default action for T
is precisely to open the selected file in a new tab and come back to the tab where NERDTree is located. So I'm not sure why you have to do :tabprevious
after T
.
A common way to use NERDTree is to simply open it on the spot, when you need it, and set it to close itself upon opening a file. I don't remember the name of the option but a quick :help nerdtree
would be enough.
Also I'm afraid you are making a mistake here: you are using Vim's "tabs" as if they where the same as the tabs found everywhere else. This is a bad idea because they are not designed that way at all. Instead, read up on windows and buffers.
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f429618%2fvim-close-and-return-to-last-tab-repeat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
To go to the first tab (presumably the one with NERDTree open), do :tabfirst
. Vim doesn't keep a list of tabs ordered by "most recently accessed" and :tabprevious
/:tabnext
only deal with the tabs on the left/right.
The default action for T
is precisely to open the selected file in a new tab and come back to the tab where NERDTree is located. So I'm not sure why you have to do :tabprevious
after T
.
A common way to use NERDTree is to simply open it on the spot, when you need it, and set it to close itself upon opening a file. I don't remember the name of the option but a quick :help nerdtree
would be enough.
Also I'm afraid you are making a mistake here: you are using Vim's "tabs" as if they where the same as the tabs found everywhere else. This is a bad idea because they are not designed that way at all. Instead, read up on windows and buffers.
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
add a comment |
To go to the first tab (presumably the one with NERDTree open), do :tabfirst
. Vim doesn't keep a list of tabs ordered by "most recently accessed" and :tabprevious
/:tabnext
only deal with the tabs on the left/right.
The default action for T
is precisely to open the selected file in a new tab and come back to the tab where NERDTree is located. So I'm not sure why you have to do :tabprevious
after T
.
A common way to use NERDTree is to simply open it on the spot, when you need it, and set it to close itself upon opening a file. I don't remember the name of the option but a quick :help nerdtree
would be enough.
Also I'm afraid you are making a mistake here: you are using Vim's "tabs" as if they where the same as the tabs found everywhere else. This is a bad idea because they are not designed that way at all. Instead, read up on windows and buffers.
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
add a comment |
To go to the first tab (presumably the one with NERDTree open), do :tabfirst
. Vim doesn't keep a list of tabs ordered by "most recently accessed" and :tabprevious
/:tabnext
only deal with the tabs on the left/right.
The default action for T
is precisely to open the selected file in a new tab and come back to the tab where NERDTree is located. So I'm not sure why you have to do :tabprevious
after T
.
A common way to use NERDTree is to simply open it on the spot, when you need it, and set it to close itself upon opening a file. I don't remember the name of the option but a quick :help nerdtree
would be enough.
Also I'm afraid you are making a mistake here: you are using Vim's "tabs" as if they where the same as the tabs found everywhere else. This is a bad idea because they are not designed that way at all. Instead, read up on windows and buffers.
To go to the first tab (presumably the one with NERDTree open), do :tabfirst
. Vim doesn't keep a list of tabs ordered by "most recently accessed" and :tabprevious
/:tabnext
only deal with the tabs on the left/right.
The default action for T
is precisely to open the selected file in a new tab and come back to the tab where NERDTree is located. So I'm not sure why you have to do :tabprevious
after T
.
A common way to use NERDTree is to simply open it on the spot, when you need it, and set it to close itself upon opening a file. I don't remember the name of the option but a quick :help nerdtree
would be enough.
Also I'm afraid you are making a mistake here: you are using Vim's "tabs" as if they where the same as the tabs found everywhere else. This is a bad idea because they are not designed that way at all. Instead, read up on windows and buffers.
answered May 28 '12 at 16:22
romainlromainl
17.9k23246
17.9k23246
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
add a comment |
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
Thanks for this comment. I am fairly advanced with Vim, which should have been mentioned in the original post. If no one has indeed came across this sort of behaviour (provided by a plug-in), it would make for a good weekend project.
– StanAngeloff
May 29 '12 at 4:06
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f429618%2fvim-close-and-return-to-last-tab-repeat%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