In vim I'm opening 3 files in buffers: A,B,C (in this order). I'm going back to buffer B, I open buffer D (:e d) while being in B (so now I'm in D). But when I use :bprevious I go to C, but I would like to go to last visited buffer - B.
Is it possible to change buffer swiching order to use order of they activity, as in example above?
To jump back to line # 300 or previous position press CTRL-O (press and hold Ctrl key and press letter O). To jump back forwards press CTRL-I (press and hold Ctrl key and press letter I).
Press <shift-N> to go back to the previous occurrence of your find term.
You can use :tabmove followed by the tab number to move past. For example, :tabmove 3 will make the current tab move past the 3rd. :tabmove 0 moves to the beginning and :tabmove (without a number) moves to the end.
Search for text using / or for a word using * . In normal mode, type cgn (change the next search hit) then immediately type the replacement. Press Esc to finish. From normal mode, search for the next occurrence that you want to replace ( n ) and press . to repeat the last change.
I don't think it's possible to change the buffer list's order without some possibly dirty heavy lifting but there are quite a lot of buffer navigation plugins available.
This one, from the list, seems to adress your problem perfectly.
If you don't need to go to the previouser-previouser-previouser-previouser buffer, you might consider <C-^>
to switch to the previous one.
You can use the argument list. See :help :args
.
You can edit a file and put in the argument list easily with the :argedit
command. The argument list behave exactly what you would like.
You can use :n
command to edit the next file in the argument list and :N
(or :prev
) to edit the previous. It's even shorter then :bp
and :bn
!
+1 for editing the alternate file as @romainl said. It's really fast !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With