blob: 43be837aaf364a05c27b6e407f6e1f66113f7c35 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# Link builtin autoloads
nop %sh{
rm -f "$kak_config/autoload/standard-library" || true
ln -sf "$kak_runtime/rc" "$kak_config/autoload/standard-library" 2>/dev/null || true
rm -f "$kak_config/autoload/plugins" || true
ln -sf "$kak_runtime/autoload/plugins" "$kak_config/autoload/plugins" 2>/dev/null || true
}
# Disabled treesitter because eh
# eval %sh{kak-tree-sitter -dksvv --init "${kak_session}" --with-highlighting --with-text-objects}
eval %sh{kcr init kakoune}
colorscheme phenax
set-option global autoreload yes
set-option global incsearch true
set-option global indentwidth 2
set-option global tabstop 2
set-option -add global path "**"
set-option global startup_info_version 20250603
set-option global scrolloff 10,3
set-option -add global ui_options terminal_enable_mouse=false terminal_set_title=true terminal_status_on_top=true
# Modeline
set-option global modelinefmt \
'{StatusLineExtras}%opt{lsp_modeline_progress} %opt{lsp_modeline_breadcrumbs}
{StatusLineDetails}{{context_info}} {{mode_info}}
%val{cursor_line}/%val{buf_line_count}:%val{cursor_char_column}
{StatusLineBufname}%sh{echo "$kak_bufname" | awk -F/ "{if (NF >= 2) {print \$(NF-1) \"/\" \$NF} else {print \$NF}}"}'
# Highlighters
add-highlighter global/ number-lines -hlcursor -min-digits 3 -separator ' ' -relative
add-highlighter global/ column '%val{cursor_char_column}' ColumnLine
add-highlighter global/ line '%val{cursor_line}' RowLine
add-highlighter global/ regex \h+$ 0:Error # Highlight trailing whitespaces
add-highlighter global/ show-matching -previous
add-highlighter global/ show-whitespaces -spc ' ' -tab '│' -lf '¬' -indent '│'
hook global RegisterModified '/' %{
# Highlight search
add-highlighter -override global/search regex "%reg{/}" 0:search
}
# Preserve count for user modes (look for alternatives)
declare-option -hidden int user_mode_count 0
define-command enter-user-mode-with-count -params 1 %{
set-option window user_mode_count %val{count}
enter-user-mode %arg{1}
}
# Open directory (bits from explore.kak)
hook global RuntimeError '\d+:\d+: ''(?:edit|e)''(.+): is a directory' %{
file-manager %val(hook_param_capture_1)
}
hook global KakBegin .* %{ hook -once global WinCreate .* %{ hook -once global NormalIdle '' %{
try %{ evaluate-commands -draft -save-regs '/' %{
buffer *debug*
set-register / 'error while opening file ''(.+?)'':\n\h+(.+?): is a directory'
execute-keys '%1s<ret>'
evaluate-commands -draft -itersel %{
evaluate-commands -client %val(client) file-manager %reg(.)
}
}}
}}}
# Open file:linenum
hook global WinDisplay (.*):(\d+)$ %{
# Use string to eval quickly
# FIXME: Replace normalidle hack with better approach to "defer"
hook -once buffer NormalIdle .* "
delete-buffer %val{hook_param}
edit %val{hook_param_capture_1} %val{hook_param_capture_2}
"
}
|