diff options
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} + " +} |
