nvim-telescope / telescope-frecency.nvim

A telescope.nvim extension that offers intelligent prioritization when selecting files from your editing history.
MIT License
796 stars 38 forks source link

Not working with vim-plug as plugin manager #29

Open dsiguero opened 3 years ago

dsiguero commented 3 years ago

Nothing happens when I try to run :Telescope frecency

init.vim

Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzy-native.nvim'
Plug 'tami5/sql.nvim'
Plug 'nvim-telescope/telescope-frecency.nvim'

telescope.lua

local actions = require('telescope.actions')
local themes = require('telescope.themes')

require('telescope').load_extension('fzy_native')
require('telescope').load_extension('frecency')

require('telescope').setup {
    defaults = {
        file_sorter = require('telescope.sorters').get_fzy_sorter,
        prompt_prefix = '>',
        color_devicons = true,

        file_previewer = require('telescope.previewers').vim_buffer_cat.new,
        grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new,
        qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,

        mappings = {
            i = {
                ["<C-x>"] = false,
                ["<C-q>"] = actions.send_to_qflist,
            },
        }
    },
    pickers = {
    },
    extensions = {
        fzy_native = {
            override_generic_sorter = false,
            override_file_sorter = true,
        },
        frecency = {
            show_scores = false,
            show_unindexed = true,
            ignore_patterns = {"*.git/*", "*/tmp/*"},
        }
    }
}
Conni2461 commented 3 years ago

You should load your extensions after require('telescope').setup. Does :Telescope frecency frecency work? or does :lua require('telescope').extensions.frecency.frecency() work? It might be that the lua dispatcher has some issues.

Other things you should do is in your config is remove the *_previewer options because these are applied on default. You should also not set file_sorter if you load fyz_native because fzy_native does this for you :)

dsiguero commented 3 years ago

Thanks for your reply! I have modified the config according to your comments, so now it looks like this:

local actions = require('telescope.actions')

require('telescope').setup {
    defaults = {
        prompt_prefix = '>',
        color_devicons = true,

        mappings = {
            i = {
                ["<C-x>"] = false,
                ["<C-q>"] = actions.send_to_qflist,
            },
        }
    },
    extensions = {
        fzy_native = {
            override_generic_sorter = false,
            override_file_sorter = true,
        },
        frecency = {
            show_scores = false,
            show_unindexed = true,
            ignore_patterns = {"*.git/*", "*/tmp/*"},
        }
    }
}

require('telescope').load_extension('fzy_native')
require('telescope').load_extension('frecency')

I can open frecency using :Telescope frecency frecency, and after that :Telescope frecency will just work, at least until I close neovim. After closing and reopening it, :Telescope frecency won't work anymore, having to :Telescope frecency frecency to "enable" the "single frecency" version of the command to work again.

marekdedic commented 3 years ago

Hi, from my experience the installation with vim-plug on linux was as simple as

sudo apt-get install sqlite3 libsqlite3-dev

And adding

Plug('tami5/sqlite.lua')
Plug('nvim-telescope/telescope-frecency.nvim')

...

require('telescope').load_extension('frecency')

to my init.lua