154 lines
5.2 KiB
Text
154 lines
5.2 KiB
Text
evaluate-commands %sh{ kak-tree-sitter -dks --init $kak_session }
|
|
evaluate-commands %sh{kak-popup init}
|
|
colorscheme ashen
|
|
require-module fishr
|
|
require-module surround
|
|
require-module ficgrep
|
|
require-module byline
|
|
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 sh -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
|
|
}
|
|
|
|
# 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
|
|
|
|
# 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<ret>"
|
|
map -docstring "quit" global normal <c-q> ": q<ret>"
|
|
map -docstring "force quit" global user Q ": q!<ret>"
|
|
map -docstring "force quit" global normal <c-Q> ": q!<ret>"
|
|
map -docstring "kill session" global normal <a-q> ':kill<ret>'
|
|
map -docstring "force kill session" global normal <a-q> ':kill!<ret>'
|
|
map -docstring "save" global normal <c-v> ": write<ret>"
|
|
map -docstring "save" global normal <a-v> ": write!<ret>"
|
|
|
|
# buffer operations
|
|
map -docstring "close current buffer" global user x ": db<ret>"
|
|
map -docstring "goto previous buffer" global user m ": bp<ret>"
|
|
map -docstring "goto next buffer" global user i ": bn<ret>"
|
|
map -docstring "goto previous buffer" global normal <c-m> ": bp<ret>"
|
|
map -docstring "goto next buffer" global normal <c-i> ": bn<ret>"
|
|
|
|
# trim whitespace
|
|
map global normal <tab> _
|
|
|
|
# comments
|
|
map -docstring "comment line" global normal "#" ": comment-line<ret>"
|
|
map -docstring "comment block" global normal "<a-#>" ": comment-block<ret>"
|
|
|
|
# formatting
|
|
map -docstring "format" global normal = ": format-buffer<ret>"
|
|
map -docstring "format" global normal <a-=> ": format-selections<ret>"
|
|
|
|
# Case-insensitive Search
|
|
map -docstring 'case insensitive search' global user '/' /(?i)
|
|
map -docstring 'case insensitive backward search' global user '<a-/>' <a-/>(?i)
|
|
map -docstring 'case insensitive extend search' global user '?' ?(?i)
|
|
map -docstring 'case insensitive backward extend-search' global user '<a-?>' <a-?>(?i)
|
|
|
|
# TODO: how to bind these to goto mode while respecting g/G??
|
|
map -docstring 'Select to file end' global user N "Gj<a-L>L"
|
|
map -docstring 'Extend to file end' global user n "gj<a-l>l"
|
|
|
|
# Zathura pdf preview only for Typst files
|
|
|
|
hook global WinSetOption filetype=typst %{
|
|
define-command -docstring %{
|
|
Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file
|
|
} typst %{
|
|
nop %sh{
|
|
{
|
|
"$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid"
|
|
} > /dev/null 2>&1 < /dev/null &
|
|
}
|
|
}
|
|
}
|
|
|
|
define-command -docstring "Create a scratch buffer" scratch %{
|
|
edit -scratch
|
|
}
|
|
alias global s scratch
|
|
|
|
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<ret>'
|
|
map -docstring 'pick file' global peneira f ': peneira-files<ret>'
|
|
map -docstring 'pick unopened file' global peneira F ': peneira-files -hide-opened<ret>'
|
|
map -docstring %{
|
|
pick line in buffer
|
|
} global peneira '/' ': peneira-lines<ret>'
|
|
|
|
map global normal <backspace> '"_'
|
|
define-command goto-debug %{
|
|
buffer *debug*
|
|
ui-scrolloff-disable
|
|
execute-keys 'gj'
|
|
}
|
|
|
|
|
|
map -docstring 'open debug buffer' global user D ':goto-debug<ret>'
|
|
|
|
# spellcheck using aspell for now (maybe better options?)
|
|
declare-user-mode spell
|
|
|
|
map -docstring 'show spell' global spell s ': spell<ret>'
|
|
map -docstring 'spell next' global spell n ': spell-next<ret>'
|
|
map -docstring 'spell next' global spell i ': spell-next<ret>'
|
|
map -docstring 'spell prev' global spell e ': spell-prev<ret>'
|
|
map -docstring 'spell prev' global spell m ': spell-prev<ret>'
|
|
map -docstring 'spell clear' global spell c ': spell-clear<ret>'
|
|
map -docstring 'spell add' global spell a ': spell-add<ret>'
|
|
map -docstring 'spell replace' global spell r ': spell-replace<ret>'
|
|
|
|
map -docstring 'spelling' global user s ': enter-user-mode spell<ret>'
|