1
0
Fork 0
This commit is contained in:
Andrey Orst 2019-03-28 09:05:17 +03:00
parent 7fee8cf5a8
commit 45399fa417

View file

@ -4,9 +4,9 @@
![Github commits (since latest release)][5] ![license][6] ![Github commits (since latest release)][5] ![license][6]
**fzf.kak** is a plugin for [Kakoune][7] editor, that brings integration with **fzf.kak** is a plugin for [Kakoune][7] editor, that brings integration with
[fzf][8] tool. This plugin is being tested against Kakoune [fzf][8] tool. This plugin is being tested against Kakoune 2018.09.04.
2018.09.04. **fzf.kak** also supports [skim][9], which can be used via **fzf.kak** also supports [skim][9], which can be used via `fzf_implementation`
`fzf_implementation` option. option.
![showcase][10] ![showcase][10]
@ -79,24 +79,24 @@ mapping to invoke `fzf-mode`:
```kak ```kak
map global normal <c-p> ': fzf-mode<ret>' 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
``` ```
Each `fzf` sub-command has mnemonic mapping, like `f` for opening files, `t` for Each `fzf` sub-command has mnemonic mapping, like `f` for opening files, `t` for
tags and so on. Available mappings: tags and so on. Available mappings:
- <kbd>b</kbd> - Select buffer
- <kbd>c</kbd> - Switch server's working directory
- <kbd>f</kbd> - Search for file and open it
- <kbd>v</kbd> - Edit file in version control system tree
- <kbd>Alt+v</kbd> - Explicitly select which VCS command to run
- <kbd>s</kbd> - Search over buffer contents and jump to result line
- <kbd>t</kbd> - Browse ctags tags
- <kbd>Alt+t</kbd> - Select tag kind filter on per language basis
So for example pressing <kbd>Ctrl+p</kbd><kbd>f</kbd> will open `fzf` at the - <kbd>b</kbd> - Select buffer.
bottom of the Kakoune buffer, showing you all possible files. - <kbd>c</kbd> - Switch server's working directory.
- <kbd>f</kbd> - Search for file and open it.
- <kbd>v</kbd> - Edit file in version control system tree.
- <kbd>Alt</kbd>+<kbd>v</kbd> - Explicitly select which VCS command to run.
- <kbd>s</kbd> - Search over buffer contents and jump to result line.
- <kbd>t</kbd> - Browse ctags tags.
- <kbd>Alt</kbd>+<kbd>t</kbd> - Select tag kind filter on per language basis.
### Settings So for example pressing <kbd>Ctrl</kbd>+<kbd>p</kbd> <kbd>f</kbd> will open
`fzf` at the bottom of the Kakoune buffer, showing you all possible files.
### Configuration
**fzf.kak** features a lot of settings via options that can be altered to change **fzf.kak** features a lot of settings via options that can be altered to change
how **fzf.kak** behaves. how **fzf.kak** behaves.
@ -106,18 +106,19 @@ changed with `fzf_tmux_height` option. `fzf_tmux_height_file_preview` option is
used to control height of the split when you do file searching with file-preview used to control height of the split when you do file searching with file-preview
turned on. turned on.
#### File with file-preview turned on. #### File with preview window
You can configure what command to use to search for files, and it's arguments. You can configure what command to use to search for files, and it's arguments.
Supported tools are [GNU Find][12], [The Silver Searcher][13], [ripgrep][14], Supported tools are [GNU Find][12], [The Silver Searcher][13], [ripgrep][14],
[fd][15]. GNU find is used by default, but you can switch to another one. There [fd][15]. GNU find is used by default, but you can switch to another one. There
are some default values for those, so you can go: are some default values for those, so you can go:
```kak ```kak
set-option global fzf_file_command 'rg' # 'ag', 'fd' or 'find' 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 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: like to disable searching in, say `.svn` or `.git` directories you can set it
like so:
```kak ```kak
set-option global fzf_file_command "find . \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type f -print" set-option global fzf_file_command "find . \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type f -print"
@ -127,10 +128,10 @@ The same pattern applies for other commands, except `buffer`, and `cd`.
#### VCS #### VCS
This script supports these version control systems: Git, Subversion, GNU Bazaar, This script supports these version control systems: Git, Subversion, GNU Bazaar,
Mercurial. By default <kbd>v</kbd> mapping from `fzf mode` will detect your and Mercurial. By default <kbd>v</kbd> mapping from `fzf` mode will detect your
version control system and open `fzf` for you. If you wish to explicitly use version control system and open `fzf` window for you. If you wish to explicitly
some particular VCS command, you can use `V` mapping, which includes all use some particular VCS command, you can use <kbd>Alt</kbd>+<kbd>v</kbd>
supported VCS shortcuts. mapping, which includes all supported VCS shortcuts.
You also able to set parameters to VCS command to use to provide project You also able to set parameters to VCS command to use to provide project
files. Supported options: files. Supported options:
@ -185,12 +186,8 @@ You also can specify which highlighter to use within the preview window with
* [Highlight][18] * [Highlight][18]
* [Rouge][19] * [Rouge][19]
You can disable the preview window in `fzf` window by setting `fzf_preview` option You can disable the preview window in `fzf` window by setting `fzf_preview`
to `false`: option to `false`.
```kak
set-option global fzf_preview false
```
### `fzf` command ### `fzf` command
`fzf` command can be used from prompt mode and for [scripting][20]. It supports `fzf` command can be used from prompt mode and for [scripting][20]. It supports
@ -206,7 +203,8 @@ these arguments:
needs to provide a different arguments to `fzf`. See [sk-grep.kak][21] as needs to provide a different arguments to `fzf`. See [sk-grep.kak][21] as
example. example.
- `-fzf-args`: Additional flags for `fzf` program. - `-fzf-args`: Additional flags for `fzf` program.
- `-preview-cmd`: A preview command. Can be used to override default preview handling. - `-preview-cmd`: A preview command. Can be used to override default preview
handling.
- `-preview`: If specified, command will ask for preview. - `-preview`: If specified, command will ask for preview.
- `-filter`: A pipe which will be applied to result provided by `fzf`. For - `-filter`: A pipe which will be applied to result provided by `fzf`. For
example, if we are returning such line `3 hello, world!` from `fzf`, and we example, if we are returning such line `3 hello, world!` from `fzf`, and we
@ -217,13 +215,11 @@ these arguments:
## Contributing ## Contributing
If you want to contribute to **fzf.kak** by adding a module, you can submit one If you want to contribute to **fzf.kak** by adding a module, you can submit one
by providing a pull request, or just open a feature request and we'll see what by providing a pull request, or just open a feature request and we'll see what
can be done. can be done.
### Writing a module ### Writing a module
You can write a module for **fzf.kak**. To create one, simply define a function You can write a module for **fzf.kak**. To create one, simply define a function
in separate file, located in `rc/modules/`, and named after the in separate file, located in `rc/modules/`, and named after the
function. **fzf.kak** provides a general purpose command, that can be called function. **fzf.kak** provides a general purpose command, that can be called
@ -262,3 +258,4 @@ various settings inside it. Feel free to look how existing modules are made.
[20]: #writing-a-module [20]: #writing-a-module
[21]: rc/modules/sk-grep.kak [21]: rc/modules/sk-grep.kak
[22]: rc/modules/fzf-search.kak [22]: rc/modules/fzf-search.kak
[23]: