Add pre-student

This commit is contained in:
venomade committed 2026-08-17 13:53:05 +01:00
1 parent b7b49d1bbe
commit 9cdc3c82dd
65 files changed
+6718

No files matched your search

+1
View File
@@ -0,0 +1 @@
/nix/store/kr84jgb3bfca47m0njizy2pi61adh2wk-kakoune-2025.06.03/share/kak/rc
+38
View File
@@ -0,0 +1,38 @@
map global normal n j
map global normal <a-n> <a-j>
map global normal <a-N> <a-J>
map global normal e k
map global normal i l
map global normal I L
map global normal <a-i> <a-l>
map global normal <a-I> <a-L>
map global normal j n
map global normal <a-j> <a-n>
map global normal <a-J> <a-N>
map global normal J N
map global normal l i
map global normal <a-l> <a-i>
map global normal <a-L> <a-I>
map global normal k e
map global normal K E
map global normal <a-e> <a-k>
map global normal <a-k> <a-e>
map global normal <a-E> <a-K>
map global normal <a-K> <a-E>
# Select whole lines when moving selection with J or K
map global normal N Jx
map global normal E Kx
# Make I insert before every line
map global normal L "<a-s>I"
map global goto l ''
map global goto i l -docstring 'line end'
map global goto j ''
map global goto n j -docstring 'buffer bottom'
map global goto e ''
map global goto k ''
map global goto e k -docstring 'buffer top'
@@ -0,0 +1,82 @@
# Black Mocha
evaluate-commands %sh{
rosewater='rgb:f5e0dc'
flamingo='rgb:f2cdcd'
pink='rgb:f5c2e7'
mauve='rgb:cba6f7'
red='rgb:f38ba8'
maroon='rgb:eba0ac'
peach='rgb:fab387'
yellow='rgb:f9e2af'
green='rgb:a6e3a1'
teal='rgb:94e2d5'
sky='rgb:89dceb'
sapphire='rgb:74c7ec'
blue='rgb:89b4fa'
lavender='rgb:b4befe'
text='rgb:cdd6f4'
subtext1='rgb:bac2de'
subtext0='rgb:a6adc8'
overlay2='rgb:9399b2'
overlay1='rgb:7f849c'
overlay0='rgb:6c7086'
surface2='rgb:585b70'
surface1='rgb:45475a'
surface0='rgb:313244'
base='rgb:000000'
mantle='rgb:181825'
crust='rgb:11111b'
echo "
set-face global title ${text}+b
set-face global header ${subtext0}+b
set-face global bold ${maroon}+b
set-face global italic ${maroon}+i
set-face global mono ${green}
set-face global block ${sapphire}
set-face global link ${blue}
set-face global bullet ${peach}
set-face global list ${peach}
set-face global Default ${text},${base}
set-face global PrimarySelection ${text},${surface2}
set-face global SecondarySelection ${text},${surface2}
set-face global PrimaryCursor ${crust},${rosewater}
set-face global SecondaryCursor ${text},${overlay0}
set-face global PrimaryCursorEol ${surface2},${lavender}
set-face global SecondaryCursorEol ${surface2},${overlay1}
set-face global LineNumbers ${overlay1},${base}
set-face global LineNumbersWrapped ${base},${base}
set-face global LineNumberCursor ${lavender},${base}+b
set-face global MenuForeground ${text},${surface1}+b
set-face global MenuBackground ${text},${surface0}
set-face global MenuInfo ${crust},${teal}
set-face global Information ${crust},${teal}
set-face global Error ${crust},${red}
set-face global StatusLine ${text},${mantle}
set-face global StatusLineMode ${crust},${yellow}
set-face global StatusLineInfo ${crust},${teal}
set-face global StatusLineValue ${crust},${yellow}
set-face global StatusCursor ${crust},${rosewater}
set-face global Prompt ${teal},${base}+b
set-face global MatchingChar ${maroon},${base}
set-face global Whitespace ${overlay1},${base}+f
set-face global WrapMarker Whitespace
set-face global BufferPadding ${base},${base}
set-face global value ${peach}
set-face global type ${blue}
set-face global variable ${text}
set-face global module ${maroon}
set-face global function ${blue}
set-face global string ${green}
set-face global keyword ${mauve}
set-face global operator ${sky}
set-face global attribute ${green}
set-face global comment ${overlay0}
set-face global documentation comment
set-face global meta ${yellow}
set-face global builtin ${red}
"
}
@@ -0,0 +1,210 @@
# Modus-Vivendi theme for Kakoune
# Color palette
# declare-option str black default
declare-option str bg_main 'default'
declare-option str bg_terminal_main 'rgb:000000'
declare-option str fg_main 'rgb:ffffff'
declare-option str bg_dim 'rgb:1e1e1e'
declare-option str fg_dim 'rgb:989898'
declare-option str bg_alt 'rgb:000000'
declare-option str fg_alt 'rgb:c6daff'
declare-option str bg_active 'rgb:535353'
declare-option str bg_inactive 'rgb:303030'
declare-option str red 'rgb:ff5f59'
declare-option str red_bright 'rgb:ff7f86'
declare-option str green 'rgb:44bc44'
declare-option str green_bright 'rgb:00c06f'
declare-option str yellow 'rgb:d0bc00'
declare-option str yellow_bright 'rgb:dfaf7a'
declare-option str blue 'rgb:2fafff'
declare-option str blue_bright 'rgb:00bcff'
declare-option str purple 'rgb:feacd0'
declare-option str purple_bright 'rgb:b6a0ff'
declare-option str bg_mode_line 'rgb:000000'
declare-option str fg_mode_line 'rgb:cdd6f4'
declare-option str cursor 'rgb:ffffff'
declare-option str bg_hl_line 'rgb:2f3849'
declare-option str fg_space 'rgb:646464'
declare-option str magenta_warmer 'rgb:f78fe7'
declare-option str blue_warmer 'rgb:79a8ff'
declare-option str cyan 'rgb:00d3d0'
declare-option str cyan_warmer 'rgb:4ae2f0'
declare-option str cyan_cooler 'rgb:6ae4b9'
declare-option str red_faint 'rgb:ff9580'
declare-option str green_faint 'rgb:88ca9f'
declare-option str yellow_faint 'rgb:d2b580'
declare-option str blue_faint 'rgb:82b0ec'
declare-option str magenta_faint 'rgb:caa6df'
declare-option str cyan_faint 'rgb:9ac8e0'
declare-option str fg_link 'rgb:79a8ff'
declare-option str fg_prose_code 'rgb:6ae4b9'
declare-option str psel 'rgb:5a5a5a'
declare-option str ssel 'rgb:2f3849'
# Reference
# https://github.com/mawww/kakoune/blob/master/colors/default.kak
# For code
set-face global value 'rgb:ffffff'
set-face global type 'rgb:6ae4b9'
set-face global variable 'rgb:00d3d0'
set-face global keyword 'rgb:b6a0ff'
set-face global module 'rgb:ffffff'
set-face global function 'rgb:feacd0'
set-face global string 'rgb:79a8ff'
set-face global builtin 'rgb:f78fe7'
set-face global constant 'rgb:00bcff'
set-face global comment 'rgb:989898'
set-face global meta 'rgb:ff7f86'
set-face global operator 'rgb:ffffff'
set-face global comma 'rgb:ffffff'
set-face global bracket 'rgb:2f7f9f'
# For markup
set-face global title "%opt{fg_main}+b"
set-face global header "%opt{fg_main}+b"
set-face global bold "%opt{fg_main}+b"
set-face global italic "%opt{fg_main}+i"
set-face global mono "%opt{fg_prose_code}"
set-face global block "%opt{fg_dim}"
set-face global link "%opt{fg_link}+u"
set-face global bullet "%opt{fg_dim}"
set-face global list "%opt{fg_main}"
# Builtin faces
#set-face global Default "%opt{fg_main},%opt{bg_main}"
set-face global Default "%opt{fg_main},default"
set-face global PrimarySelection "default,%opt{psel}"
set-face global SecondarySelection "default,%opt{ssel}"
set-face global PrimaryCursor "%opt{bg_terminal_main},%opt{cursor}"
set-face global SecondaryCursor "%opt{bg_terminal_main},%opt{fg_alt}"
set-face global PrimaryCursorEol "%opt{bg_terminal_main},%opt{red_bright}"
set-face global SecondaryCursorEol "%opt{bg_terminal_main},%opt{blue}"
set-face global LineNumbers "%opt{fg_dim},%opt{bg_main}"
set-face global LineNumberCursor "%opt{fg_alt},%opt{bg_main}+b"
set-face global LineNumbersWrapped "%opt{bg_dim},%opt{bg_main}+i"
set-face global MenuForeground "%opt{bg_terminal_main},%opt{fg_main}+b"
set-face global MenuBackground "%opt{fg_main},%opt{bg_alt}"
set-face global MenuInfo "%opt{fg_alt},%opt{bg_alt}"
set-face global Information "%opt{fg_mode_line},%opt{bg_mode_line}"
set-face global Error "%opt{red},%opt{bg_mode_line}"
set-face global StatusLine "%opt{fg_mode_line},%opt{bg_mode_line}"
set-face global StatusLineMode "%opt{fg_mode_line},%opt{bg_mode_line}"
set-face global StatusLineInfo "%opt{fg_mode_line},%opt{bg_mode_line}"
set-face global StatusLineValue "%opt{fg_mode_line},%opt{bg_mode_line}"
set-face global StatusCursor "%opt{fg_main},%opt{blue}"
set-face global Prompt "%opt{fg_mode_line},%opt{bg_mode_line}"
set-face global MatchingChar "%opt{blue},%opt{bg_main}"
set-face global Whitespace "%opt{fg_space},%opt{bg_main}+f"
set-face global WrapMarker Whitespace
set-face global BufferPadding "%opt{bg_terminal_main},%opt{bg_main}"
# For tree-sitter (kak-tree-sitter)
# -- Keywords --
set-face global ts_keyword "%opt{purple_bright}"
set-face global ts_keyword_conditional "%opt{purple_bright}+i"
set-face global ts_keyword_control_conditional "%opt{purple_bright}+i"
set-face global ts_keyword_control_import "%opt{purple_bright}+i"
set-face global ts_keyword_directive "%opt{red_bright}+i"
set-face global ts_keyword_storage "%opt{purple_bright}"
set-face global ts_keyword_storage_modifier "%opt{purple_bright}"
set-face global ts_keyword_storage_modifier_mut "%opt{purple_bright}"
set-face global ts_keyword_storage_modifier_ref "%opt{cyan_cooler}"
# -- Functions --
set-face global ts_function "%opt{purple}"
set-face global ts_function_builtin "%opt{magenta_warmer}+i"
set-face global ts_function_macro "%opt{red_bright}"
set-face global ts_function_method "%opt{purple}"
# -- Types --
set-face global ts_type "%opt{cyan_cooler}"
set-face global ts_type_builtin "%opt{cyan_cooler}"
set-face global ts_type_enum_variant "%opt{cyan_warmer}"
set-face global ts_type_parameter "%opt{cyan}+i"
set-face global ts_constructor "%opt{cyan_cooler}"
# -- Strings --
set-face global ts_string "%opt{blue_warmer}"
set-face global ts_string_regexp "%opt{green_bright}"
set-face global ts_string_escape "%opt{purple}"
set-face global ts_string_special "%opt{blue}"
set-face global ts_string_special_path "%opt{green_bright}"
set-face global ts_string_special_symbol "%opt{purple_bright}"
set-face global ts_string_symbol "%opt{red_bright}"
# -- Constants --
set-face global ts_constant "%opt{blue_bright}"
set-face global ts_constant_builtin "%opt{blue_bright}"
set-face global ts_constant_builtin_boolean "%opt{blue_bright}"
set-face global ts_constant_character "%opt{blue_bright}"
set-face global ts_constant_macro "%opt{red_bright}"
set-face global ts_constant_numeric "%opt{fg_main}"
# -- Variables --
set-face global ts_variable "%opt{cyan}"
set-face global ts_variable_builtin "%opt{purple_bright}"
set-face global ts_variable_other_member "%opt{cyan_warmer}"
set-face global ts_variable_parameter "%opt{cyan}+i"
# -- Comments & operators --
set-face global ts_comment "%opt{fg_dim}"
set-face global ts_comment_unused "%opt{fg_dim}+s"
set-face global ts_operator "%opt{fg_main}"
set-face global ts_punctuation "%opt{fg_main}"
set-face global ts_punctuation_special "%opt{purple_bright}"
# -- Properties, namespaces, labels --
set-face global ts_property "%opt{cyan}"
set-face global ts_namespace "%opt{cyan}+i"
set-face global ts_label "%opt{cyan}+i"
set-face global ts_attribute "%opt{red_bright}"
# -- Markup --
set-face global ts_markup_bold "%opt{fg_main}+b"
set-face global ts_markup_italic "%opt{fg_main}+i"
set-face global ts_markup_strikethrough "%opt{fg_dim}+s"
set-face global ts_markup_heading "%opt{fg_main}+b"
set-face global ts_markup_heading_1 "%opt{fg_main}+b"
set-face global ts_markup_heading_2 "%opt{yellow_faint}+b"
set-face global ts_markup_heading_3 "%opt{blue_faint}+b"
set-face global ts_markup_heading_4 "%opt{purple}+b"
set-face global ts_markup_heading_5 "%opt{green_faint}+b"
set-face global ts_markup_heading_6 "%opt{red_faint}+b"
set-face global ts_markup_heading_marker "%opt{fg_dim}"
set-face global ts_markup_list_checked "%opt{fg_dim}"
set-face global ts_markup_list_numbered "%opt{fg_dim}"
set-face global ts_markup_list_unchecked "%opt{fg_dim}"
set-face global ts_markup_list_unnumbered "%opt{fg_dim}"
set-face global ts_markup_link_label "%opt{fg_link}"
set-face global ts_markup_link_url "%opt{fg_alt}"
set-face global ts_markup_link_uri "%opt{fg_alt}"
set-face global ts_markup_link_text "%opt{fg_link}+u"
set-face global ts_markup_quote "%opt{fg_main}+i"
set-face global ts_markup_raw "%opt{fg_prose_code}"
# -- Diff --
set-face global ts_diff_plus "%opt{green}"
set-face global ts_diff_minus "%opt{red}"
set-face global ts_diff_delta "%opt{blue}"
set-face global ts_diff_delta_moved "%opt{purple_bright}"
# -- Diagnostics --
set-face global ts_error "%opt{red}+b"
set-face global ts_warning "%opt{yellow}+b"
set-face global ts_hint "%opt{blue}+b"
set-face global ts_info "%opt{green}+b"
# -- Others --
set-face global ts_embedded "%opt{purple_bright}"
set-face global ts_include "%opt{purple_bright}"
set-face global ts_load "%opt{purple_bright}"
set-face global ts_tag "%opt{purple_bright}"
set-face global ts_tag_error "%opt{red}"
set-face global ts_text "%opt{fg_main}"
set-face global ts_text_title "%opt{fg_main}+b"
set-face global ts_conceal "%opt{fg_dim}+i"
set-face global ts_special "%opt{blue}"
set-face global ts_spell "%opt{fg_main}"
@@ -0,0 +1,61 @@
# Requires kakpipe and unbuffer
declare-option -docstring "The last command ran in compilation-mode
"\
str compile_last_command ""
declare-option -docstring "How the compile buffer should be displayed
Options:
'default': Create a new buffer in the current kakoune window
'new': Create a new window via ':terminal'
'tmux_vertical': Create a tmux vertical split
'tmux_horizontal': Create a tmux horizontal split
'tmux_popup': Create a tmux popup window
"\
str compile_run_mode "default"
define-command -hidden -params 1.. compile-exec %{
evaluate-commands %sh{
case "$kak_opt_compile_run_mode" in
default)
exec kakpipe fifo -s "$kak_session" -- unbuffer "$@"
;;
new)
printf 'terminal kak -e "set-option global compile_run_mode default; compile %s"\n' "$*"
;;
tmux_vertical|tmux_horizontal|tmux_popup)
if [ -z "$kak_client_env_TMUX" ]; then
echo 'fail "tmux is not running"'
exit
fi
case "$kak_opt_compile_run_mode" in
tmux_vertical)
tmux_args="split-window -t '${kak_client_env_TMUX_PANE}' -v"
;;
tmux_horizontal)
tmux_args="split-window -t '${kak_client_env_TMUX_PANE}' -h"
;;
tmux_popup)
tmux_args="popup -E -t '${kak_client_env_TMUX_PANE}'"
;;
esac
printf "nop %%sh{ tmux %s kak -e 'set-option global compile_run_mode default; compile %s' }\n" "$tmux_args" "$*"
;;
esac
}
}
define-command -docstring "Compile: run a command in a fifo buffer" compile -params 1.. %{
set-option global compile_last_command "%arg{@}"
compile-exec %arg{@}
}
define-command -docstring "Recompile: re-run the last compile command" recompile %{
evaluate-commands %sh{
if [ -z "$kak_opt_compile_last_command" ]; then
echo 'fail "No previous compile command"'
else
echo "compile-exec $kak_opt_compile_last_command"
fi
}
}
@@ -0,0 +1,20 @@
# Requires kakpipe and unbuffer
declare-option str compile_last_command ""
define-command -docstring "Compile: run a command in a fifo buffer" compile -params 1.. %{
set-option global compile_last_command "%arg{@}"
evaluate-commands %sh{ exec kakpipe fifo -s $kak_session -- unbuffer "$@" }
}
define-command -docstring "Recompile: re-run the last compile command" recompile %{
evaluate-commands %sh{
if [ -z "$kak_opt_compile_last_command" ]; then
echo 'fail "No previous compile command"'
else
exec kakpipe fifo -s $kak_session -- unbuffer $kak_opt_compile_last_command
fi
}
}
+357
View File
@@ -0,0 +1,357 @@
# Venomade's kakrc
# ------
# SOURCE
# ------
# Use Colemak keybinds
source ~/.config/kak/colemak.kak
source ~/.config/kak/compilation-mode.kak
# -------
# OPTIONS
# -------
# Set tab width
set-option global tabstop 2
set-option global indentwidth 2
# Display line numbers
add-highlighter global/ number-lines -hlcursor
# Softwrap long lines
add-highlighter global/ wrap -word -indent
# Set the colorscheme
colorscheme 'modus-vivendi'
# Move the modeline to the top of the screen
set-option global ui_options terminal_status_on_top=yes
# Don't show changelog at startup
set-option global startup_info_version 10000000000000
# Add scroll margin
set-option global scrolloff 5,5
# Use ripgrep instead of grep
set-option global grepcmd 'rg -HUn --no-heading --sort path --vimgrep'
# Remove trailing whitespace on save
hook -group auto-trim-whitespace global BufWritePre .* %{ try %{ execute-keys -draft \%s\h+$<ret>d } }
# Disable Clippy
set-option -add global ui_options terminal_assistant=none
# Disable word completion
set-option global completers filename
# --------
# KEYBINDS
# --------
# Buffer Keybinds
declare-user-mode buffer-mode
map global user b ':enter-user-mode buffer-mode<ret>' -docstring 'buffer...'
map global buffer-mode d ':delete-buffer<ret>' -docstring 'delete buffer'
map global buffer-mode k ':delete-buffer!<ret>' -docstring 'kill buffer'
map global buffer-mode n ':buffer-next<ret>' -docstring 'next buffer'
map global buffer-mode p ':buffer-previous<ret>' -docstring 'previous buffer'
# map global buffer-mode b '<esc>:prompt -buffer-completion buffer: %{ buffer %val{text} }<ret>' -docstring 'switch buffer'
# Comment line
map global normal "#" ":comment-line<ret>"
# File Keybinds
declare-user-mode file-mode
map global user f ':enter-user-mode file-mode<ret>' -docstring 'file...'
# map global file-mode f '<esc>:prompt -shell-script-candidates %{ fd --type f } file: %{ edit %val{text} }<ret>' -docstring "find file"
map global file-mode c ':e ~/.config/kak/kakrc<ret>' -docstring 'open config'
map global file-mode t ':e ~/Documents/Notes/TODO.md<ret>' -docstring 'open todo'
# Search case-insensitive by default
map global normal "/" "/(?Si)"
map global normal "?" "?(?Si)"
map global normal "<a-/>" "<a-/>(?Si)"
map global normal "<a-?>" "<a-?>(?Si)"
# Select inner line
map global normal X x_
# Use tab for autocomplete
# hook global InsertCompletionShow .* %{
# try %{
# execute-keys -draft 'h<a-K>\h<ret>'
# map window insert <tab> <c-n>
# map window insert <s-tab> <c-p>
# hook -once -always window InsertCompletionHide .* %{
# unmap window insert <tab> <c-n>
# unmap window insert <s-tab> <c-p>
# }
# }
# }
# Tab jumps to next snippet placeholder by default in insert mode
map global insert <tab> '<esc>: lsp-snippets-select-next-placeholders<ret>i'
map global insert <s-tab> '<esc>: lsp-snippets-select-next-placeholders<ret>i' # optional reverse
# When completion menu shows, remap tab to cycle completions — but only if not in a snippet
hook global InsertCompletionShow .* %{
try %{
execute-keys -draft 'h<a-K>\h<ret>'
try %{
eval %sh{ [ -n "${kak_opt_lsp_snippets_placeholder_groups}" ] && echo "fail" }
map window insert <tab> <c-n>
map window insert <s-tab> <c-p>
hook -once -always window InsertCompletionHide .* %{
unmap window insert <tab> <c-n>
unmap window insert <s-tab> <c-p>
}
}
}
}
# Map tab and shift-tab to indent and dedent in normal mode
map global normal <tab> '>'
map global normal <s-tab> '<'
# Terminal related bindings
declare-user-mode terminal-mode
map global user t ':enter-user-mode terminal-mode<ret>' -docstring 'terminal...'
map global terminal-mode t ':terminal zsh<ret>' -docstring 'open terminal'
map global terminal-mode s ':tmux-repl-horizontal <ret>' -docstring 'open terminal split (H)'
map global terminal-mode v ':tmux-repl-vertical<ret>' -docstring 'open terminal split (V)'
define-command smart-gh \
-docstring "Smart goto line start." \
%{
set-register c %val{cursor_column}
execute-keys gi
evaluate-commands %sh{
orig_col="${kak_reg_c}"
indent_col="${kak_cursor_column}"
if [ "${orig_col}" -le "${indent_col}" ]; then
echo "execute-keys gh"
fi
}
}
map global goto h <esc>:smart-gh<ret> -docstring 'line begin (smart)'
# Window Management
declare-user-mode window-mode
map global user w ':enter-user-mode window-mode<ret>' -docstring 'window...'
map global window-mode s ':tmux-terminal-horizontal kak -c %val{session}<ret>' -docstring 'open window split (H)'
map global window-mode v ':tmux-terminal-vertical kak -c %val{session}<ret>' -docstring 'open window split (V)'
# -------
# PLUGINS
# -------
# Nanoline is a cleaner alternative to the default modeline
set-option global nanoline_rw_face_dark rgb:11111b,rgb:b4befe
nanoline dark
nanoline-format
# Use auto-pairs
enable-auto-pairs
# Enable Copy-Paste with kakboard
hook global WinCreate .* %{ kakboard-enable }
# Load LSP
eval %sh{kak-lsp}
set-option global modelinefmt "%opt{lsp_modeline} %opt{modelinefmt}"
map global user l ':enter-user-mode lsp<ret>' -docstring 'lsp...'
map global goto d <esc>:lsp-definition<ret> -docstring 'LSP definition'
map global goto r <esc>:lsp-references<ret> -docstring 'LSP references'
map global goto y <esc>:lsp-type-definition<ret> -docstring 'LSP type definition'
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
map global object t '<a-semicolon>lsp-object Class Interface Module Namespace Struct<ret>' -docstring 'LSP class or module'
map global object d '<a-semicolon>lsp-diagnostic-object error warning<ret>' -docstring 'LSP errors and warnings'
map global object D '<a-semicolon>lsp-diagnostic-object error<ret>' -docstring 'LSP errors'
hook global WinSetOption lsp_code_action_indicator=.* %{
set-option window lsp_code_action_indicator "[A]"
}
hook global WinSetOption lsp_progress_indicator=.* %{
set-option window lsp_progress_indicator "[P]"
}
hook global GlobalSetOption lsp_modeline_message_requests=.* %{
evaluate-commands %sh{
if [ -n "$kak_hook_param_capture_0" ]; then
echo "set-option global lsp_modeline_message_requests '[M]'"
fi
}
}
# Save with formatting with :W
define-command W %{
lsp-formatting-sync
w
}
set-face global InlayDiagnosticHint 'rgb:444444'
# FZF
require-module fzf
set-option global fzf_tmux_popup true
set-option global fzf_tmux_popup_width '80%'
set-option global fzf_default_opts '--color=base16'
set-option global fzf_highlight_command 'bat'
require-module fzf-file
set-option global fzf_file_command 'fd'
require-module fzf-grep
set-option global fzf_grep_command 'rg'
map global file-mode f ':require-module fzf-file; fzf-file<ret>' -docstring 'find file'
map global file-mode p ':require-module fzf-file; fzf-file buffile-dir<ret>' -docstring 'find file at path'
map global file-mode g ':require-module fzf-grep; fzf-grep<ret>' -docstring 'grep files'
map global file-mode d ':require-module fzf-cd; fzf-cd<ret>' -docstring 'change directory'
map global file-mode / ':require-module fzf-search; fzf-buffer-search<ret>' -docstring 'search current file'
map global buffer-mode b ':require-module fzf-buffer; fzf-buffer<ret>' -docstring 'switch buffer'
# map global user F ':fzf-mode<ret>' -docstring 'fzf...'
# Harpoon
harpoon-add-bindings
# Kakpipe
require-module kakpipe
set-option global compile_run_mode 'tmux_horizontal'
declare-user-mode compile-mode
map global user c ':enter-user-mode compile-mode<ret>' -docstring 'compile...'
map global compile-mode c '<esc>:prompt -shell-completion "compile: " %{ evaluate-commands %sh{ echo "compile $kak_text" } }<ret>' -docstring 'compile'
map global compile-mode r ':recompile<ret>' -docstring 'recompile'
# Kakoune Focus
declare-user-mode selection-mode
map global user s ':enter-user-mode selection-mode<ret>' -docstring 'selection...'
map global selection-mode f ':focus-toggle<ret>' -docstring "toggle selections focus"
define-command focus-live-enable %{
focus-selections
hook -group focus window NormalIdle .* %{ focus-extend }
}
define-command focus-live-disable %{
remove-hooks window focus
focus-clear
}
# ---------
# FILETYPES
# ---------
# Lua
hook global BufSetOption filetype=lua %{
set-option buffer lsp_servers %exp{
# Minimal setup for luals (Lua doesn't really work with LSP, I've tried)
[luals]
filetypes = ["lua"]
root_globs = [".git/", ".luarc.json", ".luarc.jsonc", ".editorconfig", ".kakrc"]
command = "lua-language-server"
[luals.settings.Lua]
codeLens.enable = false
completion.autoRequire = false # afaik not supported by kakoune
completion.enable = true
completion.callSnippet = "Replace"
completion.showWord = "Disable"
completion.postfix = "@"
diagnostics.enable = true
diagnostics.disable = [
"lowercase-global",
"spell-check",
]
format.enable = true
hint.enable = true
hint.paramName = "Disable"
hint.paramType = false
hover.enable = true
runtime.path = [
"?.lua",
"?/init.lua",
]
runtime.version = "Lua 5.4"
semantic.enable = false
[luals.settings.Lua.diagnostics.severity]
undefined-field = "Warning"
undefined-global = "Warning"
# [emmylua_ls]
# filetypes = ["lua"]
# root_globs = [".git/", ".luarc.json", ".editorconfig", ".kakrc", ".emmyrc.json"]
# command = "emmylua_ls"
}
}
hook global WinSetOption filetype=lua %{
add-highlighter window/emmylua_direct regex "---\s*(@(?:alias|as|class|enum|generic|return|type|overload))\s+([^\n]*)" 1:attribute 2:type
add-highlighter window/emmylua_labeled regex "---\s*(@(?:alias|cast|field|param))\s+([a-zA-Z0-9_\?]*) ([^\n]*)" 1:attribute 2:variable 3:type
add-highlighter window/emmylua_enum_variant regex '---\s*\|\s*("[^\n]*")' 1:string
}
# Markdown
hook global BufSetOption filetype=markdown %{
set-option buffer lsp_servers %exp{
[zk_lsp]
filetypes = ["markdown"]
root_globs = [".git/", ".zk/", ".kakrc"]
command = "zk"
args = ["lsp"]
[harper]
filetypes = ["markdown"]
root_globs = [".git/", ".zk/", ".kakrc"]
command = "harper-ls"
args = ["--stdio"]
settings_section = "_"
[harper.settings._.harper-ls]
#isolateEnglish = true # Currently very buggy
dialect = "British"
[harper.settings._.harper-ls.markdown]
IgnoreLinkTitle = true }
}
# ----
# MISC
# ----
# TODO: Fix this TODO Highlighter
hook -group todohighlight global BufCreate .* %{
add-highlighter buffer/todo-highlight regex "%opt{comment_line}[ \t]*\b(TODO|FIXME|HACK)\b" 1:default+bu@comment
}
# Enable LSP (Must come just before settings, after everything else lsp)
lsp-enable
lsp-diagnostic-lines-disable global
lsp-inlay-diagnostics-enable global
# lsp-inlay-code-lenses-enable global
lsp-inlay-hints-enable global
set-option global lsp_hover_anchor true
# lsp-auto-hover-enable
lsp-auto-signature-help-enable