Skip to content

fzf_similar.vim is a simple plugin for finding files similar to the one you are currently editing.

Notifications You must be signed in to change notification settings

dylan-chong/fzf_similar.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

fzf_similar.vim

fzf_similar.vim is a simple plug in for finding files similar to the one you are currently editing. This plugin uses a custom FZF query to find the similar files, and present the list of results.

Installation

Install this plugin using the plugin manager of your choice, for example with vim-plug:

Plug 'dylan-chong/fzf_similar.vim'

Note: This plugin depends on fzf.vim, so follow the installation instructions for that plugin.

Configuration

Add this (with the mapping of your choice) to your .vimrc:

nnoremap <silent> <Leader><C-f>1 :call fzf_similar#find_similar_files()<CR>
nnoremap <silent> <Leader><C-f>2 :call fzf_similar#find_similarly_named_files()<CR>

Function Documentation

fzf_similar#find_similar_files()

Open and FZF window suggesting files that have a similar base name as the current file and has a similarly named ancestor directories. This is the function that is meant to be used most of the time. See the examples below:

Examples

In an Angular app, if you are editing src/components/banner.component.ts, this plugin will suggest, src/components/banner.component.spec.ts, src/components/banner.html and src/components/banner.scss.

In a Rails app, you are currently editing file app/models/report.rb, this plugin will suggest the file spec/models/report.rb, while ignoring app/controllers/report.rb and spec/controllers/report.rb.

fzf_similar#find_similarly_named_files()

Same as find_similar_files but ignores filtering by similarly named ancestor directories.

FAQ

Why not use

vim-projectionist?

That plugin requires manual configuration to get it to work. This plugin works for (most) projects out-of-the-box.


TODO

  • add vim documentation
  • tidy up the query that the user has to see?
  • add multiple levels of specificity
    1. existing functionality
    2. searching of files for similar name, ie ignoring directory structure
    3. searching of files for similar name, ie ignoring directory structure, ignoring _controller and other suffixes
    4. searching for files in the current directory or similarly named directory?
    5. refactor api to take a map of options
  • right documentation

About

fzf_similar.vim is a simple plugin for finding files similar to the one you are currently editing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published