Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ratfactor/zf.vim

A Vim plugin for the zf fuzzy finder.
https://github.com/ratfactor/zf.vim

Last synced: 3 months ago
JSON representation

A Vim plugin for the zf fuzzy finder.

Awesome Lists containing this project

README

        

= zf.vim

**MOVED!** Hello, I am moving my repos to http://ratfactor.com/repos/
and setting them to read-only ("archived") on GitHub. Thank you, _-Dave_

A Vim plugin for the `zf` fuzzy finder: https://github.com/natecraddock/zf

Note: This currently doesn't work with NeoVim. I'd be delighted if an nvim
user could help discover why (or add nvim term support)!

== Features / Usage

There is currently one high-level function, `ZfSelectFile()`, which uses the
external `find` command to let you fuzzy find from a list of all files in the
current working directory (and any subdirectories).

Example mapping to put in your `.vimrc`:

----
nnoremap ff :call ZfSelectFile()
----

(Coming Soon: Another high-level function for selecting from current Vim buffers.)

There are two lower-level functions to invoke `zf` with your choice of:

* Piped output from an external command
* A Vim list of strings

Pipe example:

----
:call ZfWithPipe('cat bowie-albums.txt')
> ma
The Man Who Sold the World
The Rise and Fall of Ziggy Stardust and the Spiders from Mars
Young Americans
Scary Monsters (and Super Creeps)
----

String list example:

----
:call ZfWithLines(['foo', 'bar', 'baz'])
>
foo
bar
baz
----

After calling either of these methods, your selection will be in `g:zf_selection[0]`.

If nothing was selected, the list will be empty.

Note that this is a list so we're future-proof for any possible multiple-selection
support at some point.

== Install

This repo is in the standard Vim plugin structure. Any plugin installation method
(incuding popular plugin managers) should work. If you have additional
installation instructions to add here, PRs are always welcome!

Vundle example (because that's what the author uses).

----
Plugin 'ratfactor/zf.vim'
----

(Then run `:source %` and `:BundleInstall` to complete the Vundle installation.)

== Configuration

Here's the current configuration settings and their defaults. Override any of
these in your `.vimrc` as desired.

----
let g:zf_exec = 'zf'
let g:zf_lines = 20
let g:zf_list_files = 'find . -type f'
----

TODO: Help doesn't exist yet! But when it does, see `:help zf.vim` for complete
documentation and specifically `:help zf.vim-configuration` for all settings.

== Contributing

Yes, please! This has only been tested with Vim running in a terminal under Linux.

Please note that I'd like to keep support for older versions of Vim. This has been
tested with Vim 7.4.

== Thanks!

Thanks to https://nathancraddock.com/[Nathan Craddock] for making zf.

Thanks to https://github.com/junegunn[Junegunn Choi] for the Vim plugin(s) for
FZF, which were _very_ direct inspiration for this plugin, especially terminal
redirection and the use of temporary files (and listing buffers, when I add
that).