From 8e6fa2062700d8c4816e8ecd95940805bedc245b Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 18 Jan 2026 16:34:31 +0530 Subject: Add plugins directory linking --- autoload/+init.kak | 33 +++++++++++++-------------------- autoload/cursor.kak | 13 ------------- autoload/files.kak | 6 +++--- autoload/filetype/justfile.kak | 1 + autoload/formatter.kak | 11 +++++++++-- autoload/git.kak | 2 ++ autoload/marks.kak | 5 +++++ autoload/plugins | 1 + autoload/standard-library | 2 +- autoload/surround.kak | 36 +++++++++++++++++++----------------- 10 files changed, 54 insertions(+), 56 deletions(-) create mode 100644 autoload/filetype/justfile.kak create mode 120000 autoload/plugins diff --git a/autoload/+init.kak b/autoload/+init.kak index 8044ad7..5169932 100644 --- a/autoload/+init.kak +++ b/autoload/+init.kak @@ -1,12 +1,9 @@ # Link builtin autoloads nop %sh{ + rm -f "$kak_config/autoload/standard-library" || true + rm -f "$kak_config/autoload/plugins" || true ln -sf "$kak_runtime/rc" "$kak_config/autoload/standard-library" 2>/dev/null || true - # rm -rf "$kak_config/autoload/stdlib" 2>/dev/null || true - # mkdir -p "$kak_config/autoload/stdlib" || true - # ln -sf "$kak_runtime/rc/detection" "$kak_config/autoload/stdlib/detection" 2>/dev/null || true - # ln -sf "$kak_runtime/rc/filetype" "$kak_config/autoload/stdlib/filetype" 2>/dev/null || true - # ln -sf "$kak_runtime/rc/tools" "$kak_config/autoload/stdlib/tools" 2>/dev/null || true - # ln -sf "$kak_runtime/rc/windowing" "$kak_config/autoload/stdlib/windowing" 2>/dev/null || true + ln -sf "$kak_runtime/autoload/plugins" "$kak_config/autoload/plugins" 2>/dev/null || true } # Disable indent trimming @@ -15,12 +12,6 @@ set-option global disabled_hooks .*-trim-indent eval %sh{kak-tree-sitter -dksvv --init "${kak_session}" --with-highlighting --with-text-objects} eval %sh{kcr init kakoune} -# hook global BufCreate .*[.]tsx %{ -# set-option buffer filetype tsx -# set-option buffer tree_sitter_lang tsx -# set-option buffer lsp_language_id typescriptreact -# } - colorscheme phenax set-option global autoreload yes set-option global incsearch true @@ -49,11 +40,11 @@ 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 '/' %{ - # @todo: Highlight current searchterm - # TODO: Highlight current searchterm + # Highlight search add-highlighter -override global/search regex "%reg{/}" 0:search } -add-highlighter global/ regex \b(TODO|FIXME|@todo|@fixme)\b 0:default+rb +add-highlighter global/ regex \b(TODO|FIXME)\b 0:default+rb +add-highlighter global/ regex @(todo|fixme) 0:default+rb # Misc keys map global user '' ': set-register slash ""' -docstring 'Clear search highlighting' @@ -64,16 +55,18 @@ map global normal 15j -docstring '15 down' map global normal 15k -docstring '15 up' map global user y " xclip -selection clipboard" -docstring "yank the selection into the clipboard" -map global user p " xclip -selection clipboard -o" -docstring "paste the clipboard" declare-user-mode system map global user q ': enter-user-mode system' -docstring 'System mode' -map global system o ':echo %opt{}' -docstring 'Print opt' -map global system v ':echo %val{}' -docstring 'Print value' +map global system o ':info %opt{}' -docstring 'Print opt' +map global system v ':info %val{}' -docstring 'Print value' map global system d ': buffer *debug*' -docstring 'Switch to debug buffer' map global system f ':set buffer filetype ' -docstring 'Set filetype' -map global system m ':set buffer makecmd ""' -docstring 'Set compile command' +map global system M ':set buffer makecmd ""' -docstring 'Set compile command' +map global system m ': make' -docstring 'Compile' map global system p ': info %val{buffile}' -docstring 'Print file path' +map global system ! ':info %sh{}' -docstring 'Run command' +map global system t ': terminal %sh{ echo "$SHELL" }' -docstring 'Open new term' # Wrapping set-option global autowrap_column 100 @@ -112,5 +105,5 @@ map global ai ! '!ai ""' -docstring 'Insert output' map global ai | '|ai ""' -docstring 'Replace output' # Editorconfig -hook global WinCreate ^[^*]+$ %{editorconfig-load} +hook global WinCreate ^[^*]+$ %{ editorconfig-load } diff --git a/autoload/cursor.kak b/autoload/cursor.kak index a37bb00..3274dec 100644 --- a/autoload/cursor.kak +++ b/autoload/cursor.kak @@ -1,16 +1,3 @@ -# declare-option -hidden regex curword - -# # Highlight word under cursor -# add-highlighter global/ dynregex '%opt{curword}' 0:CurWord -# hook global NormalIdle .* %{ -# eval -draft %{ try %{ -# exec w\A\w+\z -# set-option buffer curword "\b\Q%val{selection}\E\b" -# } catch %{ -# set-option buffer curword '' -# } } -# } - # Change cursor face based on mode hook global ModeChange .*:.*:insert %{ set-face window PrimaryCursor InsertCursor diff --git a/autoload/files.kak b/autoload/files.kak index f4ebd9d..ce380ba 100644 --- a/autoload/files.kak +++ b/autoload/files.kak @@ -7,14 +7,14 @@ def file-manager -params .. %{ } def findfzf %{ - terminal-singleton fzf sh -c 'kcr edit $(fd -t f --hidden --color=never -E .git | fzf --multi --min-height=100 --preview=''bat --color=always {}'')' + terminal-singleton fzf sh -c 'kcr edit $(fd -t f --hidden --color=never -E .git | fzf --prompt='':find '' --multi --min-height=100 --preview=''bat --color=always {}'')' } declare-user-mode file map global user f ': enter-user-mode file' -docstring 'File mode' -map global file f ': find ' -docstring 'Find files' +map global file F ': find ' -docstring 'Find files' map global file n ': file-manager %val{buffile}' -docstring 'File manager' -map global file F ': findfzf' -docstring 'Fzf' +map global file f ': findfzf' -docstring 'Fzf' declare-user-mode buffer map global user b ': enter-user-mode-with-count buffer' -docstring 'Buffer mode' diff --git a/autoload/filetype/justfile.kak b/autoload/filetype/justfile.kak new file mode 100644 index 0000000..0a28a21 --- /dev/null +++ b/autoload/filetype/justfile.kak @@ -0,0 +1 @@ +hook global BufCreate .*[.]just %{ set-option buffer filetype just } diff --git a/autoload/formatter.kak b/autoload/formatter.kak index 6b8c126..0830164 100644 --- a/autoload/formatter.kak +++ b/autoload/formatter.kak @@ -17,8 +17,15 @@ hook global BufSetOption filetype=(?:javascript|typescript|jsx|tsx) %{ fi } } -define-command biome -docstring 'Format file on disk using biome' %{ - nop %sh{ npx biome check --fix --stdin-file-path=$kak_buffile } + +define-command biome-buffer -docstring 'Format buffer file on disk using biome' %{ + biome %val{buffile} +} + +define-command biome -params .. -docstring 'Format project using biome' %{ + info %sh{ + npx biome check --fix "$@" && echo "Success" || echo "Failed" + } } define-command apply-formatting -docstring 'Apply formatting with formatcmd or lsp' %{ diff --git a/autoload/git.kak b/autoload/git.kak index 2befa83..0745a61 100644 --- a/autoload/git.kak +++ b/autoload/git.kak @@ -6,6 +6,8 @@ define-command gitui -params .. %{ gitu %arg{@} } +# TODO: Script to open git remote url (github/srht/gitlab/etc) + declare-user-mode git declare-user-mode git-r map global user g ': enter-user-mode git' -docstring 'Git mode' diff --git a/autoload/marks.kak b/autoload/marks.kak index e1f7d72..d7aea04 100644 --- a/autoload/marks.kak +++ b/autoload/marks.kak @@ -37,9 +37,14 @@ define-command marks-show %{ } } +define-command marks-edit-all %{ + edit %sh{ "$kak_config/scripts/marks.fnl" show-path } +} + declare-user-mode marks map global user a ': enter-user-mode-with-count marks' -docstring 'Marks mode' map global user ': marks-select %val{count}' -docstring 'Select marks' map global marks a ': marks-add %val{buffile} %opt{user_mode_count}' -docstring 'Create new mark from buffer' map global marks d ': marks-delete %val{buffile}' -docstring 'Delete mark' map global marks C ': marks-clear' -docstring 'Clear mark' +map global marks e ': marks-edit-all' -docstring 'Open buffer to edit marks' diff --git a/autoload/plugins b/autoload/plugins new file mode 120000 index 0000000..2db5386 --- /dev/null +++ b/autoload/plugins @@ -0,0 +1 @@ +/nix/store/fh4r60z346kassl8iq39095kb5kf57jg-kakoune-2025.06.03/share/kak/autoload/plugins \ No newline at end of file diff --git a/autoload/standard-library b/autoload/standard-library index 53a840a..e13edf4 120000 --- a/autoload/standard-library +++ b/autoload/standard-library @@ -1 +1 @@ -/nix/store/1hf7ngjm8rs2swq2300sa7zn45cjzz9g-kakoune-2025.06.03/share/kak/rc \ No newline at end of file +/nix/store/fh4r60z346kassl8iq39095kb5kf57jg-kakoune-2025.06.03/share/kak/rc \ No newline at end of file diff --git a/autoload/surround.kak b/autoload/surround.kak index 3ce248d..5c691ef 100644 --- a/autoload/surround.kak +++ b/autoload/surround.kak @@ -1,22 +1,24 @@ -# declare-user-mode surround -# declare-user-mode surround-append -# declare-user-mode surround-delete -# map global user k ': enter-user-mode surround' -# map global surround a ': enter-user-mode surround-append' -# map global surround d ': enter-user-mode surround-delete' +declare-user-mode surround +declare-user-mode surround-append +declare-user-mode surround-delete +declare-user-mode surround-select +map global user k ': enter-user-mode surround' +map global surround a ': enter-user-mode surround-append' +map global surround s ': enter-user-mode surround-select' -# define-command define-surround -params 4 -docstring ': ' %{ -# map global surround-append %arg{1} %sh{ echo "i${3}a${4}" } -# map global surround-delete %arg{1} %sh{ echo "${2}d," } -# } +define-command define-surround -params 4 -docstring ': ' %{ + map global surround-append %arg{1} %sh{ echo "i${3}a${4}" } + map global surround-delete %arg{1} %sh{ echo "${2}d," } + map global surround-select %arg{1} %sh{ echo "${2}" } +} -# define-surround '(' '(' '(' ')' -# define-surround '[' '[' '[' ']' -# define-surround '{' '{' '{' '}' -# define-surround '`' '`' '`' '`' -# define-surround '"' '"' '"' '"' -# define-surround "'" "'" "'" "'" -# define-surround t "cdiv,/div" "div" "/div" +define-surround '(' '(' '(' ')' +define-surround '[' '[' '[' ']' +define-surround '{' '{' '{' '}' +define-surround '`' '`' '`' '`' +define-surround '"' '"' '"' '"' +define-surround "'" "'" "'" "'" +define-surround t "cdiv,/div" "div" "/div" # declare-option range-specs ghost_completion; -- cgit v1.3.1