Skip to content

nvim lua dialog box with a history file, based on telescope UI

License

Notifications You must be signed in to change notification settings

bartman/history-select.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

history-select.nvim

Neovim Lua

This is a nvim lua plugin that provides a dialog box that allows selecting from past entries, and stores new input into a history file.

Install

lazy package manager

return {
    'bartman/history-select.nvim'
}

Usage

local mydialog = require('history-select').new( {
    title = 'My question...',
    history_file = 'question1',
    item_selected = function(self, selected)
        print("selected: " .. selected)
        print("history: " .. vim.inspect(self.history)
    end
})

vim.keymap.set("n", "<Leader>x", function()
    mydialog.ask()
end)

screencapture.png

History files

History is stored in ~/.config/nvim/history/ with the file name given as option history_file. They are just lua code that is loaded with a sandboxed lua interpreter.

return {
    ["DEFAULT"] = {
        [1] = "one",
        [2] = "two",
        [3] = "three",
        [4] = "four",
        [5] = "five",
        [6] = "six",
    },
}

TODO

  • use string.dump() for serialization
  • better documentation, examples of overrides, selecting different history_groups, etc

About

nvim lua dialog box with a history file, based on telescope UI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages