Home

Awesome

nvim-fzf-commands

A repository for commands using the nvim-fzf library.

This is a work in progress, contributions welcome!

Table of contents

Installation

Plug 'vijaymarupudi/nvim-fzf' " requires the nvim-fzf library
Plug 'vijaymarupudi/nvim-fzf-commands'

Usage

This repository exports lua functions for the user to bind to vim commands or keybindings.

Example

noremap <leader>f <cmd>lua require("fzf-commands").files()<cr>
" or
command! Files lua require("fzf-commands").files()
" or with configuration
noremap <leader>f <cmd>lua require("fzf-commands").files({ fzf = custom_fzf_function })<cr>

Commands

These are keys of require("fzf-commands"). For eg.: require('fzf-commands').files()

files(options): Open files in the current vim directory

helptags(options): Open neovim help files

bufferpicker2(options): Pick between buffers to switch to them or open in a split.

bufferpicker(options): Pick between buffers to switch to them or open in a split.

manpicker(options): Open a manpage using nvim's Man.

rg(pattern, options): Search for a pattern using rg (ripgrep).

colorschemes(options): Pick a vim colorscheme.

Configuration

All commands support a custom fzf function that manages opening windows and running fzf.

Example changing height and width of default window

This example uses window_options, documentation here

require("fzf-commands").files({ fzf = function(contents, options) 
  return require("fzf").fzf(contents, options, { height = 10, width = 30 })
end })

Other examples

function my_custom_fzf(contents, options)
  vim.cmd("vnew")
  local results = require("fzf").raw_fzf(contents, options)
  vim.cmd("bw!")
  return results
end
require("fzf-commands").files({ fzf = my_custom_fzf })

or

" vertical fzf
lua << EOF
  function my_custom_fzf(contents, options)
    vim.cmd("vnew")
    local results = require("fzf").raw_fzf(contents, options)
    vim.cmd("bw!")
    return results
  end
EOF
command! Files lua require("fzf-commands").files({ fzf = my_custom_fzf })

For other configuration, please see command specific documentation.

Contribution notes

Contributions welcome!