0

This question already has an answer here:

I'm using a combination of buffers and splits. What I want is for :bnext or :bprev (or some equivalent) not to open buffers that are already opened in some other split or tab.

Is this possible?

marked as duplicate by Rich, Herb Wolfe, statox Nov 16 '17 at 16:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I think your question is a duplicate of this question I asked a few years ago. Note that I didn't find any satisfying answer and then realized that the problem came from my workflow and not the possiblity to skip a buffer :) – statox Nov 16 '17 at 14:36
  • 1
    It reads like a duplicate to me, too. And there's some great answers on the linked question! – Rich Nov 16 '17 at 15:47
  • 1
    set nobuflisted – Christian Brabandt Nov 16 '17 at 16:04
1

As an alternative, stop using :bnext / :bprev for navigation.

"Why ride a bike when you can fly?"

Just open the buffer you want where you want to open it (and how).

Behold the power of :b!:

  • Uses <tab> completion
  • Use <c-d> to list out completion
  • Use partial file name. e.g. :b foo. Works great with <tab>.
  • Globbing. e.g. :b foo*bar or :b foo/**/bar
  • Split variant of :b is :sb.
  • Also accepts a buffer number
  • A common mapping: nnoremap <leader>b :ls<cr>:b<space>

Using :b / :sb will allow you to simply open the buffer you want. No more cycling. No more worrying about the buffer list (:set hidden). This often leads to simpler window layouts, because you do not feel like you need to "store" a buffer in some split because it is tedious to find it again.

  • Actually i just have a buffer on right side which is mostly terminal and have like 2-3 hidden buffers. So while my terminal is there i just use <tab> <s-tab> bindings to quickly go back and forth with the keys if i hape a lot of buffers i mostly use ctrlp in buffer mode – nikoss Nov 16 '17 at 20:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.