Reputation: 933
I've opened a few files in Neovim which are loaded into buffers.
I'd like to be able to move between these files/buffers. How can I do this?
Upvotes: 6
Views: 19501
Reputation: 28389
There are various ways to achieve what you want. Pick what you like.
:ls
to print the buffer info. You see something like the following:1 h "foo.txt" line 2 3 h "bar.txt" line 5
The first number in each line is the buffer number. Then run command :buffer
followed by buffer number, e.g., :buffer 3
will open bar.txt
.
Use a plugin like bufferline.nvim. Once installed, it can show all your opened files in the tabline. You can then click the tabline to open a certain file, just like what you have done in a GUI editor.
Use a fuzzy finder like telescope.nvim. Then run command :Telescope buffers
to choose the buffer you want to open fuzzily.
Upvotes: 8
Reputation: 3063
Disclaimer: I am a vim, not a nvim user. But I assume the help is similarly organised or at least gives applicable advice in this case.
I would see :help windows.txt
, and in particular from line 618:
==============================================================================
7. Argument and buffer list commands *buffer-list*
args list buffer list meaning ~
1. :[N]argument [N] 11. :[N]buffer [N] to arg/buf N
2. :[N]next [file ..] 12. :[N]bnext [N] to Nth next arg/buf
3. :[N]Next [N] 13. :[N]bNext [N] to Nth previous arg/buf
4. :[N]previous [N] 14. :[N]bprevious [N] to Nth previous arg/buf
5. :rewind / :first 15. :brewind / :bfirst to first arg/buf
6. :last 16. :blast to last arg/buf
7. :all 17. :ball edit all args/buffers
18. :unhide edit all loaded buffers
19. :[N]bmod [N] to Nth modified buf
. . . . .
. . . . .
. . . . .
and from line 1200 onwards:
:[N]b[uffer][!] [+cmd] [N] *:b* *:bu* *:buf* *:buffer* *E86*
Edit buffer [N] from the buffer list. If [N] is not given,
the current buffer remains being edited. See |:buffer-!| for
[!]. This will also edit a buffer that is not in the buffer
list, without setting the 'buflisted' flag.
Also see |+cmd|.
. . . . .
. . . . .
. . . . .
Upvotes: 0