new kakoune buffer select

This commit is contained in:
Michael Chalupiak 2025-03-23 14:30:41 -04:00
parent 957701fce9
commit 30883aaa78
3 changed files with 47 additions and 36 deletions

View File

@ -130,7 +130,9 @@ alias zf='z $(flirt)'
# You may want to put all your additions into a separate file like # You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly. # ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
export EDITOR='kak' if [ -z "$EDITOR" ]; then
export EDITOR='kak'
fi
if [ -f ~/.bash_aliases ]; then if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases . ~/.bash_aliases
@ -169,9 +171,17 @@ tinty_source_shell_theme() {
# alias theme='tinty_source_shell_theme apply "$(tinty list | fzf --cycle)" && xrdb ~/.Xresources' # alias theme='tinty_source_shell_theme apply "$(tinty list | fzf --cycle)" && xrdb ~/.Xresources'
# fi # fi
if [ -n "$(command -v tmux)" ] && [ -n "$(command -v kak)" ] && [ -z "$TMUX" ]; then if [ -n "$(command -v tmux)" ] && [ -n "$(command -v kak)" ] && [ -z "$TMUX" ]; then
alias kak='tmux new-session kak > /dev/null' SESH="$((tmux list-sessions 2>/dev/null || echo '-1') | cut -d' ' -f1 | tr -d : | sort -r | head -n1 | xargs -I{} echo '{} + 1' | bc)"
alias kak='tmux new-session -e "EDITOR=\"kak -c $SESH\"" -s $SESH kak -s $SESH > /dev/null'
elif [ -n "$(command -v tmux)" ] && [ -n "$(command -v kak)" ]; then
SESH="$(tmux display-message -p '#S')"
alias kak='kak -c $SESH 2>/dev/null || kak -s $SESH'
alias vidir='EDITOR="kak -c $SESH 2/dev/null || kak -s $SESH" vidir'
alias vipe='EDITOR="kak -c $SESH 2>/dev/null|| kak -s $SESH" vipe'
fi fi
alias enter-dev='. enter-dev.sh' alias enter-dev='. enter-dev.sh'
alias ssh='TERM="xterm-256color" ssh' alias ssh='TERM="xterm-256color" ssh'

View File

@ -25,6 +25,9 @@ plug "gustavo-hms/luar" %{
} }
} }
plug "https://git.sr.ht/~nasmevka/repl.kak"
plug "caksoylar/kakoune-smooth-scroll"
plug "custom-filetypes" load-path "~/.config/kak/al" plug "custom-filetypes" load-path "~/.config/kak/al"
# # Color Themes # # Color Themes
plug "tinted-theming/base16-kakoune" theme plug "tinted-theming/base16-kakoune" theme
@ -43,6 +46,14 @@ eval %sh{ kak-tree-sitter -dksvvv --init $kak_session }
# echo "colorscheme base16-$BASE16_THEME" # echo "colorscheme base16-$BASE16_THEME"
# } # }
## Popup ##
evaluate-commands %sh{kak-popup init}
hook global WinCreate [^*].* %{
hook -once window WinDisplay .* %{
smooth-scroll-enable
}
}
## Highlighting ## ## Highlighting ##
hook global WinCreate .* %{ add-highlighter window/number-lines number-lines -relative -hlcursor} hook global WinCreate .* %{ add-highlighter window/number-lines number-lines -relative -hlcursor}
add-highlighter global/ show-matching add-highlighter global/ show-matching
@ -214,24 +225,33 @@ face global InfoDiagnosticWarning Information
set-option global lsp_config %{ set-option global lsp_config %{
} }
define-command -docstring 'Invoke fzf to select a buffer' fzf-buffer %{ define-command fzf-buffer -docstring 'Invoke fzf to select a buffer' %{
evaluate-commands %sh{ evaluate-comands %sh{
BUFFER=$( tmux split-window -l 30% "(echo $kak_buflist | tr ' ' '\n' | fzf --bind 'focus:execute-silent(echo \"eval -client $kak_client %{ e {} }\" | kak -p $kak_session)' || echo \"$kak_buffile\") | xargs -I{} echo \"eval -client $kak_client %{ e {} }\" | /usr/bin/kak -p $kak_session"
( # tmux split-window -l 30% "echo $kak_buflist | tr ' ' '\n' | fzf --bind 'focus:execute-silent(echo \"eval -client $kak_client %{ e {} } \" | /usr/bin/kak -p $kak_session)' | xargs -I{} echo \"eval -client $kak_client %{ e {} }\" | /usr/bin/kak -p $kak_session"
eval "set -- $kak_buflist" # echo "eval -client $kak_client %{ e *debug* }" | /usr/bin/kak -p "$kak_session"
while [ $# -gt 0 ]; do # open_in_kak "*debug*"
printf "%s\0" "$1"
shift
done
) |
fzf-tmux --cycle -p 80%,90% --read0 --preview='bat --theme=base16-256 --color=always {} 2>/dev/null'
)
if [ -n "$BUFFER" ]; then
printf "buffer %s" "${BUFFER}"
fi
} }
} }
# define-command -docstring 'Invoke fzf to select a buffer' fzf-buffer %{
# evaluate-commands %sh{
# BUFFER=$(
# (
# eval "set -- $kak_buflist"
# while [ $# -gt 0 ]; do
# printf "%s\0" "$1"
# shift
# done
# ) |
# fzf-tmux --cycle -p 80%,90% --read0 --preview='bat --theme=base16-256 --color=always {} 2>/dev/null'
# )
# if [ -n "$BUFFER" ]; then
# printf "buffer %s" "${BUFFER}"
# fi
# }
# }
define-command -docstring 'live grep' live-grep %{ define-command -docstring 'live grep' live-grep %{
evaluate-commands %sh{ evaluate-commands %sh{

View File

@ -1,19 +0,0 @@
try %{
# configuration here
} catch %{
echo -debug "Error while evaluating 'kakoune-smooth-scroll' configuration: %val{error}"
set-option -add current plug_conf_errors "Error while evaluating 'kakoune-smooth-scroll' configuration:"
set-option -add current plug_conf_errors %sh{ printf "\n " }
set-option -add current plug_conf_errors %val{error}
set-option -add current plug_conf_errors %sh{ printf "\n\n" }
hook -once -group plug-conf-err global WinDisplay .* %{
info -style modal -title "plug.kak error" "%opt{plug_conf_errors}"
on-key %{
info -style modal
execute-keys -with-maps -with-hooks %val{key}
}
}
}