axkirillov / easypick.nvim Goto Github PK
View Code? Open in Web Editor NEWA neovim plugin that lets you easily create Telescope pickers from arbitrary console commands
License: MIT License
A neovim plugin that lets you easily create Telescope pickers from arbitrary console commands
License: MIT License
Hi,
I have an issue with compare_branch when I'm not in the root directory in my neovim session, I resolved my issue by doing
vim.api.nvim_command("cd git rev-parse --show-toplevel
")
before this all runs, but this changes which directory I'm in, which is a little bit annoying as I have to cd back to run my application.
Would there be a better solution for this?
I was trying to follow some of your examples but instead of having a command that would generate the list, have a static list of values to send in.
One example is a download to select a color scheme to apply. I tried the following config but it did not work:
local status_ok, easypick = pcall(require, 'easypick')
if not status_ok then
return
end
local supported_color_scheme = {
'Darktheme',
'SimpleThme',
'AnotherThme',
}
easypick.setup({
pickers = {
{
name = 'ColorScheme',
values = supported_color_scheme,
action = easypick.actions.nvim_command('FloatermNew colorscheme'),
opts = require('telescope.themes').get_dropdown({}),
},
},
})
I am on Windows and the default shell is cmd.exe (Windows command prompt) which has some limitations, especially when trying to get outputs (using echo etc.) to be used for the Telescope picker.
Is there a way we can set the shell to use so that I could run using powershell / pwsh?
Using a subset of the suggested config:
local easypick = require("easypick")
easypick.setup({
pickers = {
-- add your custom pickers here
-- below you can find some examples of what those can look like
-- list files inside current folder with default previewer
{
-- name for your custom picker, that can be invoked using :Easypick <name> (supports tab completion)
name = "ls",
-- the command to execute, output has to be a list of plain text entries
command = "ls",
-- specify your custom previwer, or use one of the easypick.previewers
previewer = easypick.previewers.default()
},
}
})
If one has a file named "Hello there.txt", the result of using :Easypick ls
results in two entries; namely "Hello" and "there.txt". Ideally this would return "Hello there.txt" as one entry.
Fixing this would also allow for using this plugin for custom grep commands, which would be awesome!
So one can adjust the entries that are loaded from the external command.
I would be happy to provide a PR for this if it makes sense to you.
Can we do same concept but with vim commands? In other words, lets say I want to get run a command like :changes
to see all my changes in my buffer or maybe :jumps
to get list of my jump list.
Essentially the same concept but instead of console commands, it would be with vim commands.
Thanks!
If I try to register a picker with an action, I get the following error when trying to use the picker:
Error executing Lua callback: /tmp/bar/telescope.nvim/lua/telescope/mappings.lua:324: attempt to call local 'attach_mappings' (a string value)
stack traceback:
/tmp/bar/telescope.nvim/lua/telescope/mappings.lua:324: in function 'apply_keymap'
/tmp/bar/telescope.nvim/lua/telescope/pickers.lua:740: in function 'find'
/tmp/bar/easypick.nvim/lua/easypick/pick.lua:100: in function 'one'
/tmp/bar/easypick.nvim/lua/easypick/init.lua:23: in function </tmp/bar/easypick.nvim/lua/easypick/init.lua:23>
Here is the minimal configuration I am using for reproducibility:
vim.opt.rtp:prepend("/tmp/bar/plenary.nvim")
vim.opt.rtp:prepend("/tmp/bar/telescope.nvim")
vim.opt.rtp:prepend("/tmp/bar/easypick.nvim")
local easypick = require("easypick")
easypick.setup({
pickers = {
{
name = "blah",
command = "ls",
action = "!echo %s"
}
}
})
If the picker do not specify an action, then everything works fine.
I am attempting to write some custom commands with easypick for grepping though very large code base. rg
is good but still not meeting my performance requirements. csearch
(it's index based search) is meeting my performance requirements. I am trying to add a custom command for it with easypick
plugin.
With below setup config previewer is empty for all
local easypick = require("easypick")
easypick.setup({
pickers = {
{
name = 'csearch-default',
command = 'csearch -n lsp',
previewer = easypick.previewers.default()
},
{
name = 'csearch',
command = 'csearch -n lsp',
previewer = require('telescope.previewers').vim_buffer_vimgrep.new({})
},
{
name = "rg-default",
command = "rg --color=never --no-heading --with-filename --line-number --smart-case --column lsp",
previewer = easypick.previewers.default()
},
{
name = "rg",
command = "rg --color=never --no-heading --with-filename --line-number --smart-case --column lsp",
previewer = require('telescope.previewers').vim_buffer_vimgrep.new({})
}
}
})
Please note lsp
is the hardcoded string that I am trying to search. If there are any pointers on how to make them dynamic it will be helpful too.
I see diff of results between Telescope grep_string
and Easypick rg
. Both files should have been identical as same command is run.
The picker branch_diff
is shown being passed a string
, but it expects a table that looks like { base_branch = "develop" }
. The documentation should be updated to show the correct table.
From the config example, there's a custom picker named "changed_files" that relies on a local
for the base branch. It would be great if, for instance, we could pass a base branch into the picker function when we use :Easypick changed_files develop
.
For now, I'll just define a changed_files
for each base branch I would compare against in my workflow, but it'd be great to extend other pickers this way, too.
Just want to say thank you. This is so useful and easy to use.
similar to this issue it would be awesome to run ad hoc pickers on the fly. Something like :lua require('easypick').adhoc('git diff develop --name-only')
or (if possible) :Easypick adhoc git diff develop --name-only
. It would make it a lot easier to test pickers before committing to using them, or throwing together a one off picker that I will never use again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.