Thursday, March 18, 2021

Re: tabedit and closing

Den tors 18 mars 2021 16:25rwmit...@gmail.com <rwmitchell@gmail.com> 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:03rwmit...@gmail.com <rwmit...@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.

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 vim_use+u...@googlegroups.com.
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 vim_use+unsubscribe@googlegroups.com.
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CADAJKhDuApOW6D1nJWhm6E%3Dc%3DEBWZw%3DiVjg8ry%3DKSWc1POxrkQ%40mail.gmail.com.

No comments: