1
0
Fork 0

add option to disable selection use, and document it

This commit is contained in:
Andrey Orst 2020-04-07 17:48:23 +03:00
parent 355f05d832
commit cfbcfbb796
2 changed files with 12 additions and 3 deletions

View file

@ -115,6 +115,12 @@ fzf` before configuring options. Same goes for `fzf_vcs` module.
From now on I assume that you're using one of the methods listed above for all From now on I assume that you're using one of the methods listed above for all
configurations below. configurations below.
### Default query
**fzf.kak** by default will use main selection as default query for fzf, if the
selection more than 1 character long (because cursor is simply 1-char
selection). You can disable this behavior by setting `fzf_use_main_selection` to
`false`.
### Windowing ### Windowing
If you're using Tmux, you do not have to worry about windowing, since fzf.kak If you're using Tmux, you do not have to worry about windowing, since fzf.kak
automatically creates all needed Tmux splits and panes for you. However in case automatically creates all needed Tmux splits and panes for you. However in case

View file

@ -89,6 +89,9 @@ declare-option -docstring 'command to use to create new window when not using tm
Default value: terminal kak -c %val{session} -e "%arg{@}"' \ Default value: terminal kak -c %val{session} -e "%arg{@}"' \
str fzf_terminal_command 'terminal kak -c %val{session} -e "%arg{@}"' str fzf_terminal_command 'terminal kak -c %val{session} -e "%arg{@}"'
declare-option -docstring "use main selection as default query for fzf if the selection is longer than 1 char." \
bool fzf_use_main_selection true
try %{ declare-user-mode fzf } try %{ declare-user-mode fzf }
define-command -hidden -docstring "wrapper command to create new vertical split" \ define-command -hidden -docstring "wrapper command to create new vertical split" \
@ -137,9 +140,9 @@ Switches:
fzf -params .. %{ evaluate-commands %sh{ fzf -params .. %{ evaluate-commands %sh{
fzf_impl="${kak_opt_fzf_implementation}" fzf_impl="${kak_opt_fzf_implementation}"
if [ $(printf "%s" "${kak_selection}" | wc -m) -gt 1 ]; then [ "${kak_opt_fzf_use_main_selection}" = "true" ] && \
[ $(printf "%s" "${kak_selection}" | wc -m) -gt 1 ] && \
default_query="-i -q ${kak_selection}" default_query="-i -q ${kak_selection}"
fi
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case $1 in case $1 in