diff --git a/.config/kak/.kakrc.kak.e6XXkH b/.config/kak/.kakrc.kak.e6XXkH new file mode 100644 index 00000000..7b7ef8a1 --- /dev/null +++ b/.config/kak/.kakrc.kak.e6XXkH @@ -0,0 +1,209 @@ +# Daniel's Personal kakrc +# Author: Daniel Fichtinger +# See README.md for explanations. + +evaluate-commands %sh{ kak-tree-sitter -dks --init $kak_session } +evaluate-commands %sh{kak-popup init} +colorscheme ashen +require-module hop-kak +require-module fishr +require-module surround +require-module ficgrep +require-module byline +require-module spell +require-module title-bar +require-module notes +set-option global scrolloff 3,3 +require-module ui-mode + +require-module luar +set-option global luar_interpreter luajit + + +try %{ + set-option global ashen_dynamic_cursor true + set-option global ashen_eol_cursor true +} +# disable clippy +set-option -add global ui_options terminal_assistant=none + +# only set to foot if we are on wayland +hook global ModuleLoaded wayland %{ + set-option global termcmd 'footclient dash -c' +} + +# This gets overridden by editorconfig but we set sane default anyways +set-option global tabstop 4 +set-option global indentwidth 4 + +# needed for tree-sitter to respect show-matching +define-command -override tree-sitter-user-after-highlighter %{ + add-highlighter -override buffer/show-matching show-matching + # try %{ + # remove-highlighter window/bracket + # remove-highlighter window/regex-escaped + # } +} + +hook global WinSetOption filetype=kak %{ + # make brackets gray a-la Ashen + add-highlighter window/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 + # special highlighting for escaped goodies in regex + add-highlighter window/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rgb:e5e5e5 +} + +# default window settings +# wrap enabled +# scrolloff enabled +hook global WinCreate .* %{ + ui-wrap-enable + # TODO: fix ui-scrolloff-enable and use that instead + ui-scrolloff-toggle + add-highlighter window/number-lines number-lines -hlcursor -relative -separator " " + # only-trailing is nice QOL otherwise it gets hard to read the screen + # and it makes it easy to see trailing spaces + add-highlighter window/show-whitespaces show-whitespaces -only-trailing + add-highlighter window/show-matching show-matching +} + +# convenience mappings +# quitting & saving +map -docstring "quit" global user q ": q" +map -docstring "quit" global normal ": q" +map -docstring "force quit" global user Q ": q!" +map -docstring "force quit" global normal ": q!" +map -docstring "kill session" global normal ':kill' +map -docstring "force kill session" global normal ':kill!' +map -docstring "save" global normal ": write" +map -docstring "save" global normal ": write!" + +# buffer operations +map -docstring "close current buffer" global user x ": db" +map -docstring "goto previous buffer" global user m ": bp" +map -docstring "goto next buffer" global user i ": bn" +map -docstring "goto previous buffer" global normal ": bp" +map -docstring "goto next buffer" global normal ": bn" + +# trim whitespace +map global normal _ + +# comments +map -docstring "comment line" global normal "#" ": comment-line" +map -docstring "comment block" global normal "" ": comment-block" + +# formatting +map -docstring "format" global normal = ": format-buffer" +map -docstring "format" global normal ": format-selections" + +# Case-insensitive Search +map -docstring 'case insensitive search' global user '/' /(?i) +map -docstring 'case insensitive backward search' global user '' (?i) +map -docstring 'case insensitive extend search' global user '?' ?(?i) +map -docstring 'case insensitive backward extend-search' global user '' (?i) + +# TODO: how to bind these to goto mode while respecting g/G?? +map -docstring 'Select to file end' global user N "GjL" +map -docstring 'Extend to file end' global user n "gjl" + +define-command -docstring "Create a scratch buffer" scratch %{ + edit -scratch +} + +alias global s scratch + +define-command -params 1 -docstring "Set buffer filetype" filetype %{ + set-option buffer filetype %arg{1} +} + +define-command -docstring "New terminal in cwd" cwd-terminal %{ + terminal fish +} +# make easy to open new shell +alias global t cwd-terminal + +# manually requiring needed for some reason 😢 +require-module peneira + +declare-user-mode peneira +map -docstring %{ + Picker mode +} global user f ': enter-user-mode peneira' +map -docstring 'pick file' global peneira f ': peneira-files' +map -docstring 'pick unopened file' global peneira F ': peneira-files -hide-opened' +map -docstring %{ + pick line in buffer +} global peneira '/' ': peneira-lines' + +map global normal '"_' +define-command goto-debug %{ + try %{ + buffer *debug* + ui-scrolloff-disable + execute-keys 'gj' + } +} + +declare-user-mode debug +map -docstring 'open debug buffer' global debug d ':goto-debug' +map -docstring 'open debug buffer' global user D ': enter-user-mode debug' + +define-command exec-selection %{ + execute-keys ':.' +} + +map -docstring 'execute selection' global debug x ': exec-selection' +define-command repl %{ + new %{ edit -scratch; set buffer filetype kak } +} +define-command -override -hidden consume %{ + nop %sh{ + niri msg action consume-or-expel-window-left + } +} + +define-command terminal-consume %{ + terminal dash -c 'niri msg action consume-or-expel-window-left; exec fish' +} + +alias global tc terminal-consume + +define-command -docstring %{ + Create a new client in vertial split +} new-consume %{ + new consume +} + +alias global nc new-consume +alias global n new + +# jumplist + +map -docstring 'jump forward' global normal +map -docstring 'save to jumplist' global normal + +# selection saving +map -docstring 'add selection' global normal Y a + +define-command -docstring 'open popup shell' popup-shell %{ + popup fish +} +alias global pp popup-shell + +map -docstring 'popup shell' global user . ': popup-shell' + +# hook -once global ClientCreate .* %{ +# evaluate-commands %sh{ +# if [ "$kak_buflist" != "*debug* *scratch*" ]; then +# echo "delete-buffer *scratch*" +# else +# echo "echo -debug dumping buffers" +# echo "echo -debug %val{buflist}" +# fi +# } +# } + +try %{ + evaluate-commands %sh{kak-lsp-diags} + map -docstring 'enable diagnostic hover' global ui "'" ': lsp-diag-hover-enable' + map -docstring 'disable diagnostic hover' global ui '"' ': lsp-diag-hover-disable' +} diff --git a/.config/kak/autoload/lsp.kak b/.config/kak/autoload/lsp.kak index 2762a8a3..2959c6a7 100644 --- a/.config/kak/autoload/lsp.kak +++ b/.config/kak/autoload/lsp.kak @@ -165,8 +165,41 @@ hook -group lsp-filetype-python global BufSetOption filetype=python %{ hook -group lsp-filetype-bibtex global BufSetOption filetype=bibtex %{ set-option buffer lsp_servers %{ + [ltex-ls-plus] + root_globs = [".git", ".hg", "main.tex"] + [ltex-ls-plus.settings.ltex] + # TODO: write a script where the dictionary is a list of words + # that's read from a file and then output in TOML format. + # This way we can implement adding our own words to this list dynamically + # dictionary = { "en-US" = ["builtin", "Fichtinger", "SonarAuth", "sexpenis" ], "en-CA" = ["more", "words"] } + dictionary = { "en-US" = [] } + [texlab] - root_globs = [".git", ".hg", "."] + root_globs = [".git", ".hg"] + [texlab.settings.texlab] + # See https://github.com/latex-lsp/texlab/wiki/Configuration + # + # Preview configuration for zathura with SyncTeX search. + # For other PDF viewers see https://github.com/latex-lsp/texlab/wiki/Previewing + build.onSave = true + forwardSearch.executable = "zathura" + forwardSearch.args = [ + "%p", + "--synctex-forward", # Support texlab-forward-search + "%l:1:%f", + "--synctex-editor-command", # Inverse search: use Control+Left-Mouse-Button to jump to source. + """ + sh -c ' + echo " + evaluate-commands -client %%opt{texlab_client} %%{ + evaluate-commands -try-client %%opt{jumpclient} %%{ + edit -- %%{input} %%{line} + } + } + " | kak -p $kak_session + ' + """, + ] } } diff --git a/.config/kak/kakrc b/.config/kak/kakrc index 0e318869..7b7ef8a1 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -39,12 +39,18 @@ set-option global indentwidth 4 # needed for tree-sitter to respect show-matching define-command -override tree-sitter-user-after-highlighter %{ add-highlighter -override buffer/show-matching show-matching + # try %{ + # remove-highlighter window/bracket + # remove-highlighter window/regex-escaped + # } } -# make brackets gray a-la Ashen -add-highlighter global/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 -# special highlighting for escaped goodies in regex -add-highlighter global/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rgb:e5e5e5 +hook global WinSetOption filetype=kak %{ + # make brackets gray a-la Ashen + add-highlighter window/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 + # special highlighting for escaped goodies in regex + add-highlighter window/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rgb:e5e5e5 +} # default window settings # wrap enabled