From: Andre Ramnitz Date: Tue, 19 Dec 2023 18:15:08 +0000 (+0100) Subject: kak: overhaul kakoune's shell integration X-Git-Tag: v0.2~304 X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=9b8049deee4e07de28bea45463a4be0f1485890d;p=dotfiles.git kak: overhaul kakoune's shell integration --- diff --git a/.gitmodules b/.gitmodules index 9f126a68..07795eb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,7 @@ path = kak/.config/kak/plugins/tabs.kak url = https://github.com/enricozb/tabs.kak branch = main +[submodule "kak/.config/kak/plugins/kak-harpoon"] + path = kak/.config/kak/plugins/kak-harpoon + url = https://github.com/raiguard/kak-harpoon + branch = main diff --git a/bin/.local/bin/kcr-edit-search b/bin/.local/bin/kcr-edit-search new file mode 100755 index 00000000..c5106494 --- /dev/null +++ b/bin/.local/bin/kcr-edit-search @@ -0,0 +1,27 @@ +#!/bin/sh + +# Open files from search results. +# +# Usage: +# +# kcr edit-search [input: :::] + +# Execute the following Kakoune commands. +# +# Input: ::: +# Output: ␤␤ +select_each_line='_' +select_search_fields='s^(.+?):(\d+):(\d+):(.+?)$' +save_selections='Z' +select_file_save_and_restore='1s"fZz' +select_line_save_and_restore='2s"faz' +select_column_save_and_restore='3s"faz' +select_data='"fz' +prepare_output='y%a' +delete_end_of_file='ged' + +kak -f "${select_each_line}${select_search_fields}${save_selections}${select_file_save_and_restore}${select_line_save_and_restore}${select_column_save_and_restore}${select_data}${prepare_output}${delete_end_of_file}" | + +while read file; read line; read column; do + kcr edit "$file" "+$line:$column" +done diff --git a/bin/.local/bin/kcr-fzf b/bin/.local/bin/kcr-fzf new file mode 100755 index 00000000..5af52593 --- /dev/null +++ b/bin/.local/bin/kcr-fzf @@ -0,0 +1,3 @@ +#!/bin/sh + +"kcr-fzf-$@" diff --git a/bin/.local/bin/kcr-fzf-buffers b/bin/.local/bin/kcr-fzf-buffers new file mode 100755 index 00000000..71efdfe6 --- /dev/null +++ b/bin/.local/bin/kcr-fzf-buffers @@ -0,0 +1,19 @@ +#!/bin/sh + +# Open buffers. +# +# Usage: +# +# kcr fzf buffers [patterns] + +# – fzf (https://github.com/junegunn/fzf) +# – bat (https://github.com/sharkdp/bat) + +kcr get --raw --value buflist | +grep -F "$*" | +fzf --preview 'kcr cat --raw {} | bat --file-name {} --style=numbers --color=always --line-range :500' --header='Select a buffer to open' --prompt='(b)>' | + +# Open buffers +while read name; do + kcr send buffer "$name" +done diff --git a/bin/.local/bin/kcr-fzf-files b/bin/.local/bin/kcr-fzf-files new file mode 100755 index 00000000..3253bb81 --- /dev/null +++ b/bin/.local/bin/kcr-fzf-files @@ -0,0 +1,19 @@ +#!/bin/sh + +# Open files. +# +# Usage: +# +# kcr fzf files [paths] + +# – fzf (https://github.com/junegunn/fzf) +# – fd (https://github.com/sharkdp/fd) +# – bat (https://github.com/sharkdp/bat) + +fd --type file . "$@" | +fzf --preview 'bat --style=numbers --color=always --line-range :500 {}' --header='Select a file to open' --prompt='(f)>' | + +# Open files +while read file; do + kcr edit "$file" +done diff --git a/bin/.local/bin/kcr-fzf-grep b/bin/.local/bin/kcr-fzf-grep new file mode 100755 index 00000000..e3605c85 --- /dev/null +++ b/bin/.local/bin/kcr-fzf-grep @@ -0,0 +1,20 @@ +#!/bin/sh + +# Open files by content. +# +# Usage: +# +# kcr fzf grep [paths] + +# – fzf (https://github.com/junegunn/fzf) +# – ripgrep (https://github.com/BurntSushi/ripgrep) + +# Not pretty but robust. +# https://github.com/junegunn/fzf/issues/2581 +export PATHS_PATH=$(mktemp) +trap 'rm "$PATHS_PATH"' EXIT +for path do + echo "$path" >> "$PATHS_PATH" +done + +SHELL=sh fzf --phony --delimiter ':' --ansi --bind 'change:reload(while read path; do set -- "$@" "$path"; done < "$PATHS_PATH"; rg --color=always --column --with-filename --fixed-strings -- {q} "$@" || true),enter:execute(kcr edit {1} +{2}:{3})+abort' --preview 'highlight_line={2} line_range_begin=$((line = highlight_line - (FZF_PREVIEW_LINES / 4) && line < 1 ? 1 : line)) line_range_end=$((line_range_begin + FZF_PREVIEW_LINES)) && bat --style=numbers --color=always --line-range "$line_range_begin:$line_range_end" --highlight-line {2} {1} 2> /dev/null' --header='Select a file to open' --prompt='(g)>' diff --git a/bin/.local/bin/kcr-fzf-shell b/bin/.local/bin/kcr-fzf-shell new file mode 100755 index 00000000..33faa3a7 --- /dev/null +++ b/bin/.local/bin/kcr-fzf-shell @@ -0,0 +1,29 @@ +#!/bin/sh + +# Start an interactive shell. +# +# Usage: +# +# kcr fzf shell [command] [arguments] + +# – fzf (https://github.com/junegunn/fzf) + +set_environment() { + session=$1 client=${2#null} buffer_name=${3#null} working_directory=$4 +} + +# Run fzf with the session list +rows=$( + kcr list --raw | + fzf --header='Select a session to switch to' --prompt='(s)>' +) + +IFS=' +' +for row in $rows; do + IFS=' ' + set_environment $row + + # Start an interactive shell + KAKOUNE_SESSION=$session KAKOUNE_CLIENT=$client kcr shell "$@" +done diff --git a/bin/.local/bin/kks b/bin/.local/bin/kks deleted file mode 100755 index fa37670b..00000000 Binary files a/bin/.local/bin/kks and /dev/null differ diff --git a/fish/.config/fish/fish_variables b/fish/.config/fish/fish_variables index 8ede98f4..d5b57ecc 100644 --- a/fish/.config/fish/fish_variables +++ b/fish/.config/fish/fish_variables @@ -1,7 +1,8 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 -SETUVAR --export EDITOR:kks\x20edit -SETUVAR --export KKS_DEFAULT_SESSION:default +SETUVAR --export EDITOR:kcr\x20edit +SETUVAR --export FZF_DEFAULT_OPTS:--multi\x20--layout=reverse\x20--preview-window=down:60% +SETUVAR --export KCR_DEFAULT_SESSION:default SETUVAR --export VDPAU_DRIVER:radeonsi SETUVAR __fish_initialized:3400 SETUVAR fish_color_autosuggestion:8e908c diff --git a/fish/.config/fish/functions/:cat.fish b/fish/.config/fish/functions/:cat.fish new file mode 100644 index 00000000..c82ad689 --- /dev/null +++ b/fish/.config/fish/functions/:cat.fish @@ -0,0 +1,3 @@ +function :cat --wraps='kcr cat --raw' --description 'alias :cat=kcr cat --raw' + kcr cat --raw $argv; +end diff --git a/fish/.config/fish/functions/K.fish b/fish/.config/fish/functions/K.fish new file mode 100644 index 00000000..bf4cb136 --- /dev/null +++ b/fish/.config/fish/functions/K.fish @@ -0,0 +1,3 @@ +function K --wraps=kcr-fzf-shell --description 'alias K=kcr-fzf-shell' + kcr-fzf-shell $argv; +end diff --git a/fish/.config/fish/functions/a.fish b/fish/.config/fish/functions/a.fish new file mode 100644 index 00000000..1e2c651b --- /dev/null +++ b/fish/.config/fish/functions/a.fish @@ -0,0 +1,3 @@ +function a --wraps='kcr attach' --description 'alias a=kcr attach' + kcr attach $argv; +end diff --git a/fish/.config/fish/functions/k.fish b/fish/.config/fish/functions/k.fish index fd78e07f..ad41f0dd 100644 --- a/fish/.config/fish/functions/k.fish +++ b/fish/.config/fish/functions/k.fish @@ -1,3 +1,3 @@ -function k --wraps='kks edit' --description 'alias k=kks edit' - kks edit $argv; +function k --wraps='kks edit' --wraps='kcr attach' --wraps='kcr edit' --description 'alias k=kcr edit' + kcr edit $argv; end diff --git a/fish/.config/fish/functions/ka.fish b/fish/.config/fish/functions/ka.fish deleted file mode 100644 index acb3ce44..00000000 --- a/fish/.config/fish/functions/ka.fish +++ /dev/null @@ -1,3 +0,0 @@ -function ka --wraps='kks attach' --description 'alias ka=kks attach' - kks attach $argv; -end diff --git a/fish/.config/fish/functions/kcd.fish b/fish/.config/fish/functions/kcd.fish deleted file mode 100644 index eaf3ee68..00000000 --- a/fish/.config/fish/functions/kcd.fish +++ /dev/null @@ -1,3 +0,0 @@ -function kcd --wraps='cd $(kks get %sh{pwd})' --description 'alias kcd=cd $(kks get %sh{pwd})' - cd $(kks get %sh{pwd}) $argv; -end diff --git a/fish/.config/fish/functions/kkd.fish b/fish/.config/fish/functions/kkd.fish deleted file mode 100644 index 58e7dbce..00000000 --- a/fish/.config/fish/functions/kkd.fish +++ /dev/null @@ -1,3 +0,0 @@ -function kkd --wraps='kks kill; unset KKS_SESSION KKS_CLIENT' --description 'alias kkd=kks kill; unset KKS_SESSION KKS_CLIENT' - kks kill; unset KKS_SESSION KKS_CLIENT $argv; -end diff --git a/fish/.config/fish/functions/kl.fish b/fish/.config/fish/functions/kl.fish new file mode 100644 index 00000000..a9dda47f --- /dev/null +++ b/fish/.config/fish/functions/kl.fish @@ -0,0 +1,3 @@ +function kl --wraps='kcr list' --description 'alias kl=kcr list' + kcr list $argv; +end diff --git a/fish/.config/fish/functions/ks.fish b/fish/.config/fish/functions/ks.fish index a6205821..63d3f45d 100644 --- a/fish/.config/fish/functions/ks.fish +++ b/fish/.config/fish/functions/ks.fish @@ -1,3 +1,3 @@ -function ks --wraps='eval $(kks-select)' --description 'alias ks=eval $(kks-select)' - eval $(kks-select) $argv; +function ks --wraps='kcr shell --session' --description 'alias ks=kcr shell --session' + kcr shell --session $argv; end diff --git a/foot/.config/foot/foot.ini b/foot/.config/foot/foot.ini index ebc42643..c9199c81 100644 --- a/foot/.config/foot/foot.ini +++ b/foot/.config/foot/foot.ini @@ -80,29 +80,37 @@ label-letters=adfghjkl [colors] alpha=0.90 -# background=242424 -# foreground=ffffff +background=242124 +foreground=f5f5f5 # flash=7f7f00 # flash-alpha=0.5 ## Normal/regular colors (color palette 0-7) -# regular0=242424 # black +regular0=242424 # black # regular1=f62b5a # red # regular2=47b413 # green -# regular3=e3c401 # yellow +regular2=91bc61 # bright green +regular3=ffb852 # yellow # regular4=24acd4 # blue -# regular5=f2affd # magenta +regular4=5d81d2 +regular5=776d96 # magenta # regular6=13c299 # cyan -# regular7=e6e6e6 # white +regular6=90e0e0 +regular7=f5f5f5 # white ## Bright colors (color palette 8-15) -# bright0=616161 # bright black +bright0=3d4c59 # bright black # bright1=ff4d51 # bright red # bright2=35d450 # bright green +bright2=91bc61 # bright green # bright3=e9e836 # bright yellow +bright3=ffb852 # bright yellow # bright4=5dc5f8 # bright blue +bright4=5d81d2 # bright5=feabf2 # bright magenta +bright5=776d96 # magenta # bright6=24dfc4 # bright cyan +bright6=90e0e0 # bright7=ffffff # bright white ## dimmed colors (see foot.ini(5) man page) diff --git a/hypr/.config/hypr/hyprland.conf b/hypr/.config/hypr/hyprland.conf index 37656cb1..10e343ef 100644 --- a/hypr/.config/hypr/hyprland.conf +++ b/hypr/.config/hypr/hyprland.conf @@ -173,6 +173,7 @@ windowrulev2 = float, size 1560 1000, pin, workspace special:overlay, class:^(or windowrule = float, ^(firefox)$ windowrulev2 = opacity 1.0 override 0.8 override, group, class:^(foot)$ windowrulev2 = float, opacity 1.0 override 0.8 override, class:^(popup)$ +windowrulev2 = float, noanim, stayfocused, maxsize 1280 800, center, opacity 1.0 override, class:^(kakpopup)$ windowrule = float, ^(openrgb)$ windowrule = float, ^(org.kde.*)$ # windowrule = float, ^(org.kde.okular)$ diff --git a/hypr/.config/hypr/scripts/daemons.sh b/hypr/.config/hypr/scripts/daemons.sh index 8ae5f5bf..f25aefa2 100755 --- a/hypr/.config/hypr/scripts/daemons.sh +++ b/hypr/.config/hypr/scripts/daemons.sh @@ -15,7 +15,7 @@ if [[ ! $(pidof swww-daemon) ]]; then fi openrgb -p simple.orp & -kak -d -s default & +kak -d -s default & # kakoune default server wl-paste --type text --watch cliphist store & wl-paste --type image --watch cliphist store & diff --git a/kak/.config/kak/kakrc b/kak/.config/kak/kakrc index e97a433d..bf62166d 100644 --- a/kak/.config/kak/kakrc +++ b/kak/.config/kak/kakrc @@ -1,13 +1,11 @@ # Clipboard (wayland) integration +# ────────────────────────────────────────────────────────────────────────────── hook global NormalKey y %{ nop %sh{ printf %s "$kak_main_reg_dquote" | wl-copy > /dev/null 2>&1 & }} -# Kakoune shell integration, see https://github.com/kkga/kks -eval %sh{ kks init } - # Enable PLUGin manager -# ───────────────────── +# ────────────────────────────────────────────────────────────────────────────── source "%val{config}/plugins/plug.kak/rc/plug.kak" plug "andreyorst/plug.kak" noload plug "Ersikan/bookmarks.kak" %{ @@ -22,18 +20,25 @@ plug "andreyorst/plug.kak" noload hook global WinSetOption filetype=(c|cpp) smarttab } plug "whereswaldon/shellcheck.kak" - plug "kakounedotcom/prelude.kak" + plug "occivink/kakoune-filetree" plug "occivink/kakoune-sudo-write" plug "occivink/kakoune-find" plug "foot.kak" plug "https://git.sr.ht/~nasmevka/dabruin.kak" - plug "https://github.com/enricozb/tabs.kak" + plug "andreyorst/powerline.kak" defer powerline_freerunner %{ + powerline-format global 'mode_info git bufname session client line_column position ' + powerline-theme freerunner + powerline-separator triangle + } config %{ + powerline-start + } + plug "raiguard/kak-harpoon" %{ + hook global WinCreate .* harpoon-add-bindings + } -# Look and Feel -# ───────────── -set-option global tabs_modelinefmt '%val{cursor_line}:%val{cursor_char_column} {{mode_info}} ' -set-option global tabs_options --minified +# Look and Feel +# ────────────────────────────────────────────────────────────────────────────── add-highlighter global/trailing-whitespace regex '\h+$' 0:Error # trailing whitespaces in red add-highlighter global/todos regex '(//|#|/\*)\h*(TODO|WARNING|FIXME)[:]?[^\n]*' 2:+bu # highlight comment tags add-highlighter global/ show-matching # show matching brackets @@ -42,8 +47,9 @@ colorscheme dabruin set-option global tabstop 4 set-option global indentwidth 4 + # dynamic scrolloff -# ───────────────── +# ────────────────────────────────────────────────────────────────────────────── hook global WinCreate [^*].* %{ hook -once window WinDisplay .* %{ hook window WinResize [0-9]*\.[0-9]* %{ @@ -54,8 +60,9 @@ hook global WinCreate [^*].* %{ } } + # Different Cursor color in insert mode -# ───────────────────────────────────── +# ────────────────────────────────────────────────────────────────────────────── # Shades of blue/cyan for normal mode set-face global PrimarySelection white,blue+F set-face global SecondarySelection black,blue+F @@ -66,12 +73,12 @@ set-face global SecondaryCursorEol black,bright-blue # Shades of green/yellow for insert mode. hook global ModeChange (push|pop):.*:insert %{ - set-face window PrimarySelection white,green+F - set-face window SecondarySelection black,green+F - set-face window PrimaryCursor black,bright-yellow+F - set-face window SecondaryCursor black,bright-green+F - set-face window PrimaryCursorEol black,bright-yellow - set-face window SecondaryCursorEol black,bright-green + set-face window PrimarySelection black,yellow+F + set-face window SecondarySelection black,yellow+F + set-face window PrimaryCursor black,bright-red+F + set-face window SecondaryCursor black,bright-yellow+F + set-face window PrimaryCursorEol black,bright-red + set-face window SecondaryCursorEol black,bright-yellow } # Undo colour changes when we leave insert mode. @@ -84,12 +91,14 @@ hook global ModeChange (push|pop):insert:.* %{ unset-face window SecondaryCursorEol } + # Enable editor config -# ──────────────────── +# ────────────────────────────────────────────────────────────────────────────── hook global WinCreate ^[^*]+$ %{ editorconfig-load } + # Extra editor commands -# ───────────────────── +# ────────────────────────────────────────────────────────────────────────────── # tab replacement define-command clean-selections -docstring 'Replace tabs with spaces and trim trailing whitespace' %{ try %{ execute-keys -draft @s\h+$d @@ -109,7 +118,7 @@ define-command -hidden -params 2 inc %{ try %{ # Various mappings -# ──────────────── +# ────────────────────────────────────────────────────────────────────────────── map global normal '#' :comment-line -docstring 'comment line' map global normal '' :comment-block -docstring 'comment block' map global goto m 'm;' -docstring 'matching char' @@ -118,10 +127,11 @@ map -docstring 'select lines downwards' global normal X TLx map global normal ': inc %val{count} +' map global normal ': inc %val{count} -' map global normal Q q # map q to Q -map global normal q -docstring 'tabs mode' ': enter-user-mode tabs' # map q to tabs mode +#map global normal q -docstring 'tabs mode' ': enter-user-mode tabs' # map q to tabs mode + # default user mode -# # ────────── +# ────────────────────────────────────────────────────────────────────────────── map global user -docstring 'enable autocomplete' a ': set-option -add buffer autocomplete insert' map global user -docstring 'disable autocomplete' A ': set-option -remove buffer autocomplete insert' map global user -docstring 'edit kakrc' e ': e ~/.config/kak/kakrc' @@ -135,91 +145,126 @@ map global user -docstring 'relative line numbers disable' R ': remove-highlight map global user -docstring 'wrap enable' w ': add-highlighter buffer/bw wrap' map global user -docstring 'wrap disable' W ': remove-highlighter buffer/bw' -# tabs user mode -# # ────────── -map global normal -docstring 'kks mode' ': enter-user-mode kks' - - -# kks user mode -# # ────────── -declare-user-mode kks -map global normal -docstring 'kks mode' ': enter-user-mode kks' -map global kks f -docstring 'files' ': kks-connect terminal-popup kks-files' -map global kks F -docstring 'files (all)' ': kks-connect terminal-popup kks-files -HI' -map global kks g -docstring 'git files' ': kks-connect terminal-popup kks-git-files' -map global kks b -docstring 'buffers' ': kks-connect terminal-popup kks-buffers' -map global kks / -docstring 'live grep' ': kks-connect terminal-popup kks-grep' -map global kks l -docstring 'lines in buffer' ': kks-connect terminal-popup kks-lines' -map global kks r -docstring 'recent files' ': kks-connect terminal-popup kks-mru' -map global kks -docstring 'filetypes' ': kks-connect terminal-popup kks-filetypes' +# terminal config (via foot.kak) +# ────────────────────────────────────────────────────────────────────────────── set-option global foot_normal_cmd 'foot' set-option global foot_popup_cmd 'foot' set-option global foot_normal_flags '' -set-option global foot_popup_flags '-a popup' +set-option global foot_popup_flags '-a kakpopup' set-option global foot_panel_cmd 'foot' -# suspend and resume -# # ────────── -def suspend-and-resume \ - -params 1..2 \ - -docstring 'suspend-and-resume []: backgrounds current kakoune client and runs specified cli command. Upon exit of command the optional kak command is executed.' \ - %{ evaluate-commands %sh{ - - # Note we are adding '&& fg' which resumes the kakoune client process after the cli command exits - cli_cmd="$1 && fg" - post_resume_cmd="$2" - - # automation is different platform to platform - platform=$(uname -s) - case $platform in - Darwin) - automate_cmd="sleep 0.01; osascript -e 'tell application \"System Events\" to keystroke \"$cli_cmd\" & return '" - kill_cmd="/bin/kill" - break - ;; - Linux) - automate_cmd="sleep 0.2; xdotool type '$cli_cmd'; xdotool key Return" - kill_cmd="/usr/bin/kill" - break - ;; - esac - - # Uses platforms automation to schedule the typing of our cli command - nohup sh -c "$automate_cmd" > /dev/null 2>&1 & - # Send kakoune client to the background - $kill_cmd -SIGTSTP $kak_client_pid - - # ...At this point the kakoune client is paused until the " && fg " gets run in the $automate_cmd - - # Upon resume, run the kak command is specified - if [ ! -z "$post_resume_cmd" ]; then - echo "$post_resume_cmd" - fi -}} -def for-each-line \ - -docstring "for-each-line : run command with the value of each line in the file" \ - -params 2 \ - %{ evaluate-commands %sh{ +# # suspend and resume +# # # ────────── +# def suspend-and-resume \ +# -params 1..2 \ +# -docstring 'suspend-and-resume []: backgrounds current kakoune client and runs specified cli command. Upon exit of command the optional kak command is executed.' \ +# %{ evaluate-commands %sh{ - while read f; do - printf "$1 $f\n" - done < "$2" -}} +# # Note we are adding '&& fg' which resumes the kakoune client process after the cli command exits +# cli_cmd="$1 && fg" +# post_resume_cmd="$2" -def toggle-ranger %{ - suspend-and-resume \ - "ranger --choosefiles=/tmp/ranger-files-%val{client_pid}" \ - "for-each-line edit /tmp/ranger-files-%val{client_pid}" -} +# # automation is different platform to platform +# platform=$(uname -s) +# case $platform in +# Darwin) +# automate_cmd="sleep 0.01; osascript -e 'tell application \"System Events\" to keystroke \"$cli_cmd\" & return '" +# kill_cmd="/bin/kill" +# break +# ;; +# Linux) +# automate_cmd="sleep 0.2; xdotool type '$cli_cmd'; xdotool key Return" +# kill_cmd="/usr/bin/kill" +# break +# ;; +# esac -map global user f ': toggle-ranger' -docstring 'select files in ranger' +# # Uses platforms automation to schedule the typing of our cli command +# nohup sh -c "$automate_cmd" > /dev/null 2>&1 & +# # Send kakoune client to the background +# $kill_cmd -SIGTSTP $kak_client_pid + +# # ...At this point the kakoune client is paused until the " && fg " gets run in the $automate_cmd + +# # Upon resume, run the kak command is specified +# if [ ! -z "$post_resume_cmd" ]; then +# echo "$post_resume_cmd" +# fi +# }} + +# def for-each-line \ +# -docstring "for-each-line : run command with the value of each line in the file" \ +# -params 2 \ +# %{ evaluate-commands %sh{ + +# while read f; do +# printf "$1 $f\n" +# done < "$2" +# }} + +# def toggle-ranger %{ +# suspend-and-resume \ +# "ranger --choosefiles=/tmp/ranger-files-%val{client_pid}" \ +# "for-each-line edit /tmp/ranger-files-%val{client_pid}" +# } + +# map global user f ': toggle-ranger' -docstring 'select files in ranger' # run on file open -# ───────────── +# ────────────────────────────────────────────────────────────────────────────── hook global BufOpenFile .* %{ modeline-parse } +# session manager +# ────────────────────────────────────────────────────────────────────────────── +evaluate-commands %sh{ + kcr init kakoune +} + +# kakoune.cr Mappings +map -docstring 'new client' global normal ': new' +map -docstring 'terminal (popup)' global normal ': connect terminal-popup' +map -docstring 'git (popup)' global normal ': connect terminal-popup gitui' +#map -docstring 'file explorer' global normal ': connect terminal-panel sidetree --select %val{buffile}' +map -docstring 'file picker' global normal ': connect terminal-popup kcr fzf files' +map -docstring 'buffer picker' global normal ': connect terminal-popup kcr fzf buffers' +map global normal +unmap global normal +map -docstring 'buffer picker' global normal ': connect terminal-popup kcr fzf buffers' +map -docstring 'grep picker' global normal ': connect terminal-popup kcr fzf grep' +#map -docstring 'grep picker (buffer)' global normal ': connect terminal-popup kcr fzf grep %val{buflist}' + + +# Reload kakrc and .kak when saving. +# ────────────────────────────────────────────────────────────────────────────── +# Adds -override to definitions (unless they seem to be python defs!) +# Evals provide module directly + +def resource -params 1 %{ + eval %sh{ + file=$(dirname "$1")/.reload.kak + cat "$1" | + sed 's/^def \([^:]*\)$/def -override \1/' | + sed 's/^define-command /def -override /' | + sed 's/^addhl /addhl -override/' | + sed 's/^add-highlighter /addhl -override /' | + sed 's/^provide-module \w\+ /eval /' | + cat > "$file" + printf %s " + source $file + nop %sh{ + rm $file + } + " + } + echo Reloaded %arg{1} +} + +rmhooks global reload-kak +hook -group reload-kak global BufWritePost (.*kakrc|.*\.kak) %{ + resource %val{hook_param} +} diff --git a/kak/.config/kak/plugins/.build/kak-harpoon/config b/kak/.config/kak/plugins/.build/kak-harpoon/config new file mode 100644 index 00000000..8b5a70e3 --- /dev/null +++ b/kak/.config/kak/plugins/.build/kak-harpoon/config @@ -0,0 +1,19 @@ +try %{ + + hook global WinCreate .* harpoon-add-bindings + } catch %{ + echo -debug "Error while evaluating 'kak-harpoon' configuration: %val{error}" + + set-option -add current plug_conf_errors "Error while evaluating 'kak-harpoon' 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} + } + } +} diff --git a/kak/.config/kak/plugins/kak-harpoon b/kak/.config/kak/plugins/kak-harpoon new file mode 160000 index 00000000..15e0a01d --- /dev/null +++ b/kak/.config/kak/plugins/kak-harpoon @@ -0,0 +1 @@ +Subproject commit 15e0a01d2c5720c576375e7e6b271a5f84dcad2a diff --git a/kak/.config/kak/plugins/kakoune-filetree b/kak/.config/kak/plugins/kakoune-filetree new file mode 160000 index 00000000..be8158ce --- /dev/null +++ b/kak/.config/kak/plugins/kakoune-filetree @@ -0,0 +1 @@ +Subproject commit be8158ce83e295830a48057c0580fe17a843d661 diff --git a/kak/.config/kak/plugins/powerline.kak b/kak/.config/kak/plugins/powerline.kak new file mode 160000 index 00000000..43e60c48 --- /dev/null +++ b/kak/.config/kak/plugins/powerline.kak @@ -0,0 +1 @@ +Subproject commit 43e60c48d7f6da98055ee6a4d02fa949e5ef2805 diff --git a/kak/.config/kak/plugins/tabs.kak b/kak/.config/kak/plugins/tabs.kak deleted file mode 160000 index ae66830f..00000000 --- a/kak/.config/kak/plugins/tabs.kak +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ae66830ffcc9b6a1ca58ebd4bb37ded58d3cdfdf