├── .gitignore ├── .gitmodules ├── README.md ├── UNLICENSE ├── autoload ├── arch-linux.kak ├── autoload ├── basic_indent.kak ├── batch.kak ├── case.kak ├── colemak.kak ├── comnotes.kak ├── context │ ├── context │ ├── context.asciidoc │ └── context.kak ├── css.kak ├── diff.kak ├── dradis.kak ├── git-hunk.kak ├── highlight.kak ├── html.kak ├── ide.kak ├── languages.kak ├── latex.kak ├── less.kak ├── markdown.kak ├── pipe-selections.kak ├── racket.kak ├── regex.kak ├── remaps.kak ├── rsync.kak ├── shell.kak ├── solidity.kak ├── speedrun.kak ├── termshot.kak ├── tmux.kak ├── util.kak ├── visual_studio.kak ├── woordenboek.kak └── wordcount.kak ├── bin ├── editor └── latex-compile-main ├── colors ├── ayu.kak ├── gruvbox.kak ├── nofrils-dark.kak ├── nofrils-gruvbox.kak └── solarized-dark.kak ├── kakrc ├── not_loaded ├── fifo.kak └── leader.kak ├── plugins └── .gitignore └── snippets.kak /.gitignore: -------------------------------------------------------------------------------- 1 | bin/emmet-call 2 | bin/snippet 3 | rc/emmet.kak 4 | rc/snippet.kak 5 | plugins/*-install 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "plugins/fzf.kak"] 2 | path = plugins/fzf.kak 3 | url = https://github.com/andreyorst/fzf.kak 4 | [submodule "plugins/kakoune-extra"] 5 | path = plugins/kakoune-extra 6 | url = https://github.com/lenormf/kakoune-extra.git 7 | [submodule "plugins/kakoune-phantom-selection"] 8 | path = plugins/kakoune-phantom-selection 9 | url = https://github.com/occivink/kakoune-phantom-selection 10 | [submodule "plugins/kakoune-snippets"] 11 | path = plugins/kakoune-snippets 12 | url = https://github.com/occivink/kakoune-snippets 13 | [submodule "plugins/kakoune-fireplace"] 14 | path = plugins/kakoune-fireplace 15 | url = https://github.com/jjk96/kakoune-fireplace 16 | [submodule "plugins/yank-ring.kak"] 17 | path = plugins/yank-ring.kak 18 | url = https://github.com/alexherbo2/yank-ring.kak 19 | [submodule "plugins/select.kak"] 20 | path = plugins/select.kak 21 | url = https://github.com/alexherbo2/select.kak 22 | [submodule "plugins/kakoune-buffers"] 23 | path = plugins/kakoune-buffers 24 | url = https://github.com/Delapouite/kakoune-buffers 25 | [submodule "plugins/kak-tree"] 26 | path = plugins/kak-tree 27 | url = https://github.com/ul/kak-tree 28 | [submodule "plugins/kakoune-cd"] 29 | path = plugins/kakoune-cd 30 | url = https://github.com/delapouite/kakoune-cd 31 | [submodule "plugins/kakoune-mirror"] 32 | path = plugins/kakoune-mirror 33 | url = https://github.com/Delapouite/kakoune-mirror 34 | [submodule "plugins/kakoune-sudo-write"] 35 | path = plugins/kakoune-sudo-write 36 | url = https://github.com/occivink/kakoune-sudo-write.git 37 | [submodule "plugins/kakoune-text-objects"] 38 | path = plugins/kakoune-text-objects 39 | url = https://github.com/Delapouite/kakoune-text-objects 40 | [submodule "plugins/split-object.kak"] 41 | path = plugins/split-object.kak 42 | url = https://github.com/alexherbo2/split-object.kak 43 | [submodule "plugins/kakoune-snippet-collection"] 44 | path = plugins/kakoune-snippet-collection 45 | url = https://github.com/andreyorst/kakoune-snippet-collection 46 | [submodule "plugins/phantom.kak"] 47 | path = plugins/phantom.kak 48 | url = https://github.com/alexherbo2/phantom.kak 49 | [submodule "plugins/plug.kak"] 50 | path = plugins/plug.kak 51 | url = https://github.com/andreyorst/plug.kak 52 | [submodule "plugins/kak-ansi"] 53 | path = plugins/kak-ansi 54 | url = https://github.com/eraserhd/kak-ansi 55 | [submodule "plugins/kakoune-emmet"] 56 | path = plugins/kakoune-emmet 57 | url = git@github.com:JJK96/kakoune-emmet.git 58 | [submodule "plugins/kakoune-python-bridge"] 59 | path = plugins/kakoune-python-bridge 60 | url = git@github.com:JJK96/kakoune-python-bridge.git 61 | [submodule "plugins/neptyne"] 62 | path = plugins/neptyne 63 | url = https://github.com/danr/neptyne 64 | [submodule "plugins/kakoune-repl-bridge"] 65 | path = plugins/kakoune-repl-bridge 66 | url = git@github.com:JJK96/kakoune-repl-bridge.git 67 | [submodule "plugins/kakoune-roguelight"] 68 | path = plugins/kakoune-roguelight 69 | url = https://github.com/occivink/kakoune-roguelight 70 | [submodule "plugins/kakoune-dbgp"] 71 | path = plugins/kakoune-dbgp 72 | url = git@github.com:JJK96/kakoune_dbgp.git 73 | [submodule "plugins/kakoune-gdb"] 74 | path = plugins/kakoune-gdb 75 | url = https://github.com/occivink/kakoune-gdb 76 | [submodule "plugins/parinfer-rust"] 77 | path = plugins/parinfer-rust 78 | url = https://github.com/eraserhd/parinfer-rust 79 | [submodule "plugins/kakoune-repl-send"] 80 | path = plugins/kakoune-repl-send 81 | url = https://github.com/jjk96/kakoune-repl-send 82 | [submodule "plugins/kakoune-palette"] 83 | path = plugins/kakoune-palette 84 | url = https://github.com/delapouite/kakoune-palette 85 | [submodule "plugins/kakoune-edit-or-dir"] 86 | path = plugins/kakoune-edit-or-dir 87 | url = https://github.com/TeddyDD/kakoune-edit-or-dir 88 | [submodule "plugins/kakoune-debug"] 89 | path = plugins/kakoune-debug 90 | url = git@github.com:JJK96/kakoune-debug.git 91 | [submodule "plugins/kakoune-rainbow"] 92 | path = plugins/kakoune-rainbow 93 | url = git@github.com:JJK96/kakoune-rainbow.git 94 | [submodule "plugins/tagbar.kak"] 95 | path = plugins/tagbar.kak 96 | url = https://github.com/andreyorst/tagbar.kak 97 | [submodule "plugins/kakoune-find"] 98 | path = plugins/kakoune-find 99 | url = https://github.com/occivink/kakoune-find 100 | [submodule "plugins/kakoune-table"] 101 | path = plugins/kakoune-table 102 | url = https://gitlab.com/listentolist/kakoune-table 103 | [submodule "plugins/connect.kak"] 104 | path = plugins/connect.kak 105 | url = https://github.com/alexherbo2/connect.kak 106 | [submodule "plugins/prelude.kak"] 107 | path = plugins/prelude.kak 108 | url = https://github.com/alexherbo2/prelude.kak 109 | [submodule "plugins/kakoune-kit"] 110 | path = plugins/kakoune-kit 111 | url = https://github.com/chambln/kakoune-kit 112 | [submodule "plugins/kaktree"] 113 | path = plugins/kaktree 114 | url = git@github.com:JJK96/kaktree.git 115 | [submodule "plugins/kak-bundle"] 116 | path = plugins/kak-bundle 117 | url = https://codeberg.org/jdugan6240/kak-bundle 118 | [submodule "plugins/kakoune-buffer-switcher"] 119 | path = plugins/kakoune-buffer-switcher 120 | url = https://github.com/occivink/kakoune-buffer-switcher 121 | [submodule "plugins/kak-lsp"] 122 | path = plugins/kak-lsp 123 | url = https://github.com/kak-lsp/kak-lsp 124 | [submodule "autoload/northwave"] 125 | path = autoload/northwave 126 | url = git@github.com:JJK96/kakoune-northwave.git 127 | [submodule "plugins/kakoune-node-bridge"] 128 | path = plugins/kakoune-node-bridge 129 | url = git@github.com:JJK96/kakoune-node-bridge 130 | [submodule "plugins/prelude"] 131 | path = plugins/prelude 132 | url = https://github.com/robertmeta/prelude.kak 133 | [submodule "plugins/kakoune-racket"] 134 | path = plugins/kakoune-racket 135 | url = https://bitbucket.org/KJ_Duncan/kakoune-racket.kak 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kakoune configuration 2 | 3 | [Kakoune](https://github.com/mawww/kakoune) 4 | 5 | 6 | # Contact 7 | 8 | Feel free to create an issue if you have questions on how to use some stuff 9 | 10 | # Files 11 | 12 | |File/folder |Description | 13 | |-------------|-------------------------------| 14 | |bin | Scripts | 15 | |colors | Colorschemes | 16 | |autoload | .kak files sourced by kakrc | 17 | |kakrc | Main configuration file | 18 | |plugins | Plugins that I use(d) | 19 | |snippets.kak | Snippet definitions | 20 | 21 | See the individual files for more explanations 22 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /autoload/arch-linux.kak: -------------------------------------------------------------------------------- 1 | hook global WinSetOption filetype=packages %[ 2 | map window normal "|xargs pacman -Qi" 3 | ] 4 | -------------------------------------------------------------------------------- /autoload/autoload: -------------------------------------------------------------------------------- 1 | /Users/nw/git/kakoune/rc -------------------------------------------------------------------------------- /autoload/basic_indent.kak: -------------------------------------------------------------------------------- 1 | def -hidden basic-autoindent-on-newline %{ 2 | eval -draft -itersel %{ 3 | try %{ exec -draft ';K' } # copy indentation from previous line 4 | try %{ exec -draft ';k^\h+$H' } # remove whitespace from autoindent on previous line 5 | } 6 | } 7 | def -hidden basic-autoindent-trim %{ 8 | try %{ exec -draft '' '1s^(\h+)$' '' } 9 | } 10 | def basic-autoindent-enable %{ 11 | hook -group basic-autoindent window InsertChar '\n' basic-autoindent-on-newline 12 | hook -group basic-autoindent window ModeChange 'pop:insert:normal' basic-autoindent-trim 13 | hook -group basic-autoindent window WinSetOption 'filetype=.*' basic-autoindent-disable 14 | } 15 | def basic-autoindent-disable %{ rmhooks window basic-autoindent } 16 | -------------------------------------------------------------------------------- /autoload/batch.kak: -------------------------------------------------------------------------------- 1 | hook global BufOpenFile /private/var/folders.*batch\..* %[ 2 | set buffer filetype batch 3 | ] 4 | 5 | hook global BufSetOption filetype=batch %[ 6 | map buffer normal x H 7 | ] 8 | -------------------------------------------------------------------------------- /autoload/case.kak: -------------------------------------------------------------------------------- 1 | # foo_bar → fooBar 2 | # foo-bar → fooBar 3 | # foo bar → fooBar 4 | def camelcase %{ 5 | exec '`s[-_]d~w' 6 | } 7 | 8 | # fooBar → foo_bar 9 | # foo-bar → foo_bar 10 | # foo bar → foo_bar 11 | def snakecase %{ 12 | exec 's-|[a-z][A-Z];as[-\s]+c_w`' 13 | } 14 | 15 | # fooBarTest → foo-bar 16 | # foo_bar → foo-bar 17 | # foo bar → foo-bar 18 | def kebabcase %{ 19 | exec 's_|[a-z][A-Z];as[_\s]+c-w`' 20 | } 21 | 22 | def -hidden select-prev-word-part %{ 23 | exec [A-Z][a-z]+|[A-Z]+|[a-z]+ 24 | } 25 | def -hidden select-next-word-part %{ 26 | exec /[A-Z][a-z]+|[A-Z]+|[a-z]+ 27 | } 28 | def -hidden extend-prev-word-part %{ 29 | exec [A-Z][a-z]+|[A-Z]+|[a-z]+ 30 | } 31 | def -hidden extend-next-word-part %{ 32 | exec ?[A-Z][a-z]+|[A-Z]+|[a-z]+ 33 | } 34 | 35 | declare-user-mode movecase 36 | map global movecase w -docstring 'move to next word-part' ': select-next-word-part' 37 | map global movecase W -docstring 'extend to next word-part' ': extend-next-word-part' 38 | map global movecase b -docstring 'move to previous word-part' ': select-prev-word-part' 39 | map global movecase B -docstring 'extend to previous word-part' ': extend-prev-word-part' 40 | map global movecase . -docstring 'lock' ': enter-user-mode -lock movecase' 41 | -------------------------------------------------------------------------------- /autoload/colemak.kak: -------------------------------------------------------------------------------- 1 | map global normal n j 2 | map global normal 3 | map global normal 4 | map global normal e k 5 | map global normal i l 6 | map global normal I L 7 | map global normal 8 | map global normal 9 | 10 | map global normal j n 11 | map global normal 12 | map global normal 13 | map global normal J N 14 | map global normal l i 15 | map global normal 16 | map global normal 17 | 18 | map global normal k e 19 | map global normal K E 20 | map global normal 21 | map global normal 22 | map global normal 23 | map global normal 24 | 25 | # Select whole lines when moving selection with J or K 26 | map global normal N Jx 27 | map global normal E Kx 28 | 29 | # Make I insert before every line 30 | map global normal L "I" 31 | -------------------------------------------------------------------------------- /autoload/comnotes.kak: -------------------------------------------------------------------------------- 1 | ## 2 | ## comnotes.kak by lenormf 3 | ## Highlight TODO, FIXME, NOTE and XXX comments 4 | ## 5 | 6 | add-highlighter global/ regex \b(TODO|FIXME|XXX|NOTE)\b 0:default+rb 7 | -------------------------------------------------------------------------------- /autoload/context/context: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function get_indent_level { 4 | printf "%s" "$1" | grep -Po '^\s+' | tr -d '\n' | wc -c 5 | } 6 | 7 | prev_indent=0 8 | IFS='' 9 | tac /dev/stdin | while read line; do 10 | if [ ! -z "$line" ]; then 11 | indent_level=$(get_indent_level "$line") 12 | if [ $prev_indent -eq 0 ] || [ $indent_level -lt $prev_indent ]; then 13 | prev_indent=$indent_level 14 | printf "%s\n" "$line" 15 | fi 16 | if [ $indent_level -eq 0 ]; then 17 | exit 18 | fi 19 | fi 20 | done | tac 21 | -------------------------------------------------------------------------------- /autoload/context/context.asciidoc: -------------------------------------------------------------------------------- 1 | = context 2 | 3 | A very crude proof of concept implementation of a context plugin 4 | This shows the context in a separate window 5 | 6 | Probably a replace-range highlighter would be better 7 | -------------------------------------------------------------------------------- /autoload/context/context.kak: -------------------------------------------------------------------------------- 1 | declare-option -hidden str context_dir %sh{echo "${kak_source%/*}"} 2 | 3 | declare-option str context_fifo 4 | 5 | define-command show-context %{ 6 | evaluate-commands -draft %{ 7 | execute-keys Gk 8 | nop %sh{ 9 | printf "%s" "$kak_selection" | "${kak_opt_context_dir}/context" > "$kak_opt_context_fifo" 10 | } 11 | edit -fifo "%opt{context_fifo}" "%val{bufname}_context" 12 | } 13 | } 14 | 15 | define-command buffer-enable-context %{ 16 | evaluate-commands %sh{ 17 | fifo=$(mktemp -t kak_context_XXXXX) 18 | mkfifo "$fifo" 19 | echo set-option buffer context_fifo "$fifo" 20 | } 21 | evaluate-commands -draft %{ 22 | new edit -fifo "%opt{context_fifo}" "%val{bufname}_context" 23 | } 24 | hook buffer NormalIdle .* show-context 25 | } 26 | 27 | define-command buffer-disable-context %{ 28 | evaluate-commands %sh{ 29 | rm "$kak_opt_context_fifo" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /autoload/css.kak: -------------------------------------------------------------------------------- 1 | define-command show-color -docstring 'show main selection color in status bar' %{ 2 | evaluate-commands %sh{ 3 | awk_script='{ 4 | if ((x=index($1,"#")) > 0) 5 | $1 = substr($1, x+1) 6 | if (length($1) == 8) 7 | $1 = substr($1, 1, 6) 8 | if (length($1) == 4) 9 | $1 = substr($1, 1, 3) 10 | if (length($1) == 3) { 11 | r = substr($1, 1, 1) 12 | g = substr($1, 2, 1) 13 | b = substr($1, 3, 1) 14 | $1 = r r g g b b 15 | } 16 | print "evaluate-commands -client " client " echo -markup {rgb:" $1 "} ██████" 17 | }' 18 | printf %s\\n "$kak_selection" | awk -v client="$kak_client" "$awk_script" | kak -p "$kak_session" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /autoload/diff.kak: -------------------------------------------------------------------------------- 1 | define-command -docstring 'Diff the current selections and display result in a new buffer.' \ 2 | diff-selections %{ 3 | evaluate-commands %sh{ 4 | eval set -- "$kak_quoted_selections" 5 | if [ $# -gt 1 ]; then 6 | dir=$(mktemp -d -t "kak_diff_XXXXXXX") 7 | a="$dir/a" 8 | b="$dir/b" 9 | result="$dir/result" 10 | printf "%s" "$1" > "$a" 11 | printf "%s" "$2" > "$b" 12 | diff -uw "$a" "$b" > "$result" 13 | printf %s\\n "evaluate-commands -try-client '$kak_opt_toolsclient' %{ 14 | edit -readonly ${result} 15 | hook -always -once buffer BufClose .* %{ nop %sh{ rm -r ${dir} } } 16 | }" 17 | else 18 | printf "echo -debug 'You must have at least 2 selections to compare.'" 19 | fi 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /autoload/dradis.kak: -------------------------------------------------------------------------------- 1 | define-command dradis-highlight %{ 2 | # Split selection by line and strip whitespace 3 | execute-keys "_" 4 | # Surround with highlighting tags 5 | execute-keys "i$${{a}}$$" 6 | } 7 | 8 | define-command dradis-unhighlight %{ 9 | execute-keys -draft "s(\$\$\{\{|\}\}\$\$)d" 10 | } 11 | 12 | define-command dradis-snip %{ 13 | execute-keys "c--snip--" 14 | } 15 | 16 | define-command dradis-redact %{ 17 | execute-keys "c[REDACTED]" 18 | } 19 | 20 | define-command -hidden dradis-update-number %{ 21 | #Select number 22 | execute-keys "s\d+" 23 | # Update number 24 | execute-keys "c#" 25 | } 26 | 27 | define-command dradis-update-refs %{ 28 | evaluate-commands -draft %{ 29 | #Select notes 30 | execute-keys "s\d+" 31 | dradis-update-number 32 | #Select footnotes 33 | execute-keys "sfn\d+" 34 | dradis-update-number 35 | } 36 | } 37 | 38 | hook global BufSetOption filetype=dradis %{ 39 | map -docstring "Highlight" buffer user h ": dradis-highlight" 40 | map -docstring "Unhighlight" buffer user H ": dradis-unhighlight" 41 | map -docstring "Redact" buffer user r ": dradis-redact" 42 | map -docstring "| Redact" buffer user R "|redact" 43 | } 44 | 45 | hook global WinCreate ".*(dradisfs/.*|.issue$)" %{ 46 | set-option buffer filetype dradis 47 | } 48 | -------------------------------------------------------------------------------- /autoload/git-hunk.kak: -------------------------------------------------------------------------------- 1 | define-command git-hunk-stage %{ 2 | git-hunk-apply-impl "--cached" 3 | } -docstring "Stage hunk at cursor" 4 | define-command git-hunk-unstage %{ 5 | git-hunk-apply-impl "--cached --reverse" 6 | } -docstring "Unstage hunk at cursor" 7 | define-command git-hunk-apply %{ 8 | git-hunk-apply-impl "" 9 | } -docstring "Apply hunk at cursor" 10 | define-command git-hunk-revert %{ 11 | git-hunk-apply-impl "--reverse" 12 | } -docstring "Revert hunk at cursor" 13 | 14 | define-command -hidden git-hunk-apply-impl -params 1 %{ evaluate-commands -draft -save-regs ah| %{ 15 | set-register a %arg{1} 16 | # Save the diff header to register h. 17 | execute-keys -draft '^diff.*?\n(?=@@)"hy' 18 | # Select the current hunk. 19 | execute-keys ?^@@|^diff|^$K^@@ 20 | set-register | %{ 21 | ( printf %s "$kak_reg_h"; cat ) | 22 | git apply $kak_reg_a --whitespace=nowarn - 23 | } 24 | execute-keys | 25 | }} 26 | -------------------------------------------------------------------------------- /autoload/highlight.kak: -------------------------------------------------------------------------------- 1 | # Highlight the word under the cursor 2 | # ─────────────────────────────────── 3 | # Based on: https://github.com/mawww/config/blob/d841453cc71f3ab8cbe19ac5036cd86807590617/kakrc#L40-L54 4 | 5 | declare-option -hidden regex curword 6 | set-face global CurWord default,rgb:4a4a4a 7 | 8 | hook global NormalIdle .* %{ 9 | eval -draft %{ try %{ 10 | exec w \A\w+\z 11 | set-option buffer curword "\b\Q%val{selection}\E\b" 12 | } catch %{ 13 | set-option buffer curword '' 14 | } } 15 | } 16 | add-highlighter global/ dynregex '%opt{curword}' 0:CurWord 17 | -------------------------------------------------------------------------------- /autoload/html.kak: -------------------------------------------------------------------------------- 1 | define-command -hidden html-auto-close-tag %{ 2 | evaluate-commands -draft -itersel -save-regs '"^' %{ 3 | try %{ 4 | # Check if last entered characters are " 6 | # Get tag 7 | execute-keys -save-regs '' Z[ 8 | execute-keys -with-maps t 9 | execute-keys -save-regs '' ey 10 | # Paste tag 11 | execute-keys -save-regs '' zh 12 | # Close tag 13 | execute-keys -with-hooks a 14 | } 15 | } 16 | } 17 | 18 | hook global WinSetOption filetype=(xml|html|php|svelte) %{ 19 | # Credits to mawww for this mapping 20 | map -docstring "xml tag object" global object t %{c([\w.]+)\b[^>]*?(?!/)>,/([\w.]+)\b[^>]*?(?!/)>} 21 | hook -group "close-tag" window InsertChar '/' html-auto-close-tag 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /autoload/ide.kak: -------------------------------------------------------------------------------- 1 | declare-option -docstring 'Width of file picker in percentage of window' str ide_file_picker_width 20 2 | declare-option -docstring 'Width of terminal in percentage of window' str ide_terminal_width 20 3 | declare-option -docstring 'File picker command' str ide_file_picker "broot" 4 | 5 | define-command ide %{ 6 | ide-background 7 | # connect ide-file-picker %opt{ide_file_picker} 8 | kaktree-toggle 9 | connect ide-terminal 10 | } 11 | 12 | define-command ide-background %{ 13 | face global Default rgb:bfc7d5,rgb:292d3e 14 | } 15 | 16 | define-command tmux-terminal-horizontal-before -params 1.. -shell-completion -docstring ' 17 | tmux-terminal-horizontal-before []: create a new terminal as a tmux pane 18 | The current pane is split into two, left and right 19 | The program passed as argument will be executed in the new terminal' \ 20 | %{ 21 | tmux-terminal-impl 'split-window -hb' %arg{@} 22 | } 23 | 24 | define-command ide-file-picker -params 1.. -shell-completion -docstring ' 25 | ide-file-picker []: open file picker panel' \ 26 | %{ 27 | tmux-terminal-impl "split-window -hb -p %opt{ide_file_picker_width}" %arg{@} 28 | } 29 | 30 | define-command ide-terminal -params 1.. -shell-completion -docstring ' 31 | ide-terminal []: open terminal panel' \ 32 | %{ 33 | tmux-terminal-impl "split-window -h -p %opt{ide_terminal_width}" %arg{@} 34 | } 35 | -------------------------------------------------------------------------------- /autoload/languages.kak: -------------------------------------------------------------------------------- 1 | # Small configurations for different languages 2 | 3 | define-command php_format %{ 4 | nop %sh{ 5 | php-cs-fixer fix --rules=@PSR2 $kak_buffile 6 | } 7 | } 8 | 9 | declare-option str formatcmd_json "python -m json.tool" 10 | declare-option str formatcmd_xml "xmllint --format -" 11 | declare-option str formatcmd_python "yapf" 12 | declare-option str formatcmd_rust "rustfmt" 13 | declare-option str formatcmd_javascript "js-beautify" 14 | declare-option str formatcmd_sql "sqlformat --reindent --keywords upper --identifiers lower /dev/stdin" 15 | 16 | hook global WinSetOption filetype=(xml) %[ 17 | set-option buffer formatcmd %opt{formatcmd_xml} 18 | ] 19 | 20 | # hook global WinSetOption filetype=(xml|html) %[ 21 | # map global insert ' ;h: try snippet-word catch emmet' 22 | # ] 23 | 24 | hook global WinSetOption filetype=(json) %[ 25 | set-option buffer formatcmd %opt{formatcmd_json} 26 | ] 27 | 28 | hook global WinSetOption filetype=(python) %[ 29 | set-option buffer formatcmd %opt{formatcmd_python} 30 | lsp-auto-hover-disable 31 | set window lsp_server_configuration pyls.plugins.pycodestyle.enabled=false pyls.plugins.pyflakes.enabled=false pyls.plugins.flake8.enabled=true 32 | alias window comment comment-line 33 | hook -once -always window WinSetOption filetype=.* %{ 34 | unalias window comment 35 | } 36 | ] 37 | 38 | # better indentation 39 | hook global WinSetOption filetype=(p4|php|solidity) %[ 40 | require-module c-family 41 | 42 | hook -group "%val{hook_param_capture_1}-my-trim-indent" window ModeChange insert:.* c-family-trim-indent 43 | hook -group "%val{hook_param_capture_1}-my-insert" window InsertChar \n c-family-insert-on-newline 44 | hook -group "%val{hook_param_capture_1}-my-indent" window InsertChar \n c-family-indent-on-newline 45 | hook -group "%val{hook_param_capture_1}-my-indent" window InsertChar \{ c-family-indent-on-opening-curly-brace 46 | hook -group "%val{hook_param_capture_1}-my-indent" window InsertChar \} c-family-indent-on-closing-curly-brace 47 | hook -group "%val{hook_param_capture_1}-my-insert" window InsertChar \} c-family-insert-on-closing-curly-brace 48 | 49 | hook -once -always window WinSetOption filetype=.* " 50 | remove-hooks window %val{hook_param_capture_1}-.+ 51 | " 52 | 53 | ] 54 | 55 | hook global WinSetOption filetype=(php) %[ 56 | alias window format php_format 57 | lsp-auto-hover-disable 58 | 59 | hook -once -always window WinSetOption filetype=.* %{ 60 | unalias window format 61 | } 62 | ] 63 | 64 | hook global WinSetOption filetype=(rust) %[ 65 | set-option buffer formatcmd %opt{formatcmd_rust} 66 | ] 67 | 68 | hook global WinSetOption filetype=(javascript) %[ 69 | set-option buffer lintcmd eslint 70 | set-option buffer formatcmd %opt{formatcmd_javascript} 71 | ] 72 | 73 | hook global WinSetOption filetype=sql %[ 74 | set window incsearch false 75 | set-option buffer formatcmd %opt{formatcmd_sql} 76 | ] 77 | 78 | hook global WinSetOption filetype=c %[ 79 | map global goto a -docstring "alternative file" %{: c-alternative-file} 80 | ] 81 | 82 | hook global WinCreate .*\.grep %[ 83 | set-option window filetype=grep 84 | ] 85 | 86 | hook global WinCreate /tmp/neomutt.* %[ 87 | set-option window filetype=mail 88 | ] 89 | 90 | # hook global WinSetOption filetype=(plain|markdown) %[ 91 | # set buffer lsp_server_configuration languageTool.language="en" 92 | # ] 93 | 94 | define-command format-selections1 -params 1 %{ 95 | evaluate-commands %sh{ 96 | echo "set-option window formatcmd %opt{formatcmd_$1}" 97 | echo "format-selections" 98 | echo "set-option window formatcmd %{$kak_opt_formatcmd}" 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /autoload/latex.kak: -------------------------------------------------------------------------------- 1 | # latex 2 | 3 | #hook global WinSetOption filetype=latex %{ 4 | # 5 | ## Compile the first main.tex found 6 | ## NOTE: Make sure that latex-compile-main is in the path 7 | # 8 | #hook window -group latex-compile BufWritePost .* %{ nop %sh{ ( 9 | #latex-compile-main ${kak_buffile%/*} 10 | #) > /tmp/tex.log 2>&1 < /dev/null &}} 11 | # 12 | #hook global WinSetOption filetype=(?!latex).* %{ 13 | #remove-hooks global latex-compile 14 | # 15 | #} 16 | # 17 | #} 18 | -------------------------------------------------------------------------------- /autoload/less.kak: -------------------------------------------------------------------------------- 1 | declare-user-mode less 2 | map global less d 3 | map global less u 4 | map global less f 5 | map global less b 6 | -------------------------------------------------------------------------------- /autoload/markdown.kak: -------------------------------------------------------------------------------- 1 | # Configuration options for markdown 2 | 3 | # Compile to pdf or to html 4 | declare-option -docstring "compile to pdf" str markdown_filetype pdf 5 | declare-option -docstring "store in tmp directory" bool markdown_tmp true 6 | declare-option -hidden str markdown_out_file "" 7 | declare-option -docstring "pdf reader command" str markdown_pdf_reader "open" 8 | declare-option -docstring "pdf reader reset command" str markdown_pdf_reset "pkill -HUP llpp" 9 | 10 | define-command markdown_set_out_file %{ 11 | evaluate-commands %sh{ 12 | if $kak_opt_markdown_tmp; then 13 | dir="/tmp" 14 | filename="output" 15 | else 16 | dir="${kak_buffile%/*}" 17 | filename="${kak_buffile##*/}" 18 | filename="${filename%.*}" 19 | fi 20 | echo "set-option window markdown_out_file $dir/$filename.$kak_opt_markdown_filetype" 21 | } 22 | } 23 | 24 | define-command markdown_open_reader %{ 25 | evaluate-commands %sh{ 26 | ( eval $kak_opt_markdown_pdf_reader $kak_opt_markdown_out_file ) >/dev/null 2>/tmp/err h 33 | evaluate-commands -itersel %{ 34 | execute-keys -save-regs "" y 35 | set-register dquote %sh{ 36 | if [ "$kak_reg_dquote" = " " ]; then 37 | echo "x" 38 | else 39 | echo " " 40 | fi 41 | } 42 | execute-keys R 43 | } 44 | } 45 | } 46 | 47 | define-command enable-markdown-compile %{ 48 | # compile markdown in background on save. 49 | hook window -group markdown-compile BufWritePost .* %{ nop %sh{ ( 50 | pandoc -o $kak_opt_markdown_out_file $kak_buffile && \ 51 | if [ "$kak_opt_markdown_filetype" = "pdf" ]; then 52 | eval "$kak_opt_markdown_pdf_reset" 53 | fi 54 | ) > /dev/null 2>&1 < /dev/null & 55 | }} 56 | markdown_set_out_file 57 | } 58 | 59 | 60 | hook global WinSetOption filetype=markdown %{ 61 | 62 | hook window WinSetOption markdown_tmp=.* %{ 63 | markdown_set_out_file 64 | } 65 | 66 | hook window WinSetOption markdown_filetype=.* %{ 67 | markdown_set_out_file 68 | } 69 | 70 | hook -once global WinSetOption filetype=(?!markdown).* %{ 71 | remove-hooks window markdown-compile 72 | } 73 | 74 | map global insert "****hhi" 75 | map -docstring "Toggle checkbox" buffer user c ": markdown_toggle_checkbox" 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /autoload/pipe-selections.kak: -------------------------------------------------------------------------------- 1 | define-command pipe-selections -params 1.. -override -docstring ' 2 | pipe-selections [] command: Pipe all selections newline delimited through a shell command and return the result in place. 3 | switches: 4 | -delimiter : use the given delimiter instead of a newline. 5 | ' %{ 6 | # Copy current selections to a temporary sort buffer 7 | execute-keys %{"sy} 8 | edit -scratch *pipe-selections* 9 | execute-keys %{"s} 10 | 11 | execute-keys %sh{ 12 | delimiter='\\n' 13 | if [ "$1" == "-delimiter" ]; then 14 | delimiter=$2 15 | shift 16 | shift 17 | fi 18 | echo "printf $delimiterggd" 19 | 20 | # Sort the buffer 21 | echo "%|head -c-1|$@" 22 | # Yank the sorted candidates 23 | delimiter=$(printf $delimiter) 24 | echo "%S$delimiter" 25 | } 26 | execute-keys %{"sy} 27 | 28 | # Update the original buffer 29 | delete-buffer 30 | execute-keys %{"sR} 31 | } 32 | 33 | define-command pipe-selections1 -params 0.. -override %{ 34 | info %sh{ 35 | eval set -- "$kak_quoted_selections" 36 | IFS=$'\0'; echo "$*" | xxd 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /autoload/racket.kak: -------------------------------------------------------------------------------- 1 | hook global BufCreate .*\.([^\.]+)\.(pp|scrbl) %{ 2 | evaluate-commands %sh{ 3 | case $kak_hook_param_capture_2 in 4 | pp) 5 | lang="pollen" 6 | char="◊" 7 | ;; 8 | scrbl) 9 | lang="scribble" 10 | char="@" 11 | ;; 12 | esac 13 | case $kak_hook_param_capture_1 in 14 | md) 15 | sublang="markdown" 16 | ;; 17 | asciidoc) 18 | sublang="asciidoc" 19 | ;; 20 | esac 21 | printf "try %%{ 22 | require-module $sublang 23 | require-module lisp 24 | } 25 | echo -debug %%{$lang} 26 | set buffer filetype $lang 27 | add-highlighter buffer/$sublang ref $sublang 28 | add-highlighter buffer/$lang regions 29 | add-highlighter buffer/$lang/exp region -recurse \( $char\( \) ref lisp 30 | map buffer insert $char" 31 | } 32 | } 33 | 34 | hook global WinSetOption filetype=racket %{ 35 | set window tabstop 2 36 | set window indentwidth 2 37 | } 38 | 39 | hook global WinCreate .*\.rkt %{ 40 | set buffer filetype lisp 41 | set buffer indentwidth 2 42 | } 43 | -------------------------------------------------------------------------------- /autoload/regex.kak: -------------------------------------------------------------------------------- 1 | define-command select-ip %{ 2 | execute-keys 's\d{,3}\.\d{,3}\.\d{,3}\.\d{,3}' 3 | } 4 | -------------------------------------------------------------------------------- /autoload/remaps.kak: -------------------------------------------------------------------------------- 1 | # Swap word and WORD commands 2 | # map global normal e 3 | # map global normal E 4 | # map global normal e 5 | # map global normal E 6 | # map global normal w 7 | # map global normal W 8 | # map global normal w 9 | # map global normal W 10 | # map global normal b 11 | # map global normal B 12 | # map global normal b 13 | # map global normal B 14 | 15 | # Select whole lines when moving selection with J or K 16 | map global normal J Jx 17 | map global normal K Kx 18 | 19 | # Make I insert before every line 20 | map global normal I "I" 21 | # Make A insert after every line 22 | map global normal A "A" 23 | 24 | # Swap escape and comma 25 | #map global normal , 26 | #map global normal 27 | #map global normal , 28 | map global normal 29 | map global normal 30 | 31 | # swap f and d 32 | map global normal 33 | map global normal 34 | 35 | # Give []{} a useful purpose 36 | # map global normal [ 37 | # map global normal ] 38 | # map global normal { 10k 39 | # map global normal } 10j 40 | 41 | # Better x 42 | #map global normal x 43 | #map global normal gi 44 | -------------------------------------------------------------------------------- /autoload/rsync.kak: -------------------------------------------------------------------------------- 1 | hook global BufCreate .*\.rsync-filter %{ 2 | set-option buffer filetype rsync 3 | } 4 | 5 | hook global WinSetOption filetype=rsync %{ 6 | map window normal %{|xargs -I{} find "{}/" -maxdepth 1} 7 | hook -always -once global WinSetOption filetype=.* %{ 8 | unmap window normal 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /autoload/shell.kak: -------------------------------------------------------------------------------- 1 | define-command -params .. shell -docstring %(shell []… []…: Execute shell command 2 | 3 | Switches: 4 | -export : Export variable) %{ nop %sh{ 5 | # Ensure Kakoune sets these variables by making them appear in the source: 6 | # – kak_session 7 | # – kak_client 8 | # – kak_buffile 9 | while [ "$1" ]; do 10 | case $1 in 11 | -export) 12 | export="$export $2" 13 | shift 14 | ;; 15 | *) 16 | break 17 | ;; 18 | esac 19 | shift 20 | done 21 | for variable in $export; do 22 | key=$(echo kak_$variable | tr [:lower:] [:upper:]) 23 | value=kak_$variable 24 | eval export $key='$'$value 25 | done 26 | ("$@") < /dev/null > /dev/null 2>&1 & 27 | }} 28 | -------------------------------------------------------------------------------- /autoload/solidity.kak: -------------------------------------------------------------------------------- 1 | hook global BufCreate .*\.sol %{ 2 | set buffer filetype solidity 3 | } 4 | 5 | add-highlighter shared/solidity regions 6 | add-highlighter shared/solidity/code default-region group 7 | 8 | add-highlighter shared/solidity/code/ regex "\b(abstract|anonymous|as|assembly|break|case|catch|constant|continue|default|delete|do|else|emit|enum|external|final|for|function|if|import|in|indexed|inline|interface|internal|is|let|match|memory|modifier|new|of|payable|pragma|private|public|pure|relocatable|return|returns|static|storage|struct|throw|try|type|typeof|using|var|view|while|contract|library|interface|function)\b" 0:keyword 9 | 10 | add-highlighter shared/solidity/code/ regex "\b(true|false|wei|szabo|finney|ether|seconds|minutes|hours|days|weeks|years|now|block|msg|now|tx|sha3|keccak256|sha256|ripemd160|ecerecover|addmod|mulmod|this|super|selfdestruct)\b" 0:value 11 | 12 | add-highlighter shared/solidity/code/ regex "\b(mapping|address|bool|int|int8|int16|int24|int32|int40|int48|int56|int64|int72|int80|int88|int96|int104|int112|int120|int128|int136|int144|int152|int160|int168|int178|int184|int192|int200|int208|int216|int224|int232|int240|int248|int256|uint|uint8|uint16|uint24|uint32|uint40|uint48|uint56|uint64|uint72|uint80|uint88|uint96|uint104|uint112|uint120|uint128|uint136|uint144|uint152|uint160|uint168|uint178|uint184|uint192|uint200|uint208|uint216|uint224|uint232|uint240|uint248|uint256|fixed|fixed0x8|fixed0x16|fixed0x24|fixed0x32|fixed0x40|fixed0x48|fixed0x56|fixed0x64|fixed0x72|fixed0x80|fixed0x88|fixed0x96|fixed0x104|fixed0x112|fixed0x120|fixed0x128|fixed0x136|fixed0x144|fixed0x152|fixed0x160|fixed0x168|fixed0x178|fixed0x184|fixed0x192|fixed0x200|fixed0x208|fixed0x216|fixed0x224|fixed0x232|fixed0x240|fixed0x248|fixed0x256|fixed8x8|fixed8x16|fixed8x24|fixed8x32|fixed8x40|fixed8x48|fixed8x56|fixed8x64|fixed8x72|fixed8x80|fixed8x88|fixed8x96|fixed8x104|fixed8x112|fixed8x120|fixed8x128|fixed8x136|fixed8x144|fixed8x152|fixed8x160|fixed8x168|fixed8x178|fixed8x184|fixed8x192|fixed8x200|fixed8x208|fixed8x216|fixed8x224|fixed8x232|fixed8x240|fixed8x248|fixed16x8|fixed16x16|fixed16x24|fixed16x32|fixed16x40|fixed16x48|fixed16x56|fixed16x64|fixed16x72|fixed16x80|fixed16x88|fixed16x96|fixed16x104|fixed16x112|fixed16x120|fixed16x128|fixed16x136|fixed16x144|fixed16x152|fixed16x160|fixed16x168|fixed16x178|fixed16x184|fixed16x192|fixed16x200|fixed16x208|fixed16x216|fixed16x224|fixed16x232|fixed16x240|fixed24x8|fixed24x16|fixed24x24|fixed24x32|fixed24x40|fixed24x48|fixed24x56|fixed24x64|fixed24x72|fixed24x80|fixed24x88|fixed24x96|fixed24x104|fixed24x112|fixed24x120|fixed24x128|fixed24x136|fixed24x144|fixed24x152|fixed24x160|fixed24x168|fixed24x178|fixed24x184|fixed24x192|fixed24x200|fixed24x208|fixed24x216|fixed24x224|fixed24x232|fixed32x8|fixed32x16|fixed32x24|fixed32x32|fixed32x40|fixed32x48|fixed32x56|fixed32x64|fixed32x72|fixed32x80|fixed32x88|fixed32x96|fixed32x104|fixed32x112|fixed32x120|fixed32x128|fixed32x136|fixed32x144|fixed32x152|fixed32x160|fixed32x168|fixed32x178|fixed32x184|fixed32x192|fixed32x200|fixed32x208|fixed32x216|fixed32x224|fixed40x8|fixed40x16|fixed40x24|fixed40x32|fixed40x40|fixed40x48|fixed40x56|fixed40x64|fixed40x72|fixed40x80|fixed40x88|fixed40x96|fixed40x104|fixed40x112|fixed40x120|fixed40x128|fixed40x136|fixed40x144|fixed40x152|fixed40x160|fixed40x168|fixed40x178|fixed40x184|fixed40x192|fixed40x200|fixed40x208|fixed40x216|fixed48x8|fixed48x16|fixed48x24|fixed48x32|fixed48x40|fixed48x48|fixed48x56|fixed48x64|fixed48x72|fixed48x80|fixed48x88|fixed48x96|fixed48x104|fixed48x112|fixed48x120|fixed48x128|fixed48x136|fixed48x144|fixed48x152|fixed48x160|fixed48x168|fixed48x178|fixed48x184|fixed48x192|fixed48x200|fixed48x208|fixed56x8|fixed56x16|fixed56x24|fixed56x32|fixed56x40|fixed56x48|fixed56x56|fixed56x64|fixed56x72|fixed56x80|fixed56x88|fixed56x96|fixed56x104|fixed56x112|fixed56x120|fixed56x128|fixed56x136|fixed56x144|fixed56x152|fixed56x160|fixed56x168|fixed56x178|fixed56x184|fixed56x192|fixed56x200|fixed64x8|fixed64x16|fixed64x24|fixed64x32|fixed64x40|fixed64x48|fixed64x56|fixed64x64|fixed64x72|fixed64x80|fixed64x88|fixed64x96|fixed64x104|fixed64x112|fixed64x120|fixed64x128|fixed64x136|fixed64x144|fixed64x152|fixed64x160|fixed64x168|fixed64x178|fixed64x184|fixed64x192|fixed72x8|fixed72x16|fixed72x24|fixed72x32|fixed72x40|fixed72x48|fixed72x56|fixed72x64|fixed72x72|fixed72x80|fixed72x88|fixed72x96|fixed72x104|fixed72x112|fixed72x120|fixed72x128|fixed72x136|fixed72x144|fixed72x152|fixed72x160|fixed72x168|fixed72x178|fixed72x184|fixed80x8|fixed80x16|fixed80x24|fixed80x32|fixed80x40|fixed80x48|fixed80x56|fixed80x64|fixed80x72|fixed80x80|fixed80x88|fixed80x96|fixed80x104|fixed80x112|fixed80x120|fixed80x128|fixed80x136|fixed80x144|fixed80x152|fixed80x160|fixed80x168|fixed80x178|fixed88x8|fixed88x16|fixed88x24|fixed88x32|fixed88x40|fixed88x48|fixed88x56|fixed88x64|fixed88x72|fixed88x80|fixed88x88|fixed88x96|fixed88x104|fixed88x112|fixed88x120|fixed88x128|fixed88x136|fixed88x144|fixed88x152|fixed88x160|fixed88x168|fixed96x8|fixed96x16|fixed96x24|fixed96x32|fixed96x40|fixed96x48|fixed96x56|fixed96x64|fixed96x72|fixed96x80|fixed96x88|fixed96x96|fixed96x104|fixed96x112|fixed96x120|fixed96x128|fixed96x136|fixed96x144|fixed96x152|fixed96x160|fixed104x8|fixed104x16|fixed104x24|fixed104x32|fixed104x40|fixed104x48|fixed104x56|fixed104x64|fixed104x72|fixed104x80|fixed104x88|fixed104x96|fixed104x104|fixed104x112|fixed104x120|fixed104x128|fixed104x136|fixed104x144|fixed104x152|fixed112x8|fixed112x16|fixed112x24|fixed112x32|fixed112x40|fixed112x48|fixed112x56|fixed112x64|fixed112x72|fixed112x80|fixed112x88|fixed112x96|fixed112x104|fixed112x112|fixed112x120|fixed112x128|fixed112x136|fixed112x144|fixed120x8|fixed120x16|fixed120x24|fixed120x32|fixed120x40|fixed120x48|fixed120x56|fixed120x64|fixed120x72|fixed120x80|fixed120x88|fixed120x96|fixed120x104|fixed120x112|fixed120x120|fixed120x128|fixed120x136|fixed128x8|fixed128x16|fixed128x24|fixed128x32|fixed128x40|fixed128x48|fixed128x56|fixed128x64|fixed128x72|fixed128x80|fixed128x88|fixed128x96|fixed128x104|fixed128x112|fixed128x120|fixed128x128|fixed136x8|fixed136x16|fixed136x24|fixed136x32|fixed136x40|fixed136x48|fixed136x56|fixed136x64|fixed136x72|fixed136x80|fixed136x88|fixed136x96|fixed136x104|fixed136x112|fixed136x120|fixed144x8|fixed144x16|fixed144x24|fixed144x32|fixed144x40|fixed144x48|fixed144x56|fixed144x64|fixed144x72|fixed144x80|fixed144x88|fixed144x96|fixed144x104|fixed144x112|fixed152x8|fixed152x16|fixed152x24|fixed152x32|fixed152x40|fixed152x48|fixed152x56|fixed152x64|fixed152x72|fixed152x80|fixed152x88|fixed152x96|fixed152x104|fixed160x8|fixed160x16|fixed160x24|fixed160x32|fixed160x40|fixed160x48|fixed160x56|fixed160x64|fixed160x72|fixed160x80|fixed160x88|fixed160x96|fixed168x8|fixed168x16|fixed168x24|fixed168x32|fixed168x40|fixed168x48|fixed168x56|fixed168x64|fixed168x72|fixed168x80|fixed168x88|fixed176x8|fixed176x16|fixed176x24|fixed176x32|fixed176x40|fixed176x48|fixed176x56|fixed176x64|fixed176x72|fixed176x80|fixed184x8|fixed184x16|fixed184x24|fixed184x32|fixed184x40|fixed184x48|fixed184x56|fixed184x64|fixed184x72|fixed192x8|fixed192x16|fixed192x24|fixed192x32|fixed192x40|fixed192x48|fixed192x56|fixed192x64|fixed200x8|fixed200x16|fixed200x24|fixed200x32|fixed200x40|fixed200x48|fixed200x56|fixed208x8|fixed208x16|fixed208x24|fixed208x32|fixed208x40|fixed208x48|fixed216x8|fixed216x16|fixed216x24|fixed216x32|fixed216x40|fixed224x8|fixed224x16|fixed224x24|fixed224x32|fixed232x8|fixed232x16|fixed232x24|fixed240x8|fixed240x16|fixed248x8|ufixed|ufixed0x8|ufixed0x16|ufixed0x24|ufixed0x32|ufixed0x40|ufixed0x48|ufixed0x56|ufixed0x64|ufixed0x72|ufixed0x80|ufixed0x88|ufixed0x96|ufixed0x104|ufixed0x112|ufixed0x120|ufixed0x128|ufixed0x136|ufixed0x144|ufixed0x152|ufixed0x160|ufixed0x168|ufixed0x178|ufixed0x184|ufixed0x192|ufixed0x200|ufixed0x208|ufixed0x216|ufixed0x224|ufixed0x232|ufixed0x240|ufixed0x248|ufixed0x256|ufixed8x8|ufixed8x16|ufixed8x24|ufixed8x32|ufixed8x40|ufixed8x48|ufixed8x56|ufixed8x64|ufixed8x72|ufixed8x80|ufixed8x88|ufixed8x96|ufixed8x104|ufixed8x112|ufixed8x120|ufixed8x128|ufixed8x136|ufixed8x144|ufixed8x152|ufixed8x160|ufixed8x168|ufixed8x178|ufixed8x184|ufixed8x192|ufixed8x200|ufixed8x208|ufixed8x216|ufixed8x224|ufixed8x232|ufixed8x240|ufixed8x248|ufixed16x8|ufixed16x16|ufixed16x24|ufixed16x32|ufixed16x40|ufixed16x48|ufixed16x56|ufixed16x64|ufixed16x72|ufixed16x80|ufixed16x88|ufixed16x96|ufixed16x104|ufixed16x112|ufixed16x120|ufixed16x128|ufixed16x136|ufixed16x144|ufixed16x152|ufixed16x160|ufixed16x168|ufixed16x178|ufixed16x184|ufixed16x192|ufixed16x200|ufixed16x208|ufixed16x216|ufixed16x224|ufixed16x232|ufixed16x240|ufixed24x8|ufixed24x16|ufixed24x24|ufixed24x32|ufixed24x40|ufixed24x48|ufixed24x56|ufixed24x64|ufixed24x72|ufixed24x80|ufixed24x88|ufixed24x96|ufixed24x104|ufixed24x112|ufixed24x120|ufixed24x128|ufixed24x136|ufixed24x144|ufixed24x152|ufixed24x160|ufixed24x168|ufixed24x178|ufixed24x184|ufixed24x192|ufixed24x200|ufixed24x208|ufixed24x216|ufixed24x224|ufixed24x232|ufixed32x8|ufixed32x16|ufixed32x24|ufixed32x32|ufixed32x40|ufixed32x48|ufixed32x56|ufixed32x64|ufixed32x72|ufixed32x80|ufixed32x88|ufixed32x96|ufixed32x104|ufixed32x112|ufixed32x120|ufixed32x128|ufixed32x136|ufixed32x144|ufixed32x152|ufixed32x160|ufixed32x168|ufixed32x178|ufixed32x184|ufixed32x192|ufixed32x200|ufixed32x208|ufixed32x216|ufixed32x224|ufixed40x8|ufixed40x16|ufixed40x24|ufixed40x32|ufixed40x40|ufixed40x48|ufixed40x56|ufixed40x64|ufixed40x72|ufixed40x80|ufixed40x88|ufixed40x96|ufixed40x104|ufixed40x112|ufixed40x120|ufixed40x128|ufixed40x136|ufixed40x144|ufixed40x152|ufixed40x160|ufixed40x168|ufixed40x178|ufixed40x184|ufixed40x192|ufixed40x200|ufixed40x208|ufixed40x216|ufixed48x8|ufixed48x16|ufixed48x24|ufixed48x32|ufixed48x40|ufixed48x48|ufixed48x56|ufixed48x64|ufixed48x72|ufixed48x80|ufixed48x88|ufixed48x96|ufixed48x104|ufixed48x112|ufixed48x120|ufixed48x128|ufixed48x136|ufixed48x144|ufixed48x152|ufixed48x160|ufixed48x168|ufixed48x178|ufixed48x184|ufixed48x192|ufixed48x200|ufixed48x208|ufixed56x8|ufixed56x16|ufixed56x24|ufixed56x32|ufixed56x40|ufixed56x48|ufixed56x56|ufixed56x64|ufixed56x72|ufixed56x80|ufixed56x88|ufixed56x96|ufixed56x104|ufixed56x112|ufixed56x120|ufixed56x128|ufixed56x136|ufixed56x144|ufixed56x152|ufixed56x160|ufixed56x168|ufixed56x178|ufixed56x184|ufixed56x192|ufixed56x200|ufixed64x8|ufixed64x16|ufixed64x24|ufixed64x32|ufixed64x40|ufixed64x48|ufixed64x56|ufixed64x64|ufixed64x72|ufixed64x80|ufixed64x88|ufixed64x96|ufixed64x104|ufixed64x112|ufixed64x120|ufixed64x128|ufixed64x136|ufixed64x144|ufixed64x152|ufixed64x160|ufixed64x168|ufixed64x178|ufixed64x184|ufixed64x192|ufixed72x8|ufixed72x16|ufixed72x24|ufixed72x32|ufixed72x40|ufixed72x48|ufixed72x56|ufixed72x64|ufixed72x72|ufixed72x80|ufixed72x88|ufixed72x96|ufixed72x104|ufixed72x112|ufixed72x120|ufixed72x128|ufixed72x136|ufixed72x144|ufixed72x152|ufixed72x160|ufixed72x168|ufixed72x178|ufixed72x184|ufixed80x8|ufixed80x16|ufixed80x24|ufixed80x32|ufixed80x40|ufixed80x48|ufixed80x56|ufixed80x64|ufixed80x72|ufixed80x80|ufixed80x88|ufixed80x96|ufixed80x104|ufixed80x112|ufixed80x120|ufixed80x128|ufixed80x136|ufixed80x144|ufixed80x152|ufixed80x160|ufixed80x168|ufixed80x178|ufixed88x8|ufixed88x16|ufixed88x24|ufixed88x32|ufixed88x40|ufixed88x48|ufixed88x56|ufixed88x64|ufixed88x72|ufixed88x80|ufixed88x88|ufixed88x96|ufixed88x104|ufixed88x112|ufixed88x120|ufixed88x128|ufixed88x136|ufixed88x144|ufixed88x152|ufixed88x160|ufixed88x168|ufixed96x8|ufixed96x16|ufixed96x24|ufixed96x32|ufixed96x40|ufixed96x48|ufixed96x56|ufixed96x64|ufixed96x72|ufixed96x80|ufixed96x88|ufixed96x96|ufixed96x104|ufixed96x112|ufixed96x120|ufixed96x128|ufixed96x136|ufixed96x144|ufixed96x152|ufixed96x160|ufixed104x8|ufixed104x16|ufixed104x24|ufixed104x32|ufixed104x40|ufixed104x48|ufixed104x56|ufixed104x64|ufixed104x72|ufixed104x80|ufixed104x88|ufixed104x96|ufixed104x104|ufixed104x112|ufixed104x120|ufixed104x128|ufixed104x136|ufixed104x144|ufixed104x152|ufixed112x8|ufixed112x16|ufixed112x24|ufixed112x32|ufixed112x40|ufixed112x48|ufixed112x56|ufixed112x64|ufixed112x72|ufixed112x80|ufixed112x88|ufixed112x96|ufixed112x104|ufixed112x112|ufixed112x120|ufixed112x128|ufixed112x136|ufixed112x144|ufixed120x8|ufixed120x16|ufixed120x24|ufixed120x32|ufixed120x40|ufixed120x48|ufixed120x56|ufixed120x64|ufixed120x72|ufixed120x80|ufixed120x88|ufixed120x96|ufixed120x104|ufixed120x112|ufixed120x120|ufixed120x128|ufixed120x136|ufixed128x8|ufixed128x16|ufixed128x24|ufixed128x32|ufixed128x40|ufixed128x48|ufixed128x56|ufixed128x64|ufixed128x72|ufixed128x80|ufixed128x88|ufixed128x96|ufixed128x104|ufixed128x112|ufixed128x120|ufixed128x128|ufixed136x8|ufixed136x16|ufixed136x24|ufixed136x32|ufixed136x40|ufixed136x48|ufixed136x56|ufixed136x64|ufixed136x72|ufixed136x80|ufixed136x88|ufixed136x96|ufixed136x104|ufixed136x112|ufixed136x120|ufixed144x8|ufixed144x16|ufixed144x24|ufixed144x32|ufixed144x40|ufixed144x48|ufixed144x56|ufixed144x64|ufixed144x72|ufixed144x80|ufixed144x88|ufixed144x96|ufixed144x104|ufixed144x112|ufixed152x8|ufixed152x16|ufixed152x24|ufixed152x32|ufixed152x40|ufixed152x48|ufixed152x56|ufixed152x64|ufixed152x72|ufixed152x80|ufixed152x88|ufixed152x96|ufixed152x104|ufixed160x8|ufixed160x16|ufixed160x24|ufixed160x32|ufixed160x40|ufixed160x48|ufixed160x56|ufixed160x64|ufixed160x72|ufixed160x80|ufixed160x88|ufixed160x96|ufixed168x8|ufixed168x16|ufixed168x24|ufixed168x32|ufixed168x40|ufixed168x48|ufixed168x56|ufixed168x64|ufixed168x72|ufixed168x80|ufixed168x88|ufixed176x8|ufixed176x16|ufixed176x24|ufixed176x32|ufixed176x40|ufixed176x48|ufixed176x56|ufixed176x64|ufixed176x72|ufixed176x80|ufixed184x8|ufixed184x16|ufixed184x24|ufixed184x32|ufixed184x40|ufixed184x48|ufixed184x56|ufixed184x64|ufixed184x72|ufixed192x8|ufixed192x16|ufixed192x24|ufixed192x32|ufixed192x40|ufixed192x48|ufixed192x56|ufixed192x64|ufixed200x8|ufixed200x16|ufixed200x24|ufixed200x32|ufixed200x40|ufixed200x48|ufixed200x56|ufixed208x8|ufixed208x16|ufixed208x24|ufixed208x32|ufixed208x40|ufixed208x48|ufixed216x8|ufixed216x16|ufixed216x24|ufixed216x32|ufixed216x40|ufixed224x8|ufixed224x16|ufixed224x24|ufixed224x32|ufixed232x8|ufixed232x16|ufixed232x24|ufixed240x8|ufixed240x16|ufixed248x8|string|string1|string2|string3|string4|string5|string6|string7|string8|string9|string10|string11|string12|string13|string14|string15|string16|string17|string18|string19|string20|string21|string22|string23|string24|string25|string26|string27|string28|string29|string30|string31|string32|byte|bytes|bytes1|bytes2|bytes3|bytes4|bytes5|bytes6|bytes7|bytes8|bytes9|bytes10|bytes11|bytes12|bytes13|bytes14|bytes15|bytes16|bytes17|bytes18|bytes19|bytes20|bytes21|bytes22|bytes23|bytes24|bytes25|bytes26|bytes27|bytes28|bytes29|bytes30|bytes31|bytes32)\b" 0:type 13 | 14 | add-highlighter shared/solidity/code/ regex "(!|\||&|\+|-|<|>|=|%|/|\*|~|\^)" 0:operator 15 | # number 16 | add-highlighter shared/solidity/code/ regex "-?\d+|0[xX]\d+?" 0:value 17 | # float 18 | add-highlighter shared/solidity/code/ regex "-?(\d+\.\d+|\d+\.|\.\d+)([eE][+-]?\d+)?" 0:value 19 | 20 | # strings 21 | add-highlighter shared/solidity/double_string region %{"} %{"} fill string 22 | add-highlighter shared/solidity/single_string region %{'} %{'} fill string 23 | add-highlighter shared/solidity/comment region /\* \*/ fill comment 24 | add-highlighter shared/solidity/line_comment region // $ fill comment 25 | 26 | add-highlighter shared/solidity/code/ regex "\b(require|revert|send|transfer|call)\b" 0:function 27 | 28 | hook -group solidity-highlight global WinSetOption filetype=solidity %{ 29 | add-highlighter window/ ref solidity 30 | hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/solidity } 31 | } 32 | -------------------------------------------------------------------------------- /autoload/speedrun.kak: -------------------------------------------------------------------------------- 1 | declare-option str speedrun_character 2 | declare-option str speedrun_file "/tmp/srb2_speedrun_time" 3 | 4 | hook global WinCreate (.*\.speedrun|.*speedruns) %[ 5 | set-option window filetype speedrun 6 | ] 7 | 8 | hook global WinSetOption filetype=speedrun %| 9 | map window normal ': speedrun-select' 10 | map window normal ] ': speedrun-next-section' 11 | map window normal [ ': speedrun-previous-section' 12 | map window normal f ': speedrun-read-file' 13 | hook window ModeChange push:insert:normal %[ 14 | evaluate-commands -draft write 15 | ] 16 | | 17 | 18 | define-command speedrun-next-section %{ 19 | execute-keys ]pjj 20 | speedrun-find-character 21 | } 22 | 23 | define-command speedrun-previous-section %{ 24 | execute-keys [p[pj 25 | speedrun-find-character 26 | } 27 | 28 | define-command -hidden speedrun-find-character %{ 29 | try %{ 30 | evaluate-commands %sh{ 31 | if [ -z $kak_opt_speedrun_character ]; then 32 | echo fail 33 | fi 34 | } 35 | set-register / "- %opt{speedrun_character}" 36 | execute-keys psgi 37 | } 38 | } 39 | 40 | define-command -hidden speedrun-select %{ 41 | evaluate-commands -draft -save-regs '"' %{ 42 | execute-keys -save-regs "" gilley 43 | set-option window speedrun_character %reg{dquote} 44 | } 45 | execute-keys gif:llGl 46 | } 47 | 48 | define-command speedrun-read-file %{ 49 | evaluate-commands %sh{ 50 | . "$kak_opt_speedrun_file" 51 | echo "try %{" 52 | echo "set-register / %{(?i)$map}" 53 | echo "execute-keys /" 54 | echo "set-register / %{\\\\b$skin\\\\b}" 55 | echo "execute-keys ps" 56 | echo "speedrun-select" 57 | echo "}" 58 | echo "set-register dquote %{$time}" 59 | echo "info %{Time: $time}" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /autoload/termshot.kak: -------------------------------------------------------------------------------- 1 | define-command termshot-highlight %{ 2 | # Surround with highlighting tags 3 | execute-keys _ 4 | evaluate-commands -save-regs '"' %{ 5 | set-register dquote '' 6 | execute-keys P 7 | set-register dquote '' 8 | execute-keys p 9 | } 10 | } 11 | 12 | hook global BufSetOption filetype=termshot %{ 13 | map -docstring "Highlight" buffer user h ": termshot-highlight" 14 | } 15 | 16 | hook global WinCreate "/private/var/folders.*termshot\d*" %{ 17 | set-option buffer filetype termshot 18 | } 19 | -------------------------------------------------------------------------------- /autoload/tmux.kak: -------------------------------------------------------------------------------- 1 | hook global ModuleLoaded tmux %[ 2 | 3 | define-command tmux-next-vertical %{ 4 | alias global terminal tmux-terminal-vertical 5 | alias global repl-new tmux-repl-vertical 6 | } 7 | 8 | define-command tmux-next-horizontal %{ 9 | alias global terminal tmux-terminal-horizontal 10 | alias global repl-new tmux-repl-horizontal 11 | } 12 | 13 | define-command tmux-new-horizontal -params .. %{ 14 | tmux-next-horizontal 15 | new %arg{@} 16 | } 17 | 18 | define-command tmux-new-vertical -params .. %{ 19 | tmux-next-vertical 20 | new %arg{@} 21 | } 22 | 23 | alias global tmux-v tmux-next-vertical 24 | alias global tmux-h tmux-next-horizontal 25 | alias global new-h tmux-new-horizontal 26 | alias global new-v tmux-new-vertical 27 | 28 | ] 29 | -------------------------------------------------------------------------------- /autoload/util.kak: -------------------------------------------------------------------------------- 1 | define-command today %{ 2 | execute-keys '| date +"%d-%m-%Y"' 3 | } 4 | 5 | define-command base64 -params ..1 -docstring "base64 [image]"%{ 6 | execute-keys '| xargs cat | base64' 7 | evaluate-commands %sh{ 8 | if [ "$1" = "image" ]; then 9 | echo "set-register dquote %{data:image/png;base64,}" 10 | echo "execute-keys P" 11 | fi 12 | } 13 | } 14 | 15 | define-command vscode -docstring "Open current file in visual studio code" %{ 16 | nop %sh{code -g $kak_buffile:$kak_cursor_line:$kak_cursor_column} 17 | } 18 | -------------------------------------------------------------------------------- /autoload/visual_studio.kak: -------------------------------------------------------------------------------- 1 | define-command visual-studio-mappings %{ 2 | map -docstring "Open in visual studio" global user v %{:nop %sh{open_in_vs $kak_buffile}} 3 | } 4 | -------------------------------------------------------------------------------- /autoload/woordenboek.kak: -------------------------------------------------------------------------------- 1 | define-command -hidden woordenboek-impl -params 2 %{ 2 | require-module fzf 3 | fzf -items-cmd "woordenboek %arg{1} %arg{2}" -kak-cmd "set-register dquote" 4 | } 5 | 6 | define-command rijmwoorden -params 1 %{ 7 | woordenboek-impl rijmwoorden %arg{1} 8 | } 9 | 10 | define-command synoniemen -params 1 %{ 11 | woordenboek-impl synoniemen %arg{1} 12 | } 13 | 14 | define-command woordenboek-mappings %{ 15 | require-module fzf 16 | set-option buffer fzf_use_main_selection false 17 | set-option buffer fzf_preview_tmux_height 100% 18 | set-option buffer fzf_tmux_height 100% 19 | map -docstring "Rijmwoorden" buffer user r %{: rijmwoorden %val{selection}} 20 | map -docstring "Synoniemen" buffer user s %{: synoniemen %val{selection}} 21 | } 22 | -------------------------------------------------------------------------------- /autoload/wordcount.kak: -------------------------------------------------------------------------------- 1 | define-command wordcount %{ 2 | evaluate-commands %sh{ 3 | words=$(echo "$kak_selection" | wc -w) 4 | echo info $words 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /bin/editor: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Wrapper around kakoune to automatically connect to a currently active session 3 | # or create a new one. 4 | # Also has some other tricks like opening standard input as a tmp file. 5 | # 6 | # Clear old sessions 7 | 8 | if [ ! -z "$KAKOUNE_CLIENT" ]; then 9 | kak_client="$KAKOUNE_CLIENT" 10 | fi 11 | if [ ! -z "$KAKOUNE_SESSION" ]; then 12 | kak_session="$KAKOUNE_SESSION" 13 | fi 14 | kak -clear 15 | TEMPDIR="/tmp/kak-temp" 16 | args=() 17 | # Open either in a new window or just in a new buffer 18 | open_command="open-in-new-window" 19 | # Handle command line arguments 20 | for arg in "$@"; do 21 | if [ "$arg" == "-t" ]; then 22 | # In terminal, so no new windows 23 | in_terminal=true 24 | open_command="edit" 25 | else 26 | args+=("$arg") 27 | fi 28 | done 29 | # if there is standard input create a new file and open that 30 | read -r -t 0.01 -d '' input 31 | if [ -n "$input" ]; then 32 | mkdir -p $TEMPDIR 33 | temp=$(mktemp -p $TEMPDIR) 34 | echo "$input" > "$temp" 35 | args+=("$temp") 36 | fi 37 | # If no session exists, set the session to the default session 38 | if [ -z $kak_session ]; then 39 | kak_session="default" 40 | fi 41 | # if no session with name $kak_session does not exist create one 42 | if ! kak -l | grep "$kak_session" > /dev/null 2>&1; then 43 | { kak -s $kak_session -d & } >/dev/null 2>&1 w 39 | 40 | # remap grep-jump 41 | map global goto "" 42 | 43 | # vim old habits 44 | map global normal D 'd' -docstring 'delete to end of line' 45 | map global normal Y 'y' -docstring 'yank to end of line' 46 | map global normal Gi 47 | 48 | # case insensitive search 49 | map global prompt "(?i)" 50 | 51 | # user mappings 52 | # map global user l -docstring 'lsp' ': enter-user-mode lsp' 53 | 54 | define-command paste %{ 55 | evaluate-commands -save-regs ^ %{ 56 | #Paste 57 | execute-keys "!xclip -selection clipboard -o" 58 | #Select 59 | execute-keys uU 60 | #Save selection 61 | execute-keys -save-regs "" Z 62 | try %{ 63 | #Remove cariage return before newline 64 | execute-keys "s\r\nhd" 65 | } 66 | try %{ 67 | #Replace cariage return elsewhere with newline 68 | execute-keys "zs\rr" 69 | } 70 | #Restore selection 71 | execute-keys z 72 | } 73 | } 74 | 75 | ## clipboard interaction 76 | map global user p -docstring 'paste from clipboard' ': paste' 77 | map global user y -docstring 'copy to clipboard' 'xclip -selection clipboard' 78 | map global user d -docstring 'cut to clipboard' '|xclip -selection clipboard' 79 | 80 | # format 81 | # map global user f -docstring 'format buffer' ':format' 82 | 83 | define-command comment %{ 84 | try %{ 85 | execute-keys _ 86 | comment-block 87 | } catch comment-line 88 | } 89 | 90 | define-command -hidden ctags-search-word %{ 91 | try %{ 92 | execute-keys w 93 | } 94 | execute-keys ": ctags-search " 95 | } 96 | 97 | # comment lines 98 | map global user c -docstring 'comment lines' %{: comment} 99 | 100 | # search with c tags 101 | map global goto s -docstring 'search ctags' %{: ctags-search-word} 102 | 103 | # Delete buffer and quit 104 | map global normal ": db;q" 105 | 106 | # Open file in new window 107 | define-command open-in-new-window -params .. -file-completion %{ new edit "%arg{@}"} 108 | alias global e open-in-new-window 109 | 110 | # Terminal, used by ide wrapper 111 | define-command _terminal -params .. %{ 112 | shell \ 113 | -export session \ 114 | -export client \ 115 | %sh(echo $TERMINAL) -e %arg(@) \ 116 | %sh(test $# = 0 && 117 | echo $SHELL 118 | ) 119 | } 120 | 121 | try %{ 122 | require-module x11 123 | require-module tmux 124 | } 125 | alias global term _terminal 126 | 127 | # Define mappings for when repl is used 128 | define-command repl-mappings -params .. %{ 129 | map buffer normal ": repl-send-text" 130 | repl-new %arg{@} 131 | } 132 | 133 | # file types 134 | hook global BufCreate .*\.xsd %{ set buffer filetype xml } 135 | 136 | # kakoune language server 137 | 138 | # Depends on https://github.com/ul/kak-lsp 139 | # eval %sh{kak-lsp --kakoune -s $kak_session } 140 | # Debug output 141 | # nop %sh{ (kak-lsp -s $kak_session -vvv ) > /tmp/kak-lsp.log 2>&1 < /dev/null & } 142 | # lsp-enable 143 | 144 | # hook global WinSetOption filetype=(rust|python|php|haskell|cpp|latex|c#|racket) %{ 145 | # lsp-enable-window 146 | # #lsp-auto-hover-enable 147 | # set global lsp_hover_anchor true 148 | 149 | # hook window -group semantic-tokens BufReload .* lsp-semantic-tokens 150 | # hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens 151 | # hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens 152 | # hook -once -always window WinSetOption filetype=.* %{ 153 | # remove-hooks window semantic-tokens 154 | # } 155 | # } 156 | 157 | # set-option global lsp_server_configuration latex.build.onSave=true 158 | # set-option -add global lsp_server_configuration latex.build.args=["-pdf","-pdflatex\=lualatex","-interaction\=nonstopmode","-synctex\=1","%f"] 159 | # set-option -add global lsp_server_configuration latex.build.forwardSearchAfter=true 160 | # set-option -add global lsp_server_configuration latex.forwardSearch.executable="okular" 161 | # set-option -add global lsp_server_configuration latex.forwardSearch.args=["--noraise","--unique","file:%p#src:%l%f"] 162 | 163 | #spell 164 | declare-user-mode spell 165 | map global spell a -docstring 'add to dictionary' ": spell-add" 166 | map global spell e -docstring 'enable' ": spell-enable" 167 | map global spell r -docstring 'replace' ": spell-replace" 168 | map global spell n -docstring 'next' ": spell-next" 169 | map global spell c -docstring 'clear' ": spell-clear" 170 | # map global user s -docstring 'spell' ": enter-user-mode -lock spell" 171 | declare-option str language en-GB 172 | define-command spell-enable %{ 173 | #hook global WinSetOption filetype=(latex|markdown|git-commit) %{ 174 | hook window BufWritePost .* %{ 175 | spell %opt{language} 176 | } 177 | #} 178 | } 179 | 180 | # modeline 181 | # set-option global modelinefmt %{{Error}%sh{[ $kak_opt_lsp_diagnostic_error_count -gt 0 ] && echo "$kak_opt_lsp_diagnostic_error_count"}{StatusLineInfo} %sh{ echo $kak_opt_debugger_indicator } {StatusLine}%val{bufname} %val{cursor_line}:%val{cursor_char_column} {{context_info}} {{mode_info}} - %val{client}@[%val{session}]} 182 | set-option global modelinefmt %{ %sh{ echo $kak_opt_debugger_indicator } {StatusLine}%val{bufname} %val{cursor_line}:%val{cursor_char_column} {{context_info}} {{mode_info}} - %val{client}@[%val{session}]} 183 | 184 | # Disable sql highlighting 185 | set global disabled_hooks '(sql-highlight|php-indent|php-trim-indent|php-insert)' 186 | 187 | # Use ripgrep instead of grep 188 | set global grepcmd 'rg -n' 189 | 190 | # Editorconfig 191 | hook global BufOpenFile .* editorconfig-load 192 | hook global BufNewFile .* editorconfig-load 193 | 194 | # Plugins 195 | 196 | source "%val{config}/plugins/kak-bundle/rc/kak-bundle.kak" 197 | set-option global bundle_path "%val{config}/plugins" 198 | 199 | bundle-noload kak-bundle "https://git.sr.ht/~jdugan6240/kak-bundle" 200 | # bundle-noload kak-lsp https://github.com/kak-lsp/kak-lsp %{ 201 | # } %{ 202 | # cargo install --locked --force --path . 203 | # } 204 | bundle kakoune-snippets "https://github.com/occivink/kakoune-snippets" %{ 205 | set-option global snippets_auto_expand false 206 | declare-user-mode snippets 207 | #map global user s -docstring "Snippets" ": enter-user-mode snippets" 208 | map global snippets n -docstring "Select next placeholder" ": snippets-select-next-placeholders" 209 | map global snippets s -docstring "Snippet" ": snippets " 210 | map global snippets i -docstring "Info" ": snippets-info" 211 | 212 | add-highlighter global/ ranges snippets_placeholders 213 | set-option global snippets_directories "%val{config}/autoload/northwave/snippets" 214 | source "%val{config}/snippets.kak" 215 | } 216 | bundle kakoune-sudo-write "https://github.com/occivink/kakoune-sudo-write" 217 | bundle kakoune-extra-filetypes "https://github.com/jjk96/kakoune-extra-filetypes" 218 | bundle prelude "https://github.com/robertmeta/prelude.kak" %{ 219 | bundle connect "https://github.com/jjk96/connect.kak" %{ 220 | #set-option global connect_environment %{ 221 | #export EDITOR=:e 222 | #} 223 | } 224 | } 225 | bundle kakoune-buffers "https://github.com/Delapouite/kakoune-buffers" %{ 226 | map global user b ': enter-user-mode -lock buffers' -docstring 'buffers (lock)…' 227 | } 228 | bundle kakoune-cd 'https://github.com/delapouite/kakoune-cd' %{ 229 | # Suggested aliases 230 | alias global cdb change-directory-current-buffer 231 | alias global cdr change-directory-project-root 232 | alias global ecd edit-current-buffer-directory 233 | alias global pwd print-working-directory 234 | } 235 | bundle kakoune-mirror 'https://github.com/Delapouite/kakoune-mirror' %{ 236 | map global user o -docstring 'mirror' ': enter-user-mode mirror' 237 | map global mirror * -docstring 'stars (markdown bold)' 'i**a**' 238 | map global mirror $ -docstring '$ (latex math)' 'i$a$' 239 | map global mirror . ': enter-user-mode -lock mirror' 240 | } 241 | bundle split-object 'https://github.com/alexherbo2/split-object.kak' %{ 242 | map global normal ': enter-user-mode split-object' 243 | } 244 | bundle kak-ansi 'https://github.com/eraserhd/kak-ansi' 245 | bundle kakoune-emmet 'https://github.com/jjk96/kakoune-emmet' %{ 246 | # hook global WinSetOption filetype=(xml|html|svelte) %{ 247 | # emmet-enable-autocomplete 248 | # } 249 | } 250 | bundle kakoune-python-bridge 'https://github.com/jjk96/kakoune-python-bridge' %{ 251 | # calculate 252 | map global normal = ': python-bridge-sendR' 253 | map global normal ': python-bridge-send' 254 | try %{ 255 | python-bridge-send %{ 256 | from math import * 257 | import struct 258 | import codecs 259 | # Display integers as hex 260 | oldprint = print 261 | def hexon(): 262 | global print 263 | def print(item): 264 | if isinstance(item, int) and not isinstance(item, bool): 265 | oldprint(hex(item)) 266 | else: 267 | oldprint(item) 268 | 269 | def hexoff(): 270 | global print 271 | print = oldprint 272 | 273 | def unhex(val): 274 | oldprint(val) 275 | 276 | def hex_to_long(hex): 277 | return struct.unpack(" ': node-bridge-send' 292 | } 293 | } 294 | bundle kakoune-repl-bridge 'https://github.com/jjk96/kakoune-repl-bridge' %{ 295 | hook global BufSetOption filetype=haskell %{ 296 | map buffer normal = ': repl-bridge haskell sendR' 297 | map buffer normal ': repl-bridge haskell send' 298 | } 299 | } 300 | bundle parinfer-rust "https://github.com/eraserhd/parinfer-rust" %{ 301 | hook global WinSetOption filetype=(clojure|lisp|scheme|racket|pollen|scribble) %{ 302 | parinfer-enable-window -smart 303 | } 304 | } %{ 305 | cargo install --locked --force --path . 306 | } 307 | bundle kakoune-repl-send "https://github.com/jjk96/kakoune-repl-send" %{ 308 | hook global BufSetOption filetype=scheme %{ 309 | map buffer normal ': repl-send' 310 | set buffer repl_send_command "stdbuf -o0 chicken-csi" 311 | set buffer repl_send_exit_command "(exit)" 312 | } 313 | } 314 | bundle kakoune-mark "https://github.com/https://gitlab.com/fsub/kakoune-mark" %{ 315 | declare-user-mode mark 316 | map global mark -docstring "mark word" m ": mark-word" 317 | map global mark -docstring "clear marks" c ": mark-clear" 318 | map global user -docstring "mark" m ": enter-user-mode mark" 319 | } 320 | # bundle tagbar "https://github.com/andreyorst/tagbar.kak" %{ 321 | # hook global ModuleLoaded tagbar %{ 322 | # set-option global tagbar_sort false 323 | # set-option global tagbar_size 40 324 | # set-option global tagbar_display_anon false 325 | # set-option global tagbar_display_anon true 326 | # } 327 | # # if you have wrap highlighter enamled in you configuration 328 | # # files it's better to turn it off for tagbar, using this hook: 329 | # hook global WinSetOption filetype=tagbar %{ 330 | # remove-highlighter window/wrap 331 | # # you can also disable rendering whitespaces here, line numbers, and 332 | # # matching characters 333 | # } 334 | # } 335 | bundle kakoune-palette 'https://github.com/delapouite/kakoune-palette' 336 | bundle kakoune-edit-or-dir 'https://github.com/TeddyDD/kakoune-edit-or-dir' 337 | bundle kakoune-rainbow 'https://github.com/jjk96/kakoune-rainbow' 338 | bundle kakoune-find 'https://github.com/occivink/kakoune-find' 339 | bundle kakoune-table "https://gitlab.com/listentolist/kakoune-table" 340 | bundle fzf.kak "https://github.com/andreyorst/fzf.kak" %{ 341 | map global user f -docstring "fzf" ': fzf-mode' 342 | } 343 | bundle kakoune-racket "https://bitbucket.org/KJ_Duncan/kakoune-racket.kak" 344 | bundle kaktree "https://github.com/JJK96/kaktree" %{ 345 | define-command kaktree--left-action %{ 346 | evaluate-commands -save-regs "/" %{ 347 | # Check if the current directory is open 348 | set-register "/" %opt{kaktree_dir_icon_open} 349 | try %{ 350 | execute-keys xs 351 | } catch %{ 352 | execute-keys ik 353 | } 354 | kaktree--tab-action 355 | } 356 | } 357 | hook global WinSetOption filetype=kaktree %{ 358 | remove-highlighter buffer/numbers 359 | remove-highlighter buffer/matching 360 | remove-highlighter buffer/wrap 361 | remove-highlighter buffer/show-whitespaces 362 | # t toggles keeping focus 363 | map buffer normal t ': set buffer kaktree_keep_focus %sh{[ "$kak_opt_kaktree_keep_focus" = true ] && echo false || echo true ]}' 364 | map buffer normal ': kaktree--left-action' 365 | map buffer normal ': kaktree--tab-action' 366 | } 367 | kaktree-enable 368 | set-option global kaktree_double_click_duration '0.5' 369 | set-option global kaktree_indentation 2 370 | set-option global kaktree_dir_icon_open '▾ 📂' 371 | set-option global kaktree_dir_icon_close '▸ 📁' 372 | set-option global kaktree_file_icon '⠀⠀📄' 373 | set-option global kaktree_tab_open_file true 374 | } 375 | bundle kakoune-buffer-switcher "https://github.com/occivink/kakoune-buffer-switcher" 376 | 377 | # Overwrites colors defined in kak-lsp 378 | colorscheme gruvbox 379 | -------------------------------------------------------------------------------- /not_loaded/fifo.kak: -------------------------------------------------------------------------------- 1 | define-command -params .. fifo %{ evaluate-commands %sh{ 2 | output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-fifo.XXXXXXXX)/fifo 3 | mkfifo ${output} 4 | ( eval "$@" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null 5 | 6 | printf %s\\n "evaluate-commands -try-client '$kak_opt_toolsclient' %{ 7 | edit! -fifo ${output} *fifo* 8 | hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } } 9 | }" 10 | }} 11 | -------------------------------------------------------------------------------- /not_loaded/leader.kak: -------------------------------------------------------------------------------- 1 | # Not using this because counts are not forwarded, see https://github.com/mawww/kakoune/issues/2635 2 | declare-user-mode leader 3 | 4 | map global leader %{0} %{} 5 | map global leader %{1} %{} 6 | map global leader %{2} %{} 7 | map global leader %{3} %{} 8 | map global leader %{4} %{} 9 | map global leader %{5} %{} 10 | map global leader %{6} %{} 11 | map global leader %{7} %{} 12 | map global leader %{8} %{} 13 | map global leader %{9} %{} 14 | map global leader %{a} %{} 15 | map global leader %{b} %{} 16 | map global leader %{c} %{} 17 | map global leader %{d} %{} 18 | map global leader %{e} %{} 19 | map global leader %{f} %{} 20 | map global leader %{g} %{} 21 | map global leader %{h} %{} 22 | map global leader %{i} %{} 23 | map global leader %{j} %{} 24 | map global leader %{k} %{} 25 | map global leader %{l} %{} 26 | map global leader %{m} %{} 27 | map global leader %{n} %{} 28 | map global leader %{o} %{} 29 | map global leader %{p} %{} 30 | map global leader %{q} %{} 31 | map global leader %{r} %{} 32 | map global leader %{s} %{} 33 | map global leader %{t} %{} 34 | map global leader %{u} %{} 35 | map global leader %{v} %{} 36 | map global leader %{w} %{} 37 | map global leader %{x} %{} 38 | map global leader %{y} %{} 39 | map global leader %{z} %{} 40 | map global leader %{A} %{} 41 | map global leader %{B} %{} 42 | map global leader %{C} %{} 43 | map global leader %{D} %{} 44 | map global leader %{E} %{} 45 | map global leader %{F} %{} 46 | map global leader %{G} %{} 47 | map global leader %{H} %{} 48 | map global leader %{I} %{} 49 | map global leader %{J} %{} 50 | map global leader %{K} %{} 51 | map global leader %{L} %{} 52 | map global leader %{M} %{} 53 | map global leader %{N} %{} 54 | map global leader %{O} %{} 55 | map global leader %{P} %{} 56 | map global leader %{Q} %{} 57 | map global leader %{R} %{} 58 | map global leader %{S} %{} 59 | map global leader %{T} %{} 60 | map global leader %{U} %{} 61 | map global leader %{V} %{} 62 | map global leader %{W} %{} 63 | map global leader %{X} %{} 64 | map global leader %{Y} %{} 65 | map global leader %{Z} %{} 66 | map global leader %{!} %{} 67 | map global leader %{"} %{} 68 | map global leader %{#} %{} 69 | map global leader %{$} %{} 70 | map global leader %{%} %{} 71 | map global leader %{&} %{} 72 | map global leader %{'} %{} 73 | map global leader %{(} %{} 74 | map global leader %{)} %{} 75 | map global leader %{*} %{} 76 | map global leader %{+} %{} 77 | map global leader %{,} %{} 78 | map global leader %{.} %{} 79 | map global leader %{/} %{} 80 | map global leader %{:} %{} 81 | map global leader %{;} %{} 82 | map global leader %{} %{} 83 | map global leader %{=} %{} 84 | map global leader %{} %{} 85 | map global leader %{?} %{} 86 | map global leader %{@} %{} 87 | map global leader %{[} %{} 88 | map global leader %{\} %{} 89 | map global leader %{]} %{} 90 | map global leader %{^} %{} 91 | map global leader %{_} %{} 92 | map global leader %{`} %{} 93 | map global leader %{|} %{} 94 | map global leader %{~} %{} 95 | 96 | map global normal ': enter-user-mode leader' 97 | map global leader '' 98 | map global leader . ': enter-user-mode -lock leader' 99 | -------------------------------------------------------------------------------- /plugins/.gitignore: -------------------------------------------------------------------------------- 1 | .build 2 | *.kak 3 | -------------------------------------------------------------------------------- /snippets.kak: -------------------------------------------------------------------------------- 1 | hook global WinSetOption filetype=.* %[ 2 | set -add buffer snippets \ 3 | "Jan-Jaap Korpershoek" "JJK" %{ snippets-insert "Jan-Jaap Korpershoek"} 4 | ] 5 | 6 | hook global WinSetOption filetype=(latex|markdown) %[ 7 | set -add buffer snippets \ 8 | "header" "^header" %{ snippets-insert %{--- 9 | author: Jan-Jaap Korpershoek (s1726900) 10 | title: $1 11 | --- 12 | }} 13 | ] 14 | 15 | hook global WinSetOption filetype=python %[ 16 | set -add buffer snippets \ 17 | "interact" "interact" %{ snippets-insert %{import code 18 | code.interact(local=dict(globals(), **locals()))}} \ 19 | "argparse" "argparse" %{ snippets-insert %{import argparse 20 | parser = argparse.ArgumentParser() 21 | parser.add_argument($1) 22 | args = parser.parse_args()}} 23 | ] 24 | 25 | 26 | hook global WinSetOption filetype=(rust|c|cpp|java) %[ 27 | set -add buffer snippets \ 28 | "comment" "/\*" %{snippets-insert %{/* 29 | * $1 30 | */}} 31 | ] 32 | 33 | hook global WinSetOption filetype=(php) %[ 34 | set -add buffer snippets \ 35 | "print_r" "print_r" %{snippets-insert %{echo '
';
36 | print_r($1);
37 | echo '
'; 38 | exit;}} 39 | 40 | ] 41 | 42 | # Tab expand configuration by andreyorst (https://github.com/occivink/kakoune-snippets/issues/9#issuecomment-455810125) 43 | map global insert '' "z: snippets-expand-or-jump 'tab'" 44 | 45 | # hook global InsertCompletionShow .* %{ 46 | # try %{ 47 | # execute-keys -draft 'h\h' 48 | # map window insert '' "z: snippets-expand-or-jump 'tab'" 49 | # } 50 | # } 51 | 52 | # hook global InsertCompletionHide .* %{ 53 | # unmap window insert '' "z: snippets-expand-or-jump 'tab'" 54 | # } 55 | 56 | define-command snippets-expand-or-jump -params 1 %{ 57 | execute-keys 58 | try %{ 59 | snippets-expand-trigger %{ 60 | reg / "%opt{snippets_triggers_regex}\z" 61 | exec 'hGhs' 62 | } 63 | } catch %{ 64 | lsp-snippets-select-next-placeholders 65 | } catch %{ 66 | snippets-select-next-placeholders 67 | } catch %{ 68 | fail 69 | phantom-selection-iterate-next 70 | } catch %sh{ 71 | case $1 in 72 | ret|tab) 73 | printf "%s\n" "execute-keys -with-hooks <$1>" ;; 74 | *) 75 | printf "%s\n" "execute-keys -with-hooks $1" ;; 76 | esac 77 | } 78 | } 79 | --------------------------------------------------------------------------------