.github | ||
rc | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md |
fzf.kak
fzf.kak is a plugin for Kakoune editor, that brings integration with fzf tool. This plugin is being tested against Kakoune 2018.09.04.
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
- g - Edit file in Git tree
- 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. 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' 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
.
Git
You also able to set what git command to use to provide git-tree. These are default argumens:
set-option global fzf_git_command 'git ls-tree --name-only -r HEAD'
Other VCS are not supported officially, but might work.
ctags
It is also possible to add parametees to ctags search executable:
set-option global fzf_tag_command 'readtags -l | cut -f1 | sort -u | ... '
Some demonstration gifs:
Opening files:
Searching tags with universal-ctags
Browsing Git tree files
Switching buffers
Changing directories
Special thanks
Original script, that current implementation is based on, was implemented by topisani. If you are here, thank you for your work, it is awesome!