Friday, December 13, 2013

Re: vim: toggle between tabs and toggle between buffers

On Fri, Dec 13, 2013 at 2:51 PM, ping song <songpingemail@gmail.com> wrote:
> I tried these pseudo-codes, but these are just 1 time thing and won't change
> over time...couldn't figure out a good way.

Use the '<expr>' argument to map to have a dynamic behavior:

function NextBufferOrNextTab()
if tabpagenr("$") > 1
return ":tabn " . g:lasttab . "\<cr>"
else
return ":bn\<cr>"
endif
endfun

nnoremap <expr> ,l NextBufferOrNextTab()

Untested of course :)

I used similar method to have a dynamic map behavior for closing my
buffers [1].

Nazri

[1] quickquit.vim: https://gist.github.com/holygeek/7909458

--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment