add separate height for file preview, and use uniq for tags
This commit is contained in:
parent
b20c316421
commit
6199dc1627
1 changed files with 23 additions and 18 deletions
21
rc/fzf.kak
21
rc/fzf.kak
|
@ -106,6 +106,10 @@ declare-option -docstring "height of fzf tmux split in screen lines or percents
|
||||||
Default value: 25%%" \
|
Default value: 25%%" \
|
||||||
str fzf_tmux_height '25%'
|
str fzf_tmux_height '25%'
|
||||||
|
|
||||||
|
declare-option -docstring "height of fzf tmux split for file preview in screen lines or percents
|
||||||
|
Default value: 70%%" \
|
||||||
|
str fzf_tmux_height_file_preview '70%'
|
||||||
|
|
||||||
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)
|
||||||
|
@ -176,7 +180,7 @@ define-command -hidden fzf-file %{ evaluate-commands %sh{
|
||||||
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
||||||
}}
|
}}
|
||||||
|
|
||||||
define-command -docstring "Wrapper command for fzf vcs to automatically decect
|
define-command -hidden -docstring "Wrapper command for fzf vcs to automatically decect
|
||||||
used version control system.
|
used version control system.
|
||||||
|
|
||||||
Supported vcs:
|
Supported vcs:
|
||||||
|
@ -185,7 +189,7 @@ Supported vcs:
|
||||||
Mercurial SCM: ""hg""
|
Mercurial SCM: ""hg""
|
||||||
GNU Bazaar: ""bzr""
|
GNU Bazaar: ""bzr""
|
||||||
" \
|
" \
|
||||||
-hidden fzf-vcs %{ evaluate-commands %sh{
|
fzf-vcs %{ evaluate-commands %sh{
|
||||||
commands="git rev-parse --is-inside-work-tree
|
commands="git rev-parse --is-inside-work-tree
|
||||||
svn info
|
svn info
|
||||||
hg --cwd . root
|
hg --cwd . root
|
||||||
|
@ -267,8 +271,7 @@ define-command -hidden fzf-cd %{ evaluate-commands %sh{
|
||||||
cmd=$kak_opt_fzf_cd_command ;;
|
cmd=$kak_opt_fzf_cd_command ;;
|
||||||
esac
|
esac
|
||||||
eval echo 'fzf \"change-directory \$1\" \"$cmd\"'
|
eval echo 'fzf \"change-directory \$1\" \"$cmd\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{
|
define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{
|
||||||
title="fzf buffer search"
|
title="fzf buffer search"
|
||||||
|
@ -286,6 +289,7 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
|
||||||
callback=$1
|
callback=$1
|
||||||
items_command=$2
|
items_command=$2
|
||||||
additional_flags=$3
|
additional_flags=$3
|
||||||
|
tmux_height=$kak_opt_fzf_tmux_height
|
||||||
|
|
||||||
items_executable=$(echo $items_command | awk '{print $1}' | tr '(' ' ' | cut -d " " -f 2)
|
items_executable=$(echo $items_command | awk '{print $1}' | tr '(' ' ' | cut -d " " -f 2)
|
||||||
if [ -z $(command -v $items_executable) ]; then
|
if [ -z $(command -v $items_executable) ]; then
|
||||||
|
@ -313,6 +317,7 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
|
||||||
esac
|
esac
|
||||||
if [ ! -z "${kak_client_env_TMUX}" ]; then
|
if [ ! -z "${kak_client_env_TMUX}" ]; then
|
||||||
preview_pos='pos=right:50%;'
|
preview_pos='pos=right:50%;'
|
||||||
|
tmux_height=$kak_opt_fzf_tmux_height_file_preview
|
||||||
else
|
else
|
||||||
preview_pos='sleep 0.1; if [ \$(tput cols) -gt \$(expr \$(tput lines) \* 2) ]; then pos=right:50%; else pos=top:60%; fi;'
|
preview_pos='sleep 0.1; if [ \$(tput cols) -gt \$(expr \$(tput lines) \* 2) ]; then pos=right:50%; else pos=top:60%; fi;'
|
||||||
fi
|
fi
|
||||||
|
@ -321,7 +326,7 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
|
||||||
|
|
||||||
if [ ! -z "${kak_client_env_TMUX}" ]; then
|
if [ ! -z "${kak_client_env_TMUX}" ]; then
|
||||||
[ -z "${items_command##*Q*}" ] && items_command=$(echo $items_command | sed 's:$kind \(\w\):\$kind \"\1\":')
|
[ -z "${items_command##*Q*}" ] && items_command=$(echo $items_command | sed 's:$kind \(\w\):\$kind \"\1\":')
|
||||||
cmd="$preview_pos $items_command | fzf-tmux -d $kak_opt_fzf_tmux_height --expect ctrl-q $additional_flags > $tmp"
|
cmd="$preview_pos $items_command | fzf-tmux -d $tmux_height --expect ctrl-q $additional_flags > $tmp"
|
||||||
elif [ ! -z "${kak_opt_termcmd}" ]; then
|
elif [ ! -z "${kak_opt_termcmd}" ]; then
|
||||||
path=$(pwd)
|
path=$(pwd)
|
||||||
additional_flags=$(echo $additional_flags | sed 's:\$pos:\\\\\\\$pos:')
|
additional_flags=$(echo $additional_flags | sed 's:\$pos:\\\\\\\$pos:')
|
||||||
|
@ -379,7 +384,7 @@ define-command -hidden fzf-buffer %{ evaluate-commands %sh{
|
||||||
[ ! -z $buffer ] && [ $buffer != ' ' ] && echo $buffer >> $buffers
|
[ ! -z $buffer ] && [ $buffer != ' ' ] && echo $buffer >> $buffers
|
||||||
done
|
done
|
||||||
if [ ! -z "${kak_client_env_TMUX}" ]; then
|
if [ ! -z "${kak_client_env_TMUX}" ]; then
|
||||||
cmd="cat $buffers | fzf-tmux -d 15 --expect ctrl-d > $tmp"
|
cmd="cat $buffers | fzf-tmux -d $kak_opt_fzf_tmux_height --expect ctrl-d > $tmp"
|
||||||
elif [ ! -z "${kak_opt_termcmd}" ]; then
|
elif [ ! -z "${kak_opt_termcmd}" ]; then
|
||||||
cmd="$kak_opt_termcmd \"sh -c 'cat $buffers | fzf --expect ctrl-d > $tmp'\""
|
cmd="$kak_opt_termcmd \"sh -c 'cat $buffers | fzf --expect ctrl-d > $tmp'\""
|
||||||
else
|
else
|
||||||
|
@ -1595,9 +1600,9 @@ define-command -hidden fzf-tag -params ..1 %{ evaluate-commands %sh{
|
||||||
|
|
||||||
if [ ! -z "$1" ]; then
|
if [ ! -z "$1" ]; then
|
||||||
mode=$(echo "$additional_message" | grep "<a-$1>:" | awk '{$1=""; print}' | sed "s/\(.*\)/:\1/")
|
mode=$(echo "$additional_message" | grep "<a-$1>:" | awk '{$1=""; print}' | sed "s/\(.*\)/:\1/")
|
||||||
cmd="readtags -Q '(eq? \$kind $1)' -l | cut -f1"
|
cmd="readtags -Q '(eq? \$kind $1)' -l | cut -f1 | uniq"
|
||||||
else
|
else
|
||||||
cmd="readtags -l | cut -f1"
|
cmd="readtags -l | cut -f1 | uniq"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && tmux_keybindings="
|
[ ! -z "${kak_client_env_TMUX}" ] && tmux_keybindings="
|
||||||
|
|
Loading…
Reference in a new issue