1
0
Fork 0
Go to file
2018-10-12 18:15:29 +03:00
.github Create PULL_REQUEST_TEMPLATE.md 2018-09-22 20:53:19 +03:00
rc command -v is more portable than which 2018-10-12 17:39:00 +03:00
CODE_OF_CONDUCT.md Add some sort of contribution rules... 2018-09-22 22:59:14 +03:00
CONTRIBUTING.md Update CONTRIBUTING.md 2018-09-24 14:43:35 +03:00
LICENSE Initial commit 2018-09-22 13:59:28 +03:00
README.md mention how to add sorting to tags 2018-10-11 23:11:19 +03:00

fzf.kak

GitHub release GitHub Release Date Github commits (since latest release) license

fzf.kak is a plugin for Kakoune editor, that brings integration with fzf tool. This plugin is being tested against Kakoune 2018.09.04.

showcase

Dependencies

Tool Information
tmux This plugin depends on fzf-tmux script.
X11 Script works with X11 via termcmd option.
GNU Screen GNU Screen is not yet supported.

Installation

Recommended way to install is to use plug.kak plugin manager. You can install fzf.kak by adding this to your kakrc:

plug andreyorst/fzf.kak

Then reload Kakoune config or restart Kakoune and run :plug-install.

Or install this plugin any other preferred way.

Usage

fzf.kak doesn't provide any mapping by default. Instead there's now a fzf-mode command which intentionally was made to simplify user mappings. Each fzf command has mnemonic mapping, like f for opening files, t for tags and so on.

In this mode new mappings are available:

  • b - Select buffer
  • c - Switch servers working directory
  • f - Search for file and open it
  • v - Edit file in version control system tree
  • V - Explicitly select which vcs command to run
  • s - Search over buffer contents and jump to result line
  • t - Browse ctags tags

You can set your own mapping to invoke fzf-mode:

map global normal <c-p> ': fzf-mode<ret>'
# note that the space after colon is intentional to suppess fzf-mode to show in command history

So for example pressing Ctrl+pf will open fzf at the bottom of the Kakoune buffer, showing you all possible files.

Settings

Files

You can configure what command to use to search for files, and it's arguments. Supported tools are GNU Find, The Silver Searcher, ripgrep, fd. GNU find is used by default, but you can switch to another one. There are some default values for those, so you can go:

set-option global fzf_file_command 'rg' # 'ag', 'fd' or 'find' 

Or if you don't like default file arguments, which are find -type f, and would like to disable searching in, say .git directories you can set it like so:

set-option global fzf_file_command "find . \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type f -print"

The same pattern applies for other commands, except buffer, and cd.

VCS

This script supports these version control systems: Git, Subversion, GNU Bazaar, Mercurial. By default v mapping from fzf mode will detect your version control system and open fzf for you. If you wish to explicitly use some particular vcs command, you can use V mapping, which includes all supported vcs shortcuts.

You also able to set parameters to vcs command to use to provide project files. Supported options:

  • fzf_git_command
  • fzf_svn_command
  • fzf_bzr_command
  • fzf_hg_command

Other VCS are not supported officially. Open a feature request if you want some unsupported VCS to be included. You also can change one of options to contain your vcs command, and use this command explicitly from vcs submode.

ctags

It is also possible to add parameters to ctags search executable. like sort -u and others:

set-option global fzf_tag_command 'readtags -l | cut -f1 | sort -u | ... ' 

Preview

You can turn on the preview window in fzf window by setting fzf_preview option to true:

set-option global fzf_preview true

You also can specify which highlighter to use within the preview window with fzf_highlighter option. Supported tools are:

  • Rouge
  • Highlight
  • Coderay

Some demonstration gifs:

Opening files:

files

Searching tags with universal-ctags

ctags

Browsing Git tree files

git

Switching buffers

buffers

Changing directories

dirs