Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort buffers by fricensy of use #179

Closed
Stanislav-Lapata opened this issue Oct 18, 2020 · 11 comments · Fixed by #208
Closed

Sort buffers by fricensy of use #179

Stanislav-Lapata opened this issue Oct 18, 2020 · 11 comments · Fixed by #208
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@Stanislav-Lapata
Copy link

Hi, thanks for a wonderful project.

Can you add sort for require'telescope.builtin'.buffers?
When I use buffers. I would like to see the last files used at the bottom of the list.
981866b5182e84ddfbdd10a1e6d196be
I open Gemfile and then Procfile, but they find at the top of the list.

@tjdevries
Copy link
Member

So highest buffer number in the bottom or actually the last buffer you were in?

@Stanislav-Lapata
Copy link
Author

Stanislav-Lapata commented Oct 19, 2020

Actually the last buffer I was in.
If it helps you, I saw similar logic in fzf.vim.

@rockerBOO rockerBOO added the enhancement Enhancement to performance, inner workings or existent features label Oct 22, 2020
@sunjon
Copy link
Contributor

sunjon commented Oct 23, 2020

I'd wanted this feature too. I'm not sure about how FZF ordered the buffers, because I don't want to be navigating with cursor keys in a fuzzy finder.. what was useful, was the "%" buffer being pinned to the top.

Then if I have <leader><CR> mapped to telescope buffers, I can hit <leader><cr><cr> to toggle back and forth between two buffers.

@tjdevries
Copy link
Member

But that's builtin, you can use <C-^>, right?

@tjdevries
Copy link
Member

To neovim I mean.

@sunjon
Copy link
Contributor

sunjon commented Oct 27, 2020

But that's builtin, you can use <C-^>, right?

Sure, I could. But I find that an inconvenient shortcut that seem chosen. For me it's about least resistance and keeping my hands on the homerow.

I map <Leader>(space)+<CR> to present the buffer list
The keys to interact with the window are <esc> (caps-lock)[homerow], <C-j>/<C-k>[homerow], and which my finger is already on. The choice of four or five buffers are available from a couple of key presses beneath keys my fingers are already on, without be having to even begin an actual fuzzy search.
It becomes a zero-thought process.

It does feel like I'm reasoning on Junegunn' behalf though, as it's nothing more than a request for the same feature as FZF, and that feature was undoubtedly a design choice.
In fact not only does FZF bump the previous buffer to the top of the list for this convenience, it also shows % / ^ /etc marks preceeding the buffer name.

@Conni2461
Copy link
Member

I would take a closer look at this in the next few days, if it is okay for all involved.

@cseelus
Copy link

cseelus commented Jul 11, 2021

@Stanislav-Lapata Did you ever get this to work with #208? Also which theme are you using? Looks really decent 👍

@creativecreature
Copy link

creativecreature commented Aug 28, 2021

This section of the README describes how to achieve this: https://github.com/nvim-telescope/telescope.nvim#customize-default-builtin-behavior

This is the configuration you would need:

local actions = require('telescope.actions')require('telescope').setup{
  pickers = {
    buffers = {
      sort_lastused = true
    }
  }
}

drmohundro added a commit to drmohundro/dotfiles that referenced this issue Oct 2, 2021
@Herz3h
Copy link

Herz3h commented Sep 12, 2023

This is not shown anymore in the README, it talks about sorters, but no example on how to override the default one..

@Conni2461
Copy link
Member

Most of the documentation is moved from the readme to the :help telescope. How to configure setup is shown in :help telescope.setup and the buffer options are documented here :help telescope.builtin.buffers.

It makes more sense to have the documentation in vim, rather than in the readme.

The readme is meant as a quickstart not on how to configure every single detail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants