diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-06-21 21:56:01 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-06-21 21:56:01 +0530 |
| commit | ed0e8f48b59607c138f8d9a6ecdbf7dd5c011c95 (patch) | |
| tree | 51d1b6349aa152aa955adf88eb7e1311f185e674 /autoload/+init.kak | |
| parent | 1ccf3d5c1d2ee7ff8ec97488c0b15b8316fb29f9 (diff) | |
| download | kakoune-config-ed0e8f48b59607c138f8d9a6ecdbf7dd5c011c95.tar.gz kakoune-config-ed0e8f48b59607c138f8d9a6ecdbf7dd5c011c95.zip | |
Add handling for dir open + line number open + justfile
Diffstat (limited to 'autoload/+init.kak')
| -rw-r--r-- | autoload/+init.kak | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/autoload/+init.kak b/autoload/+init.kak index 4a7671d..43be837 100644 --- a/autoload/+init.kak +++ b/autoload/+init.kak @@ -18,14 +18,11 @@ 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 +set-option -add global ui_options terminal_enable_mouse=false terminal_set_title=true terminal_status_on_top=true # Modeline -# declare-option -hidden _lsp_modeline_diagnostics "%opt{lsp_diagnostic_error_count}" -# %opt{lsp_modeline_breadcrumbs} set-option global modelinefmt \ -'{StatusLineExtras}%opt{lsp_modeline_progress} +'{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}}"}' @@ -48,3 +45,28 @@ 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} + " +} |
