Coder Social home page Coder Social logo

axkirillov / easypick.nvim Goto Github PK

View Code? Open in Web Editor NEW
346.0 5.0 5.0 23 KB

A neovim plugin that lets you easily create Telescope pickers from arbitrary console commands

License: MIT License

Lua 100.00%
cli lua neovim-plugin nvim nvim-plugin telescope telescope-extension neovim

easypick.nvim's Introduction

Hello there! ๐Ÿ

easypick.nvim's People

Contributors

axkirillov avatar lalitmee avatar peterfication avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

easypick.nvim's Issues

Issue with displaying git branches when not in root git directory

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?

Is it possibe to pass a static list of items to pick from?

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({}),
    },
  },
})

Can we provide how to run the command? Like which shell to use?

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?

Files with spaces in their names treated as multiple entries

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!

Add option to adjust entry_maker

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?

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.

  1. is that possible today with this plugin?
  2. is this something you would consider adding if it is not currently possible?

Thanks!

Action not working with neovim 0.9.5

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.

Empty easypick previewer for grep results

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.

Some quick analysis

I see diff of results between Telescope grep_string and Easypick rg . Both files should have been identical as same command is run.

quickfix diff between telescope grep_string and easypick rg

Typo in config example documentation

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.

Feature Request: Pass arguments to a picker

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.

Add ability to make ad hoc pickers

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.