How do I switch to a specific buffer by number?
Answer
:b {number}
Explanation
The :b command followed by a buffer number switches directly to that buffer. Use :ls first to see buffer numbers.
How it works
:b 3switches to buffer number 3:b filenameswitches by partial filename match:sb 3opens buffer 3 in a new split
Example
:ls " Shows: 1 main.go, 2 utils.go, 3 test.go
:b 2 " Switch to utils.go
:b test " Switch to test.go (partial match)
Tips
- Tab completion works with
:b: type:bthen press Tab :bwith no argument switches to the alternate buffer:bd 3deletes (unloads) buffer 3- Buffer numbers do not change when buffers are deleted