nvim-telescope / telescope-smart-history.nvim

A history implementation that memorizes prompt input for a specific context
MIT License
141 stars 5 forks source link

How is this extention supposed to work? #2

Open s1n7ax opened 2 years ago

s1n7ax commented 2 years ago

I installed the plugin and registered the telescope extension. Got bunch of errors but was fixed once the databases dir is created under .local/share/nvim/databases/. telescope_history.sqlite3 is present under that. When I use for instance, require"telescope.builtin".find_files() I was expecting it to prioritize the most opened file over the default list. Isn't it what this extension supposed to do or have I configured it wrong?

SQLite version: sqlite 3.37.1-1

require('telescope').setup({
    defaults = {
        path_display = { 'truncate' },
        file_ignore_patterns = {
            'dist',
            'target',
            'node_modules',
            'pack/plugins',
        },

        mappings = {
            i = {
                ['<C-h>'] = 'which_key',
                ['<C-n>'] = 'move_selection_next',
                ['<C-e>'] = 'move_selection_previous',
            },
        },
        history = {
            path = fn.stdpath('data') .. '/databases/telescope_history.sqlite3',
            limit = 100,
        },
    },
})

require('telescope').load_extension('fzf')
require('telescope').load_extension('smart_history')
Conni2461 commented 2 years ago

Its only about the input you make in the prompt (similar to bash history). Its a better implementation than the builtin one, see help telescope.defaults.history. So it doesnt memorize everything that was ever inputted, it also memorizes when (cwd) and where (picker) it was inputted. So if you switch projects you get the project specific history.

It has nothing to do with recent files. For that you should look into telescope-frecency

Hope that answers your question

kuntau commented 1 year ago

Hi @Conni2461

How is this better than Telescope oldfiles only_cwd=true? I'm confused what kind of history this extension improve?