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

Can I use the same layout and sorter and find command as I do with find_files? #84

Closed
svanharmelen opened this issue Nov 15, 2022 · 3 comments

Comments

@svanharmelen
Copy link

I've seen #44 (comment) but I cannot seem to get the fzf extension to work with frecency. Here is my config:

-- Configure Nvim-Telescope
require('telescope').setup {
  defaults = {
    file_ignore_patterns = { '^.git/.*$' },
    mappings = {
      i = {
        ['<C-j>'] = actions.move_selection_next,
        ['<C-k>'] = actions.move_selection_previous,
        ['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
        ['<ESC>'] = actions.close,
      },
    },
  },

  extensions = {
    frecency = {
      default_workspace = 'CWD',
      sorter = require("telescope").extensions.fzf.native_fzf_sorter()
    },
  },

  pickers = {
    find_files = {
      hidden = true,
      layout_config = {
        horizontal = {
          width = 0.5,
          height = 0.5,
        },
      },
      previewer = false,
    },
    live_grep = {
      only_sort_text = true
    }
  }
}

-- Load DAP extension
require('telescope').load_extension('dap')

-- Load FZF extention
require('telescope').load_extension('fzf')

-- Load Frecency extension
require('telescope').load_extension('frecency')

-- Configure mappings
map('n', '<C-P>', ':Telescope find_files find_command=rg,--ignore,--files<CR>', opts)

If I add or remove the sorter option, the sorting/selecting based om my input doesn't change and works different then when doing the same in find_files. As for the find_command used, is there an option to set the for frecency?

And the last one is about the layout. Can I tweak the layout so I don't get the preview and have something similar like this:

image

Instead of this:
image

Thanks!!

@svanharmelen
Copy link
Author

Adding the show_scores helps to understand the given order, but I still have the impression the sorter doesn't work as I would expect it (or want it 😉)...

Currently a certain amount of files are never being ordered such that I can just hit enter to select them. Instead I regularly have to move up a line or ~10 to be able to open the file that I want. Even through the query I typed as input matches that line I wanted much much better then the bottom x lines (which have a higher score)... So is there a way to tweak this behavior?

Thanks!

@svanharmelen
Copy link
Author

It seems that the only way to achieve the config I'm searching for is forking the repo and changing this:

image

I'm not too well known in Lua or the Telescope ecosystem, but would it be difficult to make options for these values? Seems like it would allow people more freedom in setting up to extension to their liking...

@svanharmelen
Copy link
Author

Guess I'll just close this again as I no longer use telescope-frecency and apparently nobody else found this suggestion helpful or useful 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant