0

I've been looking for years for a way to quickly select a buffer from the buffer list.

scenario:

  1. open the buffer list with :ls
  2. select the desired buffer with arrows or whatever
  3. open said buffer pressing enter

That would save a lot of time and keystrokes and I reckon really fits the workflow, how come it's not a default thing?
Is there a way to achieve it?

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
Salomanuel
  • 101
  • 1
  • 3

3 Answers3

2

I like to use the fzf.vim plugin for that purpose. It includes a command where you can select a buffer, and also fuzzy-search for one (as its name suggests, it fuzzy-searches using fzf).

I really love this plugin, I really use it a lot. In fact, you can search for a lot of things with it : Lines in file, lines in buffer, Helptags, Colorschemes, Commands... and you can add other sources yourself !

0

In addition to the above mentioned plugins, you can also try using the buffer selector plugin:

https://github.com/yegappan/bufselect

BTW, patch 8.2.4463 added fuzzy completion for buffer names. With this feature, you can type a few characters from the buffer name and complete the buffer name.

0

I am using minimalist plugin 'romgrk/barbar.nvim' . commands are listed on its GitHub page

  • You can also add your key mappings to quickly execute those commands to switch buffers/ close / prev/ next buffer

Here is snapshot of my init.lua where I configured, also if you can see on top, it shows Tab name with icon as per plugin

enter image description here

  • 1
    Welcome and thank you for writing an answer. I think your answer could be even better if you not only linked to the GitHub page but also included a short example how the plugin would be used to improve on the scenario detailed in the question. – Friedrich Mar 08 '24 at 12:19
  • Thanks for feedback. Added snapshot – Nisarg Parikh Mar 09 '24 at 05:47
  • Yeah, kind of better. Prefer to post text as text, though. Sure, you can't capture the icon but the mappings should be text in a code section. Why text is better is explained in this SO meta question. The same reasons apply here as well. – Friedrich Mar 09 '24 at 14:18
  • @Friedrich that section is copy pasted from github link which I have already provided. you can copy text from there itself. – Nisarg Parikh Mar 11 '24 at 08:07