diff --git a/.config/kak/autoload/plugins.kak b/.config/kak/autoload/plugins.kak index 2964bcb7..b38274b4 100644 --- a/.config/kak/autoload/plugins.kak +++ b/.config/kak/autoload/plugins.kak @@ -3,46 +3,43 @@ source "%val{config}/bundle/kak-bundle/rc/kak-bundle.kak" bundle-noload kak-bundle https://codeberg.org/jdugan6240/kak-bundle bundle inc-dec.kak https://gitlab.com/Screwtapello/kakoune-inc-dec %{ - map -docstring "increment" global normal %{: inc-dec-modify-numbers + %val{count}} - map -docstring "decrement" global normal %{: inc-dec-modify-numbers - %val{count}} + map -docstring "increment" global normal %{: inc-dec-modify-numbers + %val{count}} + map -docstring "decrement" global normal %{: inc-dec-modify-numbers - %val{count}} } - bundle auto-pairs.kak https://github.com/alexherbo2/auto-pairs.kak %{ - enable-auto-pairs + enable-auto-pairs } bundle fzf.kak https://github.com/andreyorst/fzf.kak %{ - require-module fzf - set-option global fzf_highlight_command "bat" - require-module fzf-grep - set-option global fzf_grep_command "rg" - require-module fzf-file - set-option global fzf_file_command "fd . --no-ignore-vcs" - map -docstring "fzf mode" global user f ": fzf-mode" + require-module fzf + set-option global fzf_highlight_command "bat" + require-module fzf-grep + set-option global fzf_grep_command "rg" + require-module fzf-file + set-option global fzf_file_command "fd . --no-ignore-vcs" + map -docstring "fzf mode" global user f ": fzf-mode" } bundle luar https://github.com/gustavo-hms/luar %{ - require-module luar + require-module luar } - bundle easymotion.kak https://git.sr.ht/~voroskoi/easymotion.kak %{ require-module easymotion - unmap global easymotion h - unmap global easymotion j - unmap global easymotion k - unmap global easymotion l + unmap global easymotion h + unmap global easymotion j + unmap global easymotion k + unmap global easymotion l map global normal ': enter-user-mode easymotion' - map global easymotion -docstring %{easymotion line ↓} ": easymotion-j" - map global easymotion -docstring %{easymotion line ↑} ": easymotion-k" - map global easymotion -docstring %{easymotion streak →} ": easymotion-streak-forward" - map global easymotion -docstring %{easymotion streak ←} ": easymotion-streak-backward" - set-option global easymotion_chars "tnseriplfuwydhcxoaqz" + map global easymotion -docstring %{easymotion line ↓} ": easymotion-j" + map global easymotion -docstring %{easymotion line ↑} ": easymotion-k" + map global easymotion -docstring %{easymotion streak →} ": easymotion-streak-forward" + map global easymotion -docstring %{easymotion streak ←} ": easymotion-streak-backward" + set-option global easymotion_chars "tnseriplfuwydhcxoaqz" } bundle byline.kak https://github.com/evanrelf/byline.kak %{ - require-module "byline" + require-module "byline" } - diff --git a/.config/kak/kakrc b/.config/kak/kakrc index 01ad2014..b776ab9a 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -4,16 +4,20 @@ colorscheme ashen set-option global ui_options terminal_assistant=none hook global ModuleLoaded wayland %{ - set-option global termcmd 'footclient sh -c' + set-option global termcmd 'footclient sh -c' +} + +hook global WinSetOption filetype=kak %{ + set-option window formatcmd "%val{config}/scripts/kakfmt" } # open tutor (needs curl) define-command trampoline -docstring "open a tutorial" %{ - evaluate-commands %sh{ - tramp_file=$(mktemp -t "kakoune-trampoline.XXXXXXXX") - echo "edit -fifo $tramp_file *TRAMPOLINE*" - curl -s https://raw.githubusercontent.com/mawww/kakoune/master/contrib/TRAMPOLINE -o "$tramp_file" - } + evaluate-commands %sh{ + tramp_file=$(mktemp -t "kakoune-trampoline.XXXXXXXX") + echo "edit -fifo $tramp_file *TRAMPOLINE*" + curl -s https://raw.githubusercontent.com/mawww/kakoune/master/contrib/TRAMPOLINE -o "$tramp_file" + } } set-option global tabstop 4 @@ -30,6 +34,7 @@ add-highlighter global/ wrap -word -indent map -docstring "yank the selection into the clipboard" global user y " wl-copy" map -docstring "paste the clipboard" global user p " wl-paste" +map -docstring "paste the clipboard before" global user P "! wl-paste" map -docstring "quit" global user q ":q" diff --git a/.config/kak/scripts/kakfmt b/.config/kak/scripts/kakfmt new file mode 100755 index 00000000..5751fa03 --- /dev/null +++ b/.config/kak/scripts/kakfmt @@ -0,0 +1,18 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my $Indent = 0; +my $Blank_Lines = 0; +my $Open = qr/[{\[(]$/; +my $Close = qr/^[}\])]/; +while (<>) { + s/^\h*//; + $Blank_Lines++, next if m/^$/; + my $Comment = m/^#/; + $Indent-- if m/$Close/ and not $Comment; + $Blank_Lines = 0, print "\n" if $Blank_Lines; + print "\t" x $Indent, $_; + $Indent++ if m/$Open/ and not $Comment; +}