Skip to content

Commit

Permalink
ditto
Browse files Browse the repository at this point in the history
  • Loading branch information
Futarimiti committed Oct 2, 2023
1 parent 34f08a6 commit 266a5b9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Supports:
return
{ 'Futarimiti/spooky.nvim'
, dependencies = { 'nvim-telescope/telescope.nvim' }
, config = function ()
require('spooky').setup {}
require('telescope').load_extension 'spooky'
end
}
```

Expand Down
33 changes: 33 additions & 0 deletions lua/telescope/_extensions/spooky.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- our picker function: colors
local colors = function(opts)
assert(require 'telescope', 'Telescope is not installed')

local pickers = require 'telescope.pickers'
local finders = require 'telescope.finders'
local conf = require('telescope.config').values
local actions = require 'telescope.actions'
local action_state = require 'telescope.actions.state'

local template_list = { 'template1', 'template2' }

opts = opts or {}
pickers.new(opts, {
prompt_title = 'Select template',
finder = finders.new_table {
results = template_list
},
sorter = conf.generic_sorter(opts),
attach_mappings = function(prompt_bufnr, _)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
-- print(vim.inspect(selection))
vim.api.nvim_put({ selection[1] }, '', false, true)
end)
return true
end,
}):find()
end

-- to execute the function
colors(require('telescope.themes').get_ivy())

0 comments on commit 266a5b9

Please sign in to comment.