Freaky fast fuzzy Denite/CtrlP matcher for vim/neovim

Overview

Freaky fast fuzzy Denite/CtrlP matcher for vim/neovim

Installation

In your .vimrc:

fruzzy#install()}} " optional - but recommended - see below let g:fruzzy#usenative = 1 " When there's no input, fruzzy can sort entries based on how similar they are to the current buffer " For ex: if you're on /path/to/somefile.h, then on opening denite, /path/to/somefile.cpp " would appear on the top of the list. " Useful if you're bouncing a lot between similar files. " To turn off this behavior, set the variable below to 0 let g:fruzzy#sortonempty = 1 " default value " tell denite to use this matcher by default for all sources call denite#custom#source('_', 'matchers', ['matcher/fruzzy']) " tell CtrlP to use this matcher let g:ctrlp_match_func = {'match': 'fruzzy#ctrlp#matcher'} let g:ctrlp_match_current_file = 1 " to include current file in matches">
" vim-plug; for other plugin managers, use what's appropriate
" if you don't want to trust a prebuilt binary, skip the 'do' part
" and build the binaries yourself. Instructions are further down
" and place them in the /path/to/plugin/rplugin/python3 folder

Plug 'raghur/fruzzy', {'do': { -> fruzzy#install()}}

" optional - but recommended - see below
let g:fruzzy#usenative = 1

" When there's no input, fruzzy can sort entries based on how similar they are to the current buffer
" For ex: if you're on /path/to/somefile.h, then on opening denite, /path/to/somefile.cpp
" would appear on the top of the list.
" Useful if you're bouncing a lot between similar files.
" To turn off this behavior, set the variable below  to 0

let g:fruzzy#sortonempty = 1 " default value

" tell denite to use this matcher by default for all sources
call denite#custom#source('_', 'matchers', ['matcher/fruzzy'])

" tell CtrlP to use this matcher
let g:ctrlp_match_func = {'match': 'fruzzy#ctrlp#matcher'}
let g:ctrlp_match_current_file = 1 " to include current file in matches

Native modules

Native module gives a 10 - 15x speedup over python - ~40-60μs!. Not that you’d notice it in usual operation (python impl is at 300 - 600μs)

  1. Run command :call fruzzy#install() if you’re not using vim-plug.

  2. restart nvim

Manual installation

  1. Download the module for your platform. If on mac, rename to fruzzy_mod.so

  2. place in /path/to/fruzzy/rplugin/python3

  3. Make sure you set the pref to use native module - g:fruzzy#usenative=1

  4. restart vim/nvim

Troubleshooting/Support

Raise a ticket - please include the following info:

Get the version
  1. Start vim/nvim

  2. Activate denite/ctrlp as the case may be.

  3. Execute :call fruzzy#version() - this will print one of the following

    1. version number and branch - all is good

    2. purepy - you’re using the pure python version.

    3. modnotfound - you requested the native mod with let g:fruzzy#usenative=1 but it could not be loaded

    4. outdated - native mod was loaded but it’s < v0.3. You can update the native mod from the releases.

  4. include output of the above

Describe the issue
  1. include the list of items

  2. include your query

  3. What it did vs what you expected it to do.

Development

Build native module
  1. install nim >= 0.19

  2. dependencies

    1. nimble install binaryheap

    2. nimble install nimpy

  3. cd rplugin/python3

  4. [Windows] nim c --app:lib --out:fruzzy_mod.pyd -d:release -d:removelogger fruzzy_mod

  5. [Linux] nim c --app:lib --out:fruzzy_mod.so -d:release -d:removelogger fruzzy_mod

  6. -d:removelogger

    • removes all log statements from code.

    • When removelogger is not defined, only info level logs are emitted

    • Debug builds (ie: without -d:release flag) also turns on additional debug level logs

Running tests
  1. cd rplugin

  2. pytest - run tests with python implementation

  3. FUZZY_CMOD=1 pytest - run tests with native module

Comments
  • Don't sort if there is not filtering input

    Don't sort if there is not filtering input

    Hi, if I use let g:fruzzy#usenative = 0 with Denite file_mru candidates are correctly ordered by the last recent one opened first:

    ~/OneDrive/jampp/repos/macross/docs/docs/macross/win_rate.md
    ~/OneDrive/jampp/repos/macross-daat/daat/model.py
    ~/OneDrive/jampp/repos/macross-daat/docs/docs/estimator.md
    ~/OneDrive/jampp/repos/macross/docs/docs/macross/model.md
    ~/git-repos/private/dotfiles/setup-new/yay.sh
    ~/git-repos/private/dotfiles/vim/ftplugin/python/python_settings.vim
    ~/OneDrive/arch/install_notes.md
    ~/git-repos/work/ausa/store/requirements.txt
    ~/git-repos/private/dotfiles/python/requirements.txt
    ~/git-repos/private/dotfiles/setup-new/brew.sh
    ~/OneDrive/varios/todos_coding_setup.md
    ~/git-repos/private/dotfiles/vim/mysnippets/vim.snippets
    ~/git-repos/private/dotfiles/bashrc
    ~/git-repos/private/dotfiles/vim/vimrc_min
    ~/git-repos/private/dotfiles/vimrc
     Denite  file_mru(235/236)                                                                                      [/home/pedro/git-repos/private/dotfiles]  235/235
    

    on the other hand if i use let g:fruzzy#usenative = 1 then I get:

    ~/Desktop/lela.md
    ~/Desktop/bar.sh
    /etc/resolv.conf
    ~/Desktop/baz.sh
    ~/Desktop/bar.py
    ~/Desktop/foo.md
    ~/Desktop/api.py
    ~/Desktop/foo.sh
    ~/Desktop/foo.py
    ~/Desktop/baz.py
    ~/.bash_history
    ~/.Xauthority
    ~/.mongorc.js
    ~/.lesshst
    ~/.fehbg
    

    So my question is: if fruzzy is a matching/filtering algorithm why is it also sorting candidates without any kind of filtering input? I expect it to honor the initial source sorting.

    Another thing I've noticed is that when using the native version I get the following message before executing a denite source:

    [denite] fruzzy_mod ver: rev: v0.3 on branch: master
    

    Can that message be suppressed? Thanks in advance

    opened by petobens 17
  • KeyError: bufnr

    KeyError: bufnr

    Consider the following minimal vimrc:

    set nocompatible
    
    let $DOTVIM = expand('$HOME/.config/nvim')
    
    set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/denite.nvim
    set runtimepath+=$DOTVIM/bundle/repos/github.com/raghur/fruzzy
    filetype plugin indent on
    
    call denite#custom#source('_', 'matchers', ['matcher/fruzzy'])
    
    function! s:DeniteScanDir()
        let narrow_dir = input('Input narrowing directory: ', '', 'file')
        if narrow_dir == ''
            return
        endif
        call denite#start([{'name': 'file/rec', 'args': [narrow_dir]}])
    endfunction
    
    nnoremap <silent> ,sd :call <SID>DeniteScanDir()<CR>
    

    If I now type ,sd and then use . as narrowing dir then I get the following error:

    [denite] Traceback (most recent call last):
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/__init__.py", line 29, in start
    [denite]     return ui.start(args[0], args[1])
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/ui/default.py", line 71, in start
    [denite]     self._start(context['sources_queue'][0], context)
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/ui/default.py", line 121, in _start
    [denite]     self.update_candidates()
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/ui/default.py", line 312, in update_candidates
    [denite]     self._denite.filter_candidates(self._context)):
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/denite.py", line 120, in filter_candidates
    [denite]     self.match_candidates(ctx, matchers)
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/denite.py", line 159, in match_candidates
    [denite]     context['candidates'] = self.call_matchers(ctx, matchers)
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/denite.py", line 163, in call_matchers
    [denite]     ctx['candidates'] = matcher.filter(ctx)
    [denite]   File "/home/pedro/.config/nvim/bundle/repos/github.com/raghur/fruzzy/rplugin/python3/denite/filter/matcher/fruzzymatcher.py", line 55, in filter
    [denite]     buffer = context['bufnr']
    [denite] KeyError: 'bufnr'
    [denite] Please execute :messages command.
    

    BTW: Thanks for this awesome matcher.

    opened by petobens 16
  • Too many data will crash native fruzzy matcher

    Too many data will crash native fruzzy matcher

    When I use Denite with command_history source that will list vim command history and use native fruzzy matcher, it will crash. The detail bug information can be found in Shougo/denite.nvim#636. When I use nvim -i NONE to ignore previous command history, the problem is gone. So I think it's probably because my vim command history is too large.

    opened by mars90226 12
  • Crash on quit.

    Crash on quit.

    Hi there,

    I got a crash today using fruzzy when I quit nvim (or so I believe, I'm not 100% sure). Nothing serious but I thought I'd post the crashlog here since it might be of help in solving some bugs.

    https://pastebin.com/eRaqjzSR

    Thanks for the awesome plugin,

    Greetings, Sander.

    opened by sandersantema 7
  • Is it possible to write a CtrlP matcher with this?

    Is it possible to write a CtrlP matcher with this?

    Based on the description, I suspect it should be possible to write a CtrlP matcher with this as a backend. Do you think this is possible?

    See also ctrlp-py-matcher and cpsm.

    opened by lervag 7
  • Dein Plugin Manager removes .so files from rplugin/python folder after update of plugins/ :UpdateRemotePlugins

    Dein Plugin Manager removes .so files from rplugin/python folder after update of plugins/ :UpdateRemotePlugins

    The dein plugin manager removes .so files from .config/dein/.cache/init.vim/.dein/rplugin/python3/ while it doesn't do so with other plugins which install to the same directory. Do you have any idea why this might be? The dein documentation doesn't mention anything about adding the files as a requirement for a plugin.

    opened by sandersantema 5
  • KeyError: action__path

    KeyError: action__path

    Consider the following minimal vimrc:

    set nocompatible
    
    let $DOTVIM = expand('$HOME/.config/nvim')
    
    set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/denite.nvim
    set runtimepath+=$DOTVIM/bundle/repos/github.com/raghur/fruzzy
    filetype plugin indent on
    
    
    let g:fruzzy#usenative = 0
    call denite#custom#source('_', 'matchers', ['matcher/fruzzy',
            \ 'matcher/ignore_globs'])
    

    Now open vim/nvim and run :Denite command. I get the following error:

    [denite] Traceback (most recent call last):
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/__init__.py", line 29, in start
    [denite]     return ui.start(args[0], args[1])
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/ui/default.py", line 71, in start
    [denite]     self._start(context['sources_queue'][0], context)
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/ui/default.py", line 121, in _start
    [denite]     self.update_candidates()
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/ui/default.py", line 312, in update_candidates
    [denite]     self._denite.filter_candidates(self._context)):
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/denite.py", line 120, in filter_candidates
    [denite]     self.match_candidates(ctx, matchers)
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/denite.py", line 159, in match_candidates
    [denite]     context['candidates'] = self.call_matchers(ctx, matchers)
    [denite]   File "/home/pedro/git-repos/private/dotfiles/vim/bundle/.cache/init.vim/.dein/rplugin/python3/denite/denite.py", line 163, in call_matchers
    [denite]     ctx['candidates'] = matcher.filter(ctx)
    [denite]   File "/home/pedro/.config/nvim/bundle/repos/github.com/Shougo/denite.nvim/rplugin/python3/denite/filter/matcher/ignore_globs.py", line 42, in filter
    [denite]     return [x for x in context['candidates']
    [denite]   File "/home/pedro/.config/nvim/bundle/repos/github.com/Shougo/denite.nvim/rplugin/python3/denite/filter/matcher/ignore_globs.py", line 43, in <listcomp>
    [denite]     if not search(pattern, x['action__path'][:max_width])]
    [denite] KeyError: 'action__path'
    [denite] Please execute :messages command.
    

    Maybe it's something with recen updates with Denite @Shougo? Thanks

    opened by petobens 4
  • fruzzy install fail

    fruzzy install fail

    platform: macOS 10.14 neovim: 0.3.1 Python: 3.7.0 Error stack:

    Error detected while processing function fruzzy#install[1]..provider#python3#Call:
    line   18:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/seekr/.vim/bundle/fruzzy/python3/fruzzy_installer.py", line 34, in install
        print("fruzzy: downloading %s to %s" % (asset['browser_download_url'],
    TypeError: 'NoneType' object is not subscriptable
    

    Although it downloads native mod fail, it still work well for me. Thanks for your work! Awesome matcher

    opened by numbcoder 4
  • Crash on dein#recache_runtimepath()

    Crash on dein#recache_runtimepath()

    When doing call dein#recache_runtimepath(), I get this error:

    [dein] "C:/Users/cbrunel/AppData/Local/nvim/dein/.cache/init.vim/.dein" cannot be removed.
    [dein] cmdline is "rmdir /S /Q "C:\\Users\\cbrunel\\AppData\\Local\\nvim\\dein\\.cache\\init.vim\\.dein"".
    

    After trying to remove it with PowerShell, I saw that the file fruzzy_mod.pyd is still in use and therefore cannot be deleted. Is there any way to get over this issue?

    opened by Luxed 2
  • [python]: Bug - does not find match

    [python]: Bug - does not find match

    from PR #7

        l = ['.gitignore', 'README.adoc', 'python3/ctrlp.py',
                 'plugin/fruzzy.vim', 'autoload/fruzzy.vim',
                 'autoload/fruzzy/ctrlp.vim', 'rplugin/python3/fruzzy.py',
                 'rplugin/python3/qc-fast.py', 'python3/fruzzy_installer.py',
                 'rplugin/python3/neomru_file', 'rplugin/python3/qc-single.py',
                 'rplugin/python3/fruzzy_mod.nim', 'rplugin/python3/fruzzy_test.py',
                 'rplugin/python3/denite/filter/matcher/fruzzymatcher.py']
        results = scoreMatches("fmf", l, 10, True)
    

    Python version does not find rplugin/python3/denite/filter/matcher/fruzzymatcher.py

    opened by raghur 1
  • fix install for native module on mac

    fix install for native module on mac

    Current binary file not works on mac, as described at #2. I've uploaded the binary for mac at https://github.com/raghur/fruzzy/files/2433524/fruzzy.zip it need to be unzipped and upload to the release page as fruzzy_mod_mac.so

    opened by chemzqm 1
  • Set match limit to 1000

    Set match limit to 1000

    Constraining the match limit to winheight provides the user too few matches.

    Raising the limit to 1,000 makes the plugin behavior consistent with other filters, e.g., cpsm.

    opened by gotgenes 0
  • Feature request: Add deoplete matcher filter

    Feature request: Add deoplete matcher filter

    For comparison:

    • denite: https://github.com/Shougo/denite.nvim/blob/609c85797a5f6acc2e2357cf56e7f6c78c561145/rplugin/python3/denite/filter/matcher/cpsm.py
    • Deoplete: https://github.com/Shougo/deoplete.nvim/blob/bbec852adee45a1500fa817a3c17889dc328cad0/rplugin/python3/deoplete/filter/matcher_cpsm.py

    They're pretty similar, aside from matcher_fruzzy instead of matcher/fruzzy. :)

    opened by bb010g 0
Releases(v0.4)
Owner
Raghu
Raghu
Magma is a NeoVim plugin for running code interactively with Jupyter.

Magma Magma is a NeoVim plugin for running code interactively with Jupyter. Requirements NeoVim 0.5+ Python 3.8+ Required Python packages: pynvim (for

Daniel Csillag 372 Dec 26, 2022
Neovim integration for Google Keep, built using gkeepapi

Gkeep.nvim Neovim integration for Google Keep, built using gkeepapi Requirements Neovim 0.5 Python 3.6+ A patched font (optional. Used for icons) Tabl

Steven Arcangeli 143 Jan 2, 2023
Bringing emacs' greatest feature to neovim - Tetris!

nvim-tetris Bringing emacs' greatest feature to neovim - Tetris! This plugin is written in Fennel using Olical's project Aniseed for creating the proj

null 129 Dec 26, 2022
🌈 Generate color palettes based on Neovim colorschemes.

Iris Iris is a Neovim plugin that generates a normalized color palette based on your colorscheme. It is named for the goddess Iris of Greek mythology,

N. G. Scheurich 45 Jul 28, 2022
🦎 A NeoVim plugin for highlighting visual selections like in a normal document editor!

?? HighStr.nvim A NeoVim plugin for highlighting visual selections like in a normal document editor! Demo TL;DR HighStr.nvim is a NeoVim plugin writte

Pocco81 222 Jan 3, 2023
Seamlessly run Python code in IPython from Vim

Seamlessly run Python code from Vim in IPython, including executing individual code cells similar to Jupyter notebooks and MATLAB. This plugin also supports other languages and REPLs such as Julia.

Hans Chen 269 Dec 20, 2022
A minimalist Vim plugin manager.

A minimalist Vim plugin manager. Pros. Easy to set up: Single file. No boilerplate code required. Easy to use: Concise, intuitive syntax Super-fast pa

Junegunn Choi 30.2k Jan 8, 2023
CLI Web-CAT interface for people who use VIM.

CLI Web-CAT CLI Web-CAT interface. Installation git clone https://github.com/phuang1024/cliwebcat cd cliwebcat python setup.py bdist_wheel sdist cd di

Patrick 4 Apr 11, 2022
Alacritty terminal used with Bash, Tmux, Vim, Mutt, Lynx, etc. and the many different additions added to each configuration file

Alacritty terminal used with Bash, Tmux, Vim, Mutt, Lynx, etc. and the many different additions added to each configuration file

Carter 19 Aug 24, 2022
Personal and work vim 8 configuration with submodules

vimfiles Windows Vim 8 configuration files based on the recommendations of Ruslan Osipov, Keep Your vimrc file clean and The musings of bluz71. :help

null 1 Aug 27, 2022
Vsm - A manager for the under-utilized mksession command in vim

Vim Session Manager A manager for the under-utilized `mksession` command in vim

Matt Williams 3 Oct 12, 2022
vimBrain is a brainfuck-based vim-inspired esoteric programming language.

vimBrain vimBrain is a brainfuck-based vim-inspired esoteric programming language. vimBrainPy Currently, the only interpreter available is written in

SalahDin Ahmed 3 May 8, 2022
telescope.nvim is a highly extendable fuzzy finder over lists.

telescope.nvim is a highly extendable fuzzy finder over lists. Built on the latest awesome features from neovim core. Telescope is centered around modularity, allowing for easy customization.

nvim-telescope 8.4k Jan 5, 2023
Easily turn single threaded command line applications into a fast, multi-threaded application with CIDR and glob support.

Easily turn single threaded command line applications into a fast, multi-threaded application with CIDR and glob support.

Michael Skelton 1k Jan 7, 2023
Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

i love my dog 2.8k Jan 5, 2023
Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git C

Yash Thakre 16 May 29, 2022
🌈 Lightweight Python package that makes it easy and fast to print terminal messages in colors. 🌈

?? Colorist for Python ?? Lightweight Python package that makes it easy and fast to print terminal messages in colors. Prerequisites Python 3.9 or hig

Jakob Bagterp 1 Feb 5, 2022
Fuzzy-logger - Fuzzy project is here Log all your pc's actions Simple and free to use Security of datas !

Fuzzy-logger - ➡️⭐ Fuzzy ⭐ project is here ! ➡️ Log all your pc's actions ! ➡️ Simple and free to use ➡️ Security of datas !

natrix_dev 2 Oct 2, 2022
Inverted-pendulum-with-fuzzy-control - Inverted pendulum with fuzzy control

Fuzzy Inverted Pendulum Basically, this project consists of an inverted pendulum

Mahan Ahmadvand 1 Aug 25, 2022
A Simple Unit Test Matcher Library for Python 3

pychoir - Python Test Matchers for humans Super duper low cognitive overhead matching for Python developers reading or writing tests. Implemented in p

Antti Kajander 15 Sep 14, 2022