1
0
Fork 0

allow configuring preview for file search, and move variables to module

This commit is contained in:
Andrey Orst 2019-10-04 16:24:44 +03:00
parent 6d1fd2c645
commit 5d7267d0db
5 changed files with 18 additions and 9 deletions

View file

@ -8,6 +8,8 @@
# │ GitHub.com/andreyorst/fzf.kak │ # │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯ # ╰──────────────────────────────────────╯
hook global ModuleLoaded fzf %§
declare-option -docstring "command to provide list of directories to fzf. declare-option -docstring "command to provide list of directories to fzf.
Default value: Default value:
find: (echo .. && find . \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type d -print) find: (echo .. && find . \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type d -print)
@ -29,7 +31,6 @@ str cd_preview_command "tree -d {}"
declare-option -docstring 'maximum amount of previewed directories' \ declare-option -docstring 'maximum amount of previewed directories' \
int fzf_preview_dirs '300' int fzf_preview_dirs '300'
hook global ModuleLoaded fzf %§
map global fzf -docstring "change directory" 'c' '<esc>: fzf-cd<ret>' map global fzf -docstring "change directory" 'c' '<esc>: fzf-cd<ret>'

View file

@ -7,12 +7,13 @@
# ╞════════════════════════════════════════╡ # ╞════════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │ # │ GitHub.com/andreyorst/fzf.kak │
# ╰────────────────────────────────────────╯ # ╰────────────────────────────────────────╯
hook global ModuleLoaded fzf %§
declare-option -docstring "file that should be used by fzf-tag to provide tags. declare-option -docstring "file that should be used by fzf-tag to provide tags.
Default value: tags" \ Default value: tags" \
str fzf_tag_file_name "tags" str fzf_tag_file_name "tags"
hook global ModuleLoaded fzf %§
map global fzf -docstring "find tag" 't' '<esc>: fzf-tag<ret>' map global fzf -docstring "find tag" 't' '<esc>: fzf-tag<ret>'
# this huge try block defines filetype aware filter mappings for separate fzf-ctags mode # this huge try block defines filetype aware filter mappings for separate fzf-ctags mode

View file

@ -8,6 +8,8 @@
# │ GitHub.com/andreyorst/fzf.kak │ # │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯ # ╰──────────────────────────────────────╯
hook global ModuleLoaded fzf %§
declare-option -docstring "command to provide list of files to fzf. Arguments are supported declare-option -docstring "command to provide list of files to fzf. Arguments are supported
Supported tools: Supported tools:
<package>: <value>: <package>: <value>:
@ -24,7 +26,11 @@ Default arguments:
" \ " \
str fzf_file_command "find" str fzf_file_command "find"
hook global ModuleLoaded fzf %§ declare-option -docstring 'allow showing preview window while searching for file
Default value:
true
' \
bool fzf_file_preview true
map global fzf -docstring "open file" 'f' '<esc>: fzf-file<ret>' map global fzf -docstring "open file" 'f' '<esc>: fzf-file<ret>'
@ -54,7 +60,8 @@ $kak_opt_fzf_vertical_map: open file in vertical split"
printf "%s\n" "info -title 'fzf file' '$message$tmux_keybindings'" printf "%s\n" "info -title 'fzf file' '$message$tmux_keybindings'"
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map" [ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map"
printf "%s\n" "fzf -preview -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags}" [ "$kak_opt_fzf_file_preview" = "true" ] && preview_flag="-preview"
printf "%s\n" "fzf $preview_flag -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags}"
}} }}
§ §

View file

@ -8,11 +8,11 @@
# │ GitHub.com/andreyorst/fzf.kak │ # │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯ # ╰──────────────────────────────────────╯
hook global ModuleLoaded fzf %§
declare-option -docstring "file where saved projects are stored" str fzf_project_file "%val{config}/.fzf-projects" declare-option -docstring "file where saved projects are stored" str fzf_project_file "%val{config}/.fzf-projects"
declare-option -docstring %sh{ printf "%s\n" "use '~/' instead of '${HOME}'" } bool fzf_project_use_tilda false declare-option -docstring %sh{ printf "%s\n" "use '~/' instead of '${HOME}'" } bool fzf_project_use_tilda false
hook global ModuleLoaded fzf %§
map global fzf -docstring "open project" 'p' '<esc>: fzf-project<ret>' map global fzf -docstring "open project" 'p' '<esc>: fzf-project<ret>'
try %{ declare-user-mode fzf-project } try %{ declare-user-mode fzf-project }

View file

@ -8,6 +8,8 @@
# │ GitHub.com/andreyorst/fzf.kak │ # │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯ # ╰──────────────────────────────────────╯
hook global ModuleLoaded fzf %§
declare-option -docstring "what command to use to provide list of grep search matches. declare-option -docstring "what command to use to provide list of grep search matches.
Grep output must follow the format of 'filename:line-number:text' Grep output must follow the format of 'filename:line-number:text'
@ -17,8 +19,6 @@ str fzf_sk_grep_command 'grep -RHn'
declare-option -hidden str fzf_sk_first_file '' declare-option -hidden str fzf_sk_first_file ''
hook global ModuleLoaded fzf %§
evaluate-commands %sh{ evaluate-commands %sh{
if [ -n "$(command -v sk)" ]; then if [ -n "$(command -v sk)" ]; then
printf "%s\n" "map global fzf -docstring %{Interactive grep with skim} 'g' '<esc>: fzf-sk-grep<ret>'" printf "%s\n" "map global fzf -docstring %{Interactive grep with skim} 'g' '<esc>: fzf-sk-grep<ret>'"