diff --git a/config/.bashrc b/config/.bashrc index 2543886..539b9a7 100644 --- a/config/.bashrc +++ b/config/.bashrc @@ -130,7 +130,9 @@ alias zf='z $(flirt)' # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # 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 . ~/.bash_aliases @@ -169,9 +171,17 @@ tinty_source_shell_theme() { # alias theme='tinty_source_shell_theme apply "$(tinty list | fzf --cycle)" && xrdb ~/.Xresources' # fi + 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 + alias enter-dev='. enter-dev.sh' alias ssh='TERM="xterm-256color" ssh' diff --git a/config/.config/kak/kakrc b/config/.config/kak/kakrc index 678b24d..b3aa0b2 100644 --- a/config/.config/kak/kakrc +++ b/config/.config/kak/kakrc @@ -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" # # Color Themes plug "tinted-theming/base16-kakoune" theme @@ -43,6 +46,14 @@ eval %sh{ kak-tree-sitter -dksvvv --init $kak_session } # echo "colorscheme base16-$BASE16_THEME" # } +## Popup ## +evaluate-commands %sh{kak-popup init} + +hook global WinCreate [^*].* %{ + hook -once window WinDisplay .* %{ + smooth-scroll-enable + } +} ## Highlighting ## hook global WinCreate .* %{ add-highlighter window/number-lines number-lines -relative -hlcursor} add-highlighter global/ show-matching @@ -214,24 +225,33 @@ face global InfoDiagnosticWarning Information set-option global lsp_config %{ } -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 fzf-buffer -docstring 'Invoke fzf to select a buffer' %{ + evaluate-comands %sh{ + 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" + # echo "eval -client $kak_client %{ e *debug* }" | /usr/bin/kak -p "$kak_session" + # open_in_kak "*debug*" } } +# 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 %{ evaluate-commands %sh{ diff --git a/config/.config/kak/plugins/.build/kakoune-smooth-scroll/config b/config/.config/kak/plugins/.build/kakoune-smooth-scroll/config deleted file mode 100644 index fe8be3c..0000000 --- a/config/.config/kak/plugins/.build/kakoune-smooth-scroll/config +++ /dev/null @@ -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} - } - } -}