How to change the order for: bnext and: bprevious in vim?

In vim, I open 3 files in buffers: A, B, C (in that order). I go back to buffer B, I open buffer D (: ed) while in B (so now I'm in D). But when I use: bprevious, I switch to C, but I would like to go to the last buffer visited - B.

Is it possible to change the buffer order of the buffer to use the order of their activity, as in the example above?

+6
source share
2 answers

I don’t think it is possible to change the order of the buffer list without any dirty heavy lifting, but there are quite a few buffer navigation plugins available.

This one from the list seems to fit your problem perfectly.

If you don't need to go to the previous-previous-previous-previous buffer, you can consider <C-^> to go to the previous one.

+3
source

You can use a list of arguments. See :help :args .

You can edit the file and easily add to the argument list with the command :argedit . The argument list behaves exactly as you would like.

You can use the command :n to edit the next file in the argument list and :n (or :prev ) to edit the previous one. This is even shorter than :bp and :bn !

+1 for editing an alternate file, as @romainl said. It's very fast!

+2
source

Source: https://habr.com/ru/post/901811/


All Articles