tabedit and closing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

tabedit and closing

rwmit...@gmail.com
I have multiple tabs open using :tabedit
I'm in a tab other than the right most.
:tabedit  opens a new tab to the right of the current tab
:q closes that tab but also advances the current tab again to the right.

Is there a setting to instead advance the current tab to the left?
I'd prefer to return to the previous tab, where I had just run :tabedit

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7354d4ed-085b-47ae-b48e-13cb2ae8e0een%40googlegroups.com.
BPJ
Reply | Threaded
Open this post in threaded view
|

Re: tabedit and closing

BPJ
Den tors 18 mars 2021 [hidden email] <[hidden email]> skrev:
I have multiple tabs open using :tabedit
I'm in a tab other than the right most.
:tabedit  opens a new tab to the right of the current tab
:q closes that tab but also advances the current tab again to the right.

Is there a setting to instead advance the current tab to the left?
I'd prefer to return to the previous tab, where I had just run :tabedit

I have this in .vimrc:

:com Tc tabclose | tabprevious
nnor <F12>t :Tc<cr>

Works like a charm!



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7354d4ed-085b-47ae-b48e-13cb2ae8e0een%40googlegroups.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhAcmzRBQ7XkwxfLKT6uRD%2Bp4yvFLn3Gmg39uFCi-GdDqQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: tabedit and closing

rwmit...@gmail.com
Does that require using the F12 key or does it somehow also work when just using :wq  ?

On Thursday, March 18, 2021 at 10:51:20 AM UTC-4 BPJ wrote:
Den tors 18 mars 2021 15:[hidden email] <[hidden email]> skrev:
I have multiple tabs open using :tabedit
I'm in a tab other than the right most.
:tabedit  opens a new tab to the right of the current tab
:q closes that tab but also advances the current tab again to the right.

Is there a setting to instead advance the current tab to the left?
I'd prefer to return to the previous tab, where I had just run :tabedit

I have this in .vimrc:

:com Tc tabclose | tabprevious
nnor <F12>t :Tc<cr>

Works like a charm!



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7354d4ed-085b-47ae-b48e-13cb2ae8e0een%40googlegroups.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/9abfdd96-6835-469a-af02-117471943d00n%40googlegroups.com.
BPJ
Reply | Threaded
Open this post in threaded view
|

Re: tabedit and closing

BPJ
Den tors 18 mars 2021 [hidden email] <[hidden email]> skrev:
Does that require using the F12 key or does it somehow also work when just using :wq  ?

You can't redefine the :wq command since user commands have to start with a capital letter but you could certainly call the command Wq or WQ if you like, but since my command does *not* write the file automatically. To get that behavior I would rather use

:com Wq wq | tabprevious

The nnor is a mapping, not a command, so that in normal mode I can just type F12 + c (<F12>t was a typo for <F12>c) to execute the command above without going into ex mode first (the map does that for me!) If you want such a mapping at all you can assign it to any free key sequence. I would advise against mapping it to wq however since it is all too easy (at least for me!) to type wqq by mistake and thereby starting to record everything you type into the @q register.

However I have the whole set of :tab... commands mapped to F12 combos in my .vimrc because I use them all the time:

nnor <F12>n :tabnext<cr>
nnor <F12>p :tabprevious<cr>
nnor <F12>f :tabfirst<cr>
nnor <F12>l :tablast<cr>
nnor <F12>t :ls t<cr>
com Tc tabclose | tabprevious
nnor <F12>c :Tc<cr>



On Thursday, March 18, 2021 at 10:51:20 AM UTC-4 BPJ wrote:
Den tors 18 mars 2021 15:[hidden email] <[hidden email]> skrev:
I have multiple tabs open using :tabedit
I'm in a tab other than the right most.
:tabedit  opens a new tab to the right of the current tab
:q closes that tab but also advances the current tab again to the right.

Is there a setting to instead advance the current tab to the left?
I'd prefer to return to the previous tab, where I had just run :tabedit

I have this in .vimrc:

:com Tc tabclose | tabprevious
nnor <F12>t :Tc<cr>

Works like a charm!



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7354d4ed-085b-47ae-b48e-13cb2ae8e0een%40googlegroups.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/9abfdd96-6835-469a-af02-117471943d00n%40googlegroups.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhDuApOW6D1nJWhm6E%3Dc%3DEBWZw%3DiVjg8ry%3DKSWc1POxrkQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: tabedit and closing

Gary Johnson-4
In reply to this post by rwmit...@gmail.com
On 2021-03-18, [hidden email] wrote:

> On Thursday, March 18, 2021 at 10:51:20 AM UTC-4 BPJ wrote:
>
>>    Den tors 18 mars 2021 15:[hidden email] <[hidden email]> skrev:
>>
>>        I have multiple tabs open using :tabedit
>>        I'm in a tab other than the right most.
>>        :tabedit  opens a new tab to the right of the current tab
>>        :q closes that tab but also advances the current tab again to the
>>        right.
>>
>>        Is there a setting to instead advance the current tab to the left?
>>        I'd prefer to return to the previous tab, where I had just run :tabedit
>>
>>
>>    I have this in .vimrc:
>>
>>    :com Tc tabclose | tabprevious
>>    nnor <F12>t :Tc<cr>
>>
>>    Works like a charm!
>
> Does that require using the F12 key or does it somehow also work when just
> using :wq  ?

The following seems to work in both cases, though I haven't tested
it extensively.

    :autocmd TabClosed * tabprevious

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210318161409.GB13819%40phoenix.
Reply | Threaded
Open this post in threaded view
|

Re: tabedit and closing

rwmit...@gmail.com
On Thursday, March 18, 2021 at 12:14:43 PM UTC-4 Gary Johnson wrote:
On 2021-03-18,gmail.com wrote:
> On Thursday, March 18, 2021 at 10:51:20 AM UTC-4 BPJ wrote:
>
>> Den tors 18 mars 2021 15:...@gmail.com> skrev:
>>
>> I have multiple tabs open using :tabedit
>> I'm in a tab other than the right most.
>> :tabedit  opens a new tab to the right of the current tab
>> :q closes that tab but also advances the current tab again to the
>> right.

The following seems to work in both cases, though I haven't tested
it extensively.

:autocmd TabClosed * tabprevious

Regards,
Gary

Beautiful!
Just works.  No change to how I work. 

( I appreciate all responses, but this is what I was looking for! )

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/91bae87a-35ca-41e2-817d-af2b29c44d71n%40googlegroups.com.
BPJ
Reply | Threaded
Open this post in threaded view
|

Re: tabedit and closing

BPJ
Den tors 18 mars 2021 [hidden email] <[hidden email]> skrev:
On Thursday, March 18, 2021 at 12:14:43 PM UTC-4 Gary Johnson wrote:
On 2021-03-18,gmail.com wrote:
> On Thursday, March 18, 2021 at 10:51:20 AM UTC-4 BPJ wrote:
>
>> Den tors 18 mars 2021 15:...@gmail.com> skrev:
>>
>> I have multiple tabs open using :tabedit
>> I'm in a tab other than the right most.
>> :tabedit  opens a new tab to the right of the current tab
>> :q closes that tab but also advances the current tab again to the
>> right.

The following seems to work in both cases, though I haven't tested
it extensively.

:autocmd TabClosed * tabprevious

Regards,
Gary

Beautiful!
Just works.  No change to how I work. 

I quite like it too! I probably should take some time to learn about :autocmd!


( I appreciate all responses, but this is what I was looking for! )

I was also looking for this, without knowing it! :-)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/91bae87a-35ca-41e2-817d-af2b29c44d71n%40googlegroups.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhBzD1izq6buFWVvgaqX7iAtkQNvDRP%2BXtpN%3DdZ6M8vuYQ%40mail.gmail.com.