Skip to content
Aleksandr Kirillov edited this page Oct 16, 2023 · 7 revisions

Welcome to the easypick.nvim wiki!

Recipes

Here are a few useful recipes on how to leverage Easypick to create awesome custom pickers!

Make targets

Here is an example of a picker that lists make targets and executes them in Floaterm

local list_make_targets = [[
make -qp |
awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' |
grep -wv Makefile
]]

easypick.setup({
	pickers = {
		{
			name = "make_targets",
			command = list_make_targets,
			action = easypick.actions.nvim_commandf("FloatermNew make %s"),
			opts = require('telescope.themes').get_dropdown({})
		}
	}
})

Command palette

to create a "command palette" style picker that executes vim commands add this to your config

-- a list of commands that you want to pick from
local list = [[
<< EOF
:PackerInstall
:Telescope find_files
:Git blame
EOF
]]

easypick.setup({
	pickers = {
		{
			name = "command_palette",
			command = "cat " .. list,
                        -- pass a pre-configured action that runs the command
			action = easypick.actions.nvim_commandf("%s"),
                        -- you can specify any theme you want, but the dropdown looks good for this example =)
			opts = require('telescope.themes').get_dropdown({})
		}
	}
})
Clone this wiki locally