GithubHelp home page GithubHelp logo

liuchengxu / vim-clap Goto Github PK

View Code? Open in Web Editor NEW
2.1K 23.0 84.0 6.16 MB

:clap: Modern performant fuzzy picker, tree-sitter highlighting, and more, for both Vim and NeoVim

Home Page: https://liuchengxu.github.io/vim-clap/

License: MIT License

Shell 0.40% Python 0.93% Rust 72.06% Makefile 0.09% PowerShell 0.05% Lua 0.70% Vim Script 25.23% Scheme 0.34% HTML 0.19%
vim floating-window popup vim-clap fuzzy-finder nvim rust

vim-clap's Introduction

CI Gitter

Vim-clap stands as a comprehensive and efficient solution, providing powerful fuzzy pickers and replacements for various established Vim plugins, designed to support both Vim and NeoVim.

User facing documentation and guide

Contribution

Vim-clap is still in beta. Any kinds of contributions are highly welcome.

MIT

vim-clap's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-clap's Issues

Support more fuzzy filter mode using the existing tools like fzy, fzf, skim

It's definitely great to support more fuzzy filter mode on the strength of the existing fuzzy finder tools, e.g., fzy, fzf, skim. It's trivial to feed the input into these tools by using system(), but it's sync, I'm not quite a fan of this way. So the first thing is to support filtering in async, even for the sync provider. If you use the external tools for the fuzzy filter job, it has to be async. And then we could integrate the existing fuzzy finders.

The problems:

  • The query is possibly unable to be highlighted in vim-clap as there is no way to know which part of the query should be highlighted. If the fuzzy finder could return the matched position, then the highlights are possible.
  • It's unavoidable to use some shell commands, which can't work in Windows.
  • Using job to run in async will cause a redraw, but the redraw won't happen for sync run, which is more eye friendly.

Due to these problems, I personally still prefer these sync providers' source not huge to use the sync fuzzy filter, which could use Python, Lua or any other language based tools. For the sync provider monsters(having +10,000 or 100, 000 items, needs to be investigated), the async filter could be used.

However, for some providers, it's impossible to know the items count ahead, e.g, :Clap files which actually uses rg --files etc, if you run from a directory containing too many items, let's say the home direcotry that normally has over 800,000+ files in my case, vim-clap becomes less responsive, which could be improved of source. But the performance optimization will be later.

Window miscorrectly placed and sized when changing terminal dimensions

  1. Start up terminal with a smallish size (e.g. left half off screen)
  2. Start neovim with plugin installed
  3. Run Clap files and notice that window is correctly sized
  4. Resize terminal (e.g. full screen)
  5. Run Clap files and notice the window is not correctly centered and is not the correct size

2019-10-08_22-58-20

preview support for FZF

Just wanted to get clarification whether the preview feature referred to in the Read-Me is equivalent to the image below:

image

Center popup on active split, not full window

Low priority feature request...

When you have a couple splits open and launch the popup and it centers itself on the window, it is easy to loose track of where you were when you started. The resulting file open, split, or other operation is going to happen in the particular buffer that was active at the time of launching, but with the popup potentially over a different buffer it's easy to get confused.

Positioning (and sizing) the popup centered over the active buffer should make this feel better for many scenarios.

Obviously this should be a configuration option because some peoples' workflows will make the current behaviour more desirable.

More fancy `Clap buffers`

Is your feature request related to a problem? Please describe.
Currently Clap buffers merely shows the output of :buffers, which could be polished obviously. :buffers usually won't be huge, so we don't have to worry about the performance.

Describe the solution you'd like

Like also showing the icons and filesize.

屏幕快照 2019-10-01 上午10 43 08

Feel free to comment here if you have some thoughts on this, better in picture.

Plugin hangs when `Cmd files` in executed from $HOME CWD

If Clap files or similar command related to searching is executed with $HOME or a folder with large number of files/folders as current working directory, command hangs without a way out. Only way to recover is killing vim(I tested using neovim).
Is there a way out in this situation?

Error on `:Clap` with `vim -u NONE`

Warning: if you don't fill this issue template and provide the reproducible steps the issue could be closed directly.

Environment (please complete the following information):

  • OS: Arch Linux
  • (Neo)Vim version: Vim 8.1.1968
  • vim-clap version: 95fc330
  • Have you reproduced with a minimal vimrc: I have reproduced with vim -u NONE.

Describe the bug
A clear and concise description of what the bug is.

I get an error whenever I run the :Clap command (e.g. :Clap files):

Error detected while processing /home/olmo/.vim/pack/plugins/start/clap/autoload/clap.vim:
line   17:
E116: Invalid arguments for function map(
line   18:
E10: \ should be followed by /, ? or &
line   19:
E10: \ should be followed by /, ? or &
line   20:
E10: \ should be followed by /, ? or &
line   22:
E121: Undefined variable: s:builtin_providers
line   24:
E15: Invalid expression: {
line   25:
E10: \ should be followed by /, ? or &
line   26:
E10: \ should be followed by /, ? or &
line   27:
E10: \ should be followed by /, ? or &
line   29:
E121: Undefined variable: s:provider_alias
E116: Invalid arguments for function extend(s:provider_alias, get(g:, 'clap_provider_alias', {}))
line   31:
E15: Invalid expression: {
line   32:
E10: \ should be followed by /, ? or &
line   33:
E10: \ should be followed by /, ? or &
line   34:
E10: \ should be followed by /, ? or &
line   35:
E10: \ should be followed by /, ? or &
Error detected while processing function clap#init#[19]..<SNR>3_init_hi_groups[2]..<SNR>3_hi_spinner:
line   17:
E116: Invalid arguments for function printf(
Error detected while processing function clap#[20]..clap#for:
line    1:
E121: Undefined variable: s:provider_alias
E116: Invalid arguments for function has_key(s:provider_alias, a:provider_id_or_alias)

To Reproduce
Steps to reproduce the behavior:

  1. Make sure vim-clap is in 'packpath', e.g. mkdir -p ~/.vim/pack/plugins/start && git clone https://github.com/liuchengxu/vim-clap .vim/pack/plugins/start/vim-clap.

  2. Start (neo)vim with command: vim -u NONE.

  3. Type :packadd vim-clap<CR>.

  4. Check that only the vim-clap scripts are loaded with scriptnames:

  1: ~/.vim/pack/plugins/start/clap/plugin/clap.vim
  2: ~/.vim/pack/plugins/start/clap/autoload/clap.vim
  3: ~/.vim/pack/plugins/start/clap/autoload/clap/init.vim
  4: ~/.vim/pack/plugins/start/clap/autoload/clap/util.vim
  1. Type :Clap files.

  2. Get the error above.

Expected behavior
I would not expect an error on a Vim with no configuration.

Feature request: provider for git-revise

Something I do quite frequently from vim in stage very small touchup fixes from the buffer using gitgutter to the git staging area, then switch to tig to look though and find the commit that the small touchup was supposed to be in, then run git revise to quickly put it there. The slowest part of this is finding the hash from the log and copying it to a command.

A Clap provider that showed the git log and executed by running git revise with the hash would speed this up immensely.

This is a feature request, so obviously not high priority. If nobody steps up with a provider contribution I might eventually try my hand at one, but I'm leaving this issue to track it because I don't have time at the moment.

Commands Ctrl+t and friends throw error

The shortcuts for opening files in a new tab or split return an error.

  • OS: Linux (Arch)
  • NeoVim version: 0.4.2
  • vim-clap version: current HEAD
  • Have you reproduced with a minimal vimrc: yes

:Clap! files to launch the files provider, select any file, and hit Ctrlt to open file in a new tab. The following error is thrown:

Error detected while processing function <SNR>39_action:
line 2:
E117: Unknown function: <SNR>39_sink

Use a pre-existing fuzzy finder (fzy, selecta, pick)

I think it would be beneficial to use a pre-existing fuzzy finder or at least make it configurable for a user to use their own fuzzy finder. There are many different ones and if I were to install this, I'd have two (vim-clap and fzy) on my PC instead of just the one I currently use.

Not to mention also that vim-claps fuzzy finder is coupled to vim so can't be used in the shell.

Thoughts?

Can't open file on win7

Environment (please complete the following information):

  • OS: win7
  • NeoVim version: 0.4.0-1567
  • vim-clap version: new
  • Have you reproduced with a minimal vimrc: ???

Describe the bug
QQ截图20191023091834

Changing the search header's contrast

Is your feature request related to a problem? Please describe.
Hi! First of all congrats and thanks for this plugin 🙌 .
I'm using Nova color scheme, and the search header in the floating window is really hard to read due to its lack of contrast:

image

I'm not familiar with neovim's styling syntax. I have read the highlights section of the readme file, and have been playing around with the options, but unfortunately, I haven't been able to change the contrast at all. Could you point me in the right direction to change the background color so it's more readable?

Thanks in advance :)

Few observations during testing

Environment (please complete the following information):

  • OS: Ubuntu 18.04
  • NeoVim version: latest HEAD
  • vim-clap version: latest HEAD

Describe the bug
During testing of this plugin, I observed following.

  • Current file position is reset to beginning of the file if clap window is opened and cancelled(by pressing ESC key)
  • Adding to the above point, when an item(file based provider) on clip window is selected and executed, cursor is reset to first line of the selected buffer. This is very annoying as user has to go back to desired buffer position manually.
  • When clap floating window is displayed, current selected sign is not shown unless C-j/k are pressed.

Can't open file in git recursive directory.

Instructions: Replace the template text and remove irrelevant text (including this line)
Warning: if you don't fill this issue template and provide the reproducible steps the issue could be closed directly.

Environment (please complete the following information):

  • OS: win7
  • (Neo)Vim version: 0.5.0-180
  • vim-clap version: new

Describe the bug

--git directory
-----file0
-----another git directory(not gitsubmodule)
-------------file1
-------------file2
-----another git directory(not gitsubmodule)
-------------file3
-------------file4

I use Clap files command, it can search file1, file2, but can't use <C-x>, <C-t>, <C-v> open it, only use <Enter> open it.

":Clap buffers" should omit the current buffer

Is your feature request related to a problem? Please describe.
Since #59, :Clap buffers sorts files in LRU order which makes toggling between two buffers (e.g., a src file and its tests) a lot easier.

However, the list of buffers also contains the current buffer which is always on top. This requires you to type an additional Ctrl+j (or Down key) when you want to toggle between two buffers.

Describe the solution you'd like
The current buffer should be omitted from the buffers list (or at least be put on its end).

Describe alternatives you've considered
Switching back to Ctrlp.vim 👼 🙊 ❤️

Cannot execute a provider from the list obtained by :Clap

Environment (please complete the following information):

  • OS: macOS Catalina
  • (Neo)Vim version: v0.4.2
  • vim-clap version: master (commit 177e0ec3)
  • Have you reproduced with a minimal vimrc: yes

Describe the bug
When I type :Clap, it opens a window with all providers. However, after selecting any of them, I get the message unimplemented on the command line.

To Reproduce
Steps to reproduce the behavior:

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=/path/to/vim-clap
syntax on
filetype plugin indent on
  1. Start (neo)vim with command: vim -u min.vim

  2. Type ':Clap'

  3. Select any provider.

  4. The message _ unimplemented will be printed on the command line.

Expected behavior
The selected provider should be executed.

Clap jumps does not set correct syntax highlight when opening a file

Environment (please complete the following information):

  • OS: macOS Catalina
  • (Neo)Vim version: v0.4.2
  • vim-clap version: master (commit 177e0ec3 )
  • Have you reproduced with a minimal vimrc: yes

Describe the bug
When a file is opened and :Clap jumps is used to go to another file, this new file is opened without any syntax highlight.

To Reproduce
Steps to reproduce the behavior:

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=/path/to/vim-clap
syntax on
filetype plugin indent on
  1. Start (neo)vim with command: vim -u min.vim

  2. Open a file.

  3. Use :Clap jumps to go to another file.

  4. The new file will be opened without any syntax highlight.

Expected behavior
The new file should be opened with the correct syntax highlight.

`Clap` is unable to work

  • OS: Ubuntu 16.04
  • Neovim version: 0.4
  • vim-clap version: current, 1st October 11:13 AM CEST

Describe the bug

The title message appears when trying a clap command, e.g. :Clap.

Error detected while processing function clap#init#[19]..29_init_hi_groups[17]..29_hi_display_invisible:
line 3:
E421: Color name or number not recognized: ctermfg= guifg=
[vim-clap] Fail to load the provider: _

The line causing the issue is:

hi ClapDisplay cterm=bold ctermfg=white gui=bold guifg=#FFFFFF

When removed, seems to work fine.

To Reproduce

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=~/.local/share/nvim/plugged/vim-clap
filetype plugin indent on
syntax on
set hidden

hi ClapInput cterm=bold ctermfg=white gui=bold guifg=#FFFFFF
hi ClapDisplay cterm=bold ctermfg=white gui=bold guifg=#FFFFFF
  1. Start neovim with command: nvim -u min.vim

  2. Type :Clap

  3. See error

Expected behavior

Clap's popup with correct colors.

Navigate window items with cursor keys

The default way to move between items in windows feels quite unintuitive (at least compared to other alternatives like fzf.vim). It would be nice if there was the option to navigate between the items using the keyboard cursor keys as an alternative.

\{ causes Clap grep to error out and leaves the GUI in a broken state

Environment (please complete the following information):

  • OS: Gentoo Linux
  • (Neo)Vim version: NeoVim 0.4.2
  • vim-clap version: commit hash 699e8c9
  • Have you reproduced with a minimal vimrc: no

Describe the bug
Sometimes I want to grep for special characters like {.
However, when I type \{ I get the following error:

Error detected while processing function <lambda>26[1]..<SNR>120_apply_grep[7]..<SNR>120_spawn[29]..58[5]..53[2]..<SNR>117_matchadd:
line    2:
E554: Syntax error in \{...}

If I press enter a few times to dismiss the error messages, I get the correct
search results, but I can't select them as the floating window now acts as an
editor.

The window still lingers and it seems like I have to quit neovim to recover.

To Reproduce
Steps to reproduce the behavior:

  1. Start neovim with vim-clap and ripgrep installed

  2. Launch the clap grep window with :Clap grep

  3. Type \{

  4. See error

Expected behavior
Don't error out when \{ are in the search string.

Add a provider for yank history

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
It would be very nice to have a provider that shows the Yank history more or less to what this plugin does: https://github.com/vim-scripts/YankRing.vim

Describe alternatives you've considered
I am currently using YankRing, but it will be a very nice feature in vim-clap. Like, Clap yank (or something) will open a list of past yanked text so that you can select and paste by pressing enter.

Additional context
N/A

Option to open files and grep from git/svn base directory

The interface of this plugin is very nice and looking forward for more features.

It would be really nice to provide commands to open files from git base directory of the current buffer, MRU(both systemwide and withing git repositoryones(if buffer in git)) and grep inside git repository. With these, I can ditch ctrlp and start using this plugin fulltime.

Thank you for this promising plugin!

Sign and rooter related options renaming

These two options will be renamed:

  • g:clap_current_selection_sign_definition -> g:clap_current_selection_sign
  • g:clap_selected_sign_definition -> g:clap_selected_sign

zsh:1: command not found: fd

Environment :

  • OS: macOS 10.14.6
  • Vim version: 8.1.2064
  • vim-clap version: latest
  • Have you reproduced with a minimal vimrc: yes

Describe the bug
Screen Shot 2019-10-02 at 17 53 25

To Reproduce

:Clap files
  1. Create the minimal vimrc min.vim:
set nocompatible
let &rtp=&rtp.','.$HOME.'/.vim/bundle/vim-clap'
colorscheme desert "default setting 
filetype plugin indent on
syntax on
  1. Start (neo)vim with command: vim -u min.vim

  2. run command:

:Clap files

Expected behavior

No error

What difference about Clap files and Clap gfiles

In a git project, I use Clap files, it get 35 files. And I use Clap gfiles, it get 38 files.
This is a very strange phenomenon.

When I use Clap files, I want get all files in root directory, Otherwise I can use Clap gfiles.

Only show file name

QQ截图20191022085723

Need an option, when the option is true, only show the result of matching the file name and search word.
Like above, only show _nvimrc

Support like fzf-vim History command.

I'm using History command to switch recent files and History/ command to select histories of search.

I'm poor at programing language of vim, but I like the floating windows feature very much.

Support tags via gutentags as alternative to vista

The current tag provider implementation requires vista. While vista is quite a nice system and I've evaluated switching to it in the past, I keep settling back on gutentags and tagbar as my preferred plugins for tag management. Some of my uses for tagbar could be better served with Clap. It's nice to have the overview pane stick around sometimes, but when I just want to jump to something and be done with it Clap would make more sense.

Supporting tags via gutentags without requiring vista would be a nice future addition. Of course this doesn't have to be done by the plugin author, anybody could contribute this! I might try someday but won't get around to it soon if anybody else wants to take a stab at it go ahead.

Disable deocomplete in popup

I'm using deoplete.nvim for completion in Neovim, and it is trying to complete the input for Clap. I see other completion tools (e.g. CoC #29) have been disabled for that field. Please include a way to not conflict with deoplete as well.

Easymotion conflict

Instructions: Replace the template text and remove irrelevant text (including this line)
Warning: if you don't fill this issue template and provide the reproducible steps the issue could be closed directly.

Environment (please complete the following information):

  • OS: Windows
  • (Neo)Vim version: ???
    image
  • vim-clap version: ???

Describe the bug
A clear and concise description of what the bug is.
image

To Reproduce
Steps to reproduce the behavior:
Install easymotion, run Clap colors, press C-j

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=/path/to/vim-clap
syntax on
filetype plugin indent on

Plug 'easymotion/vim-easymotion'

Expected behavior
No errors

Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional context
Add any other context about the problem here.

Showcase

vim-clap-1024-98

Feel free to post here if you also have some cool GIFs or screenshots.

Allow calling `files` or `grep` provider for specific directory

I'd like to be able to specify which directory is searched using an argument to the files or grep providers.
e.g. something along the lines of:
Clap files app/ - search a specific directory
Clap files . - search the current directory
Clap files .. - search the parent directory

This would be particularly useful when you have a file open and want to open another file known to be in the same directory.

The same feature was already requested in a comment against issue 6.

"Clap buffers" should be ordered in LRU-order

The list displayed by :Clap buffers is currently sorted by buffer number. It would be more convenient if it was sorted descencingly by the time of last use.

I have mapped :Clap buffers to <leader>ob (open buffer). If the list was sorted by LRU, I could simply type ,ob<CR> to toggle between the both last used buffers (e.g., implementation and corresponding tests).

Clap doesn't find file with partial inputs

Environment:

  • OS: Ubuntu 16.04
  • Neovim version: 0.4
  • vim-clap version: c469dd0 (2nd October 12:32 PM CEST)

Describe the bug

When looking for a file LocalInterface with partial characters contained in that name, matches are no found.

To Reproduce

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=~/.local/share/nvim/plugged/vim-clap
filetype plugin indent on
syntax on
set hidden
  1. Create file LocalInterface:
touch LocalInterface
  1. Start neovim with command: nvim -u min.vim

  2. Type :Clap files

  3. In Clap prompt window, type loin.

  4. File LocalInterface doesn't appear, instead no matches are found.

Expected behavior

File is found when searching with partial characters; as in FZF.

Disable popup menu in the floating window

Is your feature request related to a problem? Please describe.
If an autocompletion plugin like deoplete is enabled, entering a query in floating window displaying pum which covers the results. This is very annoying.

Describe the solution you'd like
Disabling popupmenu in the floating window solves this problem.

Clap files doesn't work

  • OS: Arch Linux
  • NeoVim version: 0.4.2
  • Have you reproduced with a minimal vimrc: yes

When I try to use :Clap filesit firstly displays all files, but when I start typing something it just says provider.on_typed: clap:No external filter available .
I checked on my laptop with older version of plugin installed and it works, but after an update it is also broken.

Clap tags errors

I'm using Vista + Coc, and I wanted to try out :Clap tags, and I have found the following:

While running the command for the first time, it throws the following errors on neovim:

UpdateLastColumn failed to find bufnr 6 in w:BufKillList
UpdateLastColumn failed to find bufnr 6 in w:BufKillList
Press ENTER or type command to continue

After pressing ENTER, it displays the tags as expected:

image

However, the search doesn't work:

image

And if I delete the search text, it doesn't list the tags anymore:

image

"Clap buffers" fails when :term is the current buffer

Environment (please complete the following information):

  • OS: macOS
  • (Neo)Vim version: 0.4.x
  • vim-clap version: bf6d561
  • Have you reproduced with a minimal vimrc: yes

Describe the bug
When the neovim term (:term) is the current buffer, :Clap buffers only shows an error message in the flowting window: provider.get_source: Vim(lcd):E472: Command failed

To Reproduce
Steps to reproduce the behavior:

  1. Create the minimal vimrc min.vim:
set nocompatible
set runtimepath^=/path/to/vim-clap
syntax on
filetype plugin indent on
  1. Start (neo)vim with command: vim -u min.vim

  2. Type :term<CR>:Clap buffers<CR>

  3. See error

Expected behavior
Show the list of openbuffers.

Allow option to disable icons from being drawn

Is your feature request related to a problem? Please describe.
Yes, the icons being used to drawn on grep are being displayed as a bunch of boxes. I have attached two examples of how they look to me.
I do not know why they aren't showing up, but I believe it probably has to do with either the font, os or locale.

Describe the solution you'd like
I think adding an option to disable drawing icons would be beneficial, as I and probably others prefer to not have icons shown.

Describe alternatives you've considered
The current alternative that I am using is to remove the converter configuration from grep provider.

let s:grep.converter = function('s:draw_icon')

Additional context
image

image

PS: Thank you for the amazing plugin. ❤️

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.