diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-11-05 21:56:06 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-11-09 12:02:10 +0530 |
| commit | 73a9be025659a9b36a9284e160a9aee995db5314 (patch) | |
| tree | 8b6caa34e2f4795e09779ff006b1e182d7ecde8d | |
| parent | 17b59f5ed7acac5dc852c831e1650daac7f169d7 (diff) | |
| download | kakoune-config-73a9be025659a9b36a9284e160a9aee995db5314.tar.gz kakoune-config-73a9be025659a9b36a9284e160a9aee995db5314.zip | |
Add some buffer keys and buffers-show command
| -rw-r--r-- | autoload/+init.kak | 6 | ||||
| -rw-r--r-- | autoload/build.kak | 2 | ||||
| -rw-r--r-- | autoload/files.kak | 25 | ||||
| -rw-r--r-- | autoload/folding.kak | 27 | ||||
| -rw-r--r-- | autoload/formatter.kak | 2 | ||||
| -rw-r--r-- | autoload/marks.kak | 10 | ||||
| -rw-r--r-- | autoload/orgmode.kak | 8 | ||||
| -rw-r--r-- | autoload/surround.kak | 17 | ||||
| -rw-r--r-- | colors/phenax.kak | 27 |
9 files changed, 68 insertions, 56 deletions
diff --git a/autoload/+init.kak b/autoload/+init.kak index f9ca258..a34832b 100644 --- a/autoload/+init.kak +++ b/autoload/+init.kak @@ -9,6 +9,12 @@ hook global KakBegin .* %{ set-option global luar_interpreter luajit } +# 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 diff --git a/autoload/build.kak b/autoload/build.kak index e8c3189..b1067b6 100644 --- a/autoload/build.kak +++ b/autoload/build.kak @@ -1,7 +1,7 @@ set-option global makecmd 'make -j8' # TODO: For some reason <ret> doesnt jump to error -hook global BufSetOption filetype=(?:typescript|javascript) %{ +hook global BufSetOption filetype=(?:typescript|javascript|jsx|tsx) %{ set-option buffer makecmd "%val{config}/scripts/tsc-vimgrep.sh" } diff --git a/autoload/files.kak b/autoload/files.kak index 4598569..5754bc3 100644 --- a/autoload/files.kak +++ b/autoload/files.kak @@ -6,13 +6,28 @@ def file-manager -params .. %{ terminal-singleton files env "DAFFM_PATH_RELATIVE_TO=%val{client_env_PWD}" daffm -c @kak %arg{@} } +declare-user-mode file +map global user f ': enter-user-mode file<ret>' -docstring 'File mode' +map global file f ': find ' -docstring 'Find files' +map global file n ': file-manager %val{buffile}<ret>' -docstring 'File manager' + declare-user-mode buffer map global user b ': enter-user-mode buffer<ret>' -docstring 'Buffer mode' map global buffer b ': buffer ' -docstring 'Switch buffer' -map global buffer d ': delete-buffer<ret>' -docstring 'Delete buffer' +map global buffer <ret> ': buffers-show<ret>' -docstring 'Show buflist' +map global buffer n ': buffer-next; buffers-show<ret>' -docstring 'Next buffer' +map global buffer p ': buffer-previous; buffers-show<ret>' -docstring 'Previous buffer' +map global buffer d ': delete-buffer; buffers-show<ret>' -docstring 'Delete buffer' map global buffer s ': write<ret>' -docstring 'Save' -declare-user-mode file -map global user f ': enter-user-mode file<ret>' -docstring 'File mode' -map global file f ': find ' -docstring 'Find files' -map global file n ': file-manager %val{buffile}<ret>' -docstring 'File manager' +def buffers-show %{ + info -title 'buffers' -markup %sh{ + echo "$kak_quoted_buflist" | xargs -n1 | while IFS= read buf; do + if [ -z "$buf" ]; then echo "{comment}<scratch>{Normal}" + elif [ "$buf" == "$kak_bufname" ]; then echo "{keyword}$buf{Normal}" + else echo "{Default}$buf{Normal}" + fi + done | nl -w 2 + } +} + diff --git a/autoload/folding.kak b/autoload/folding.kak deleted file mode 100644 index 5bfd62c..0000000 --- a/autoload/folding.kak +++ /dev/null @@ -1,27 +0,0 @@ -# declare-option range-specs fold_ranges - -# define-command fold-range -params 1 %{ -# # TODO: Check if cursor is within range -# evaluate-commands %sh{ -# if (echo "$kak_opt_fold_ranges" | grep -F "${1}" >/dev/null 2>&1); then -# echo "set-option -remove buffer fold_ranges '${1}|++++'" -# else -# echo "set-option -add buffer fold_ranges '${1}|++++'" -# fi -# } -# } - -# define-command fold-enable %{ -# add-highlighter global/folding replace-ranges fold_ranges -# } - -# define-command fold-indent %{ -# execute-keys '<a-i>i' -# fold-range %val{selection_desc} -# } - -# fold-enable - -# declare-user-mode foldmode -# map global normal <c-^> ': enter-user-mode foldmode<ret>' -# map global foldmode a ': fold-indent<ret>' diff --git a/autoload/formatter.kak b/autoload/formatter.kak index 955ad14..6b8c126 100644 --- a/autoload/formatter.kak +++ b/autoload/formatter.kak @@ -8,7 +8,7 @@ hook global BufSetOption filetype=nix %{ set-option buffer formatcmd "nixfmt -" hook global BufSetOption filetype=ruby %{ set-option buffer formatlspserver rubocop } -hook global BufSetOption filetype=(?:javascript|typescript) %{ +hook global BufSetOption filetype=(?:javascript|typescript|jsx|tsx) %{ evaluate-commands %sh{ if [ -f "$PWD/biome.json" ]; then echo "set-option buffer formatlspserver biome" diff --git a/autoload/marks.kak b/autoload/marks.kak index 43e7126..2f58c22 100644 --- a/autoload/marks.kak +++ b/autoload/marks.kak @@ -38,8 +38,8 @@ define-command marks-switch -params 1 %{ } declare-user-mode marks -map global user a ':enter-user-mode-with-count marks<ret>' -docstring 'Marks mode' -map global user <space> ':marks-switch %val{count}<ret>' -docstring 'Switch marks' -map global marks a ':marks-add %val{buffile} %opt{user_mode_count}<ret>' -docstring 'Create new mark from buffer' -map global marks d ':marks-delete %val{buffile}<ret>' -docstring 'Delete mark' -map global marks C ':marks-clear<ret>' -docstring 'Clear mark' +map global user a ': enter-user-mode-with-count marks<ret>' -docstring 'Marks mode' +map global user <space> ': marks-switch %val{count}<ret>' -docstring 'Switch marks' +map global marks a ': marks-add %val{buffile} %opt{user_mode_count}<ret>' -docstring 'Create new mark from buffer' +map global marks d ': marks-delete %val{buffile}<ret>' -docstring 'Delete mark' +map global marks C ': marks-clear<ret>' -docstring 'Clear mark' diff --git a/autoload/orgmode.kak b/autoload/orgmode.kak index 7c44039..b6ad623 100644 --- a/autoload/orgmode.kak +++ b/autoload/orgmode.kak @@ -5,13 +5,13 @@ hook global BufSetOption filetype=org %{ map buffer org <tab> ': orgmode-toggle<ret>' -docstring 'Toggle checkbox/task' } -define-command orgmode-toggle %{ +def orgmode-toggle %{ evaluate-commands -save-regs '#/' %{ try %{ orgmode-toggle-checkbox } catch %{ orgmode-toggle-task-state } catch %{ } } } -define-command orgmode-jump-link %{ +def orgmode-jump-link %{ # TODO: support multiple links in single line evaluate-commands %{ try %{ execute-keys ',xs\[\[([^\n\]]+)\]<ret>' @@ -30,7 +30,7 @@ define-command orgmode-jump-link %{ } } } -define-command orgmode-toggle-checkbox %{ +def orgmode-toggle-checkbox %{ evaluate-commands %{ execute-keys ',xs^(\h*-\h+)\[([Xx\- ])\]<ret>' evaluate-commands %sh{ @@ -45,7 +45,7 @@ define-command orgmode-toggle-checkbox %{ } } -define-command orgmode-toggle-task-state %{ +def orgmode-toggle-task-state %{ evaluate-commands %{ execute-keys ',xs^(\*+\h+)(TODO|ACTIVE|DONE)?<ret>' evaluate-commands %sh{ diff --git a/autoload/surround.kak b/autoload/surround.kak index 2df301c..3ce248d 100644 --- a/autoload/surround.kak +++ b/autoload/surround.kak @@ -17,3 +17,20 @@ # define-surround '"' '"' '"' '"' # define-surround "'" "'" "'" "'" # define-surround t "c<lt>div,<lt>/div<gt><ret>" "<lt>div<gt>" "<lt>/div<gt>" + + +# declare-option range-specs ghost_completion; +# add-highlighter global/ replace-ranges ghost_completion + +# hook global ModeChange .*:insert:.* %{ +# unset buffer ghost_completion +# } + +# map global insert <c-o> '<a-;>: appsugg<ret>' + +# def appsugg %{ +# set buffer ghost_completion %val{timestamp} %sh{ +# result=$(ai "$kak_selections") +# echo -e "$kak_selection_desc|{comment}$result{Default}" +# } +# } diff --git a/colors/phenax.kak b/colors/phenax.kak index 406bf0d..a523da0 100644 --- a/colors/phenax.kak +++ b/colors/phenax.kak @@ -19,9 +19,10 @@ evaluate-commands %sh{ red="rgb:cc6666" orange="rgb:de935f" yellow="rgb:f0c674" - green="rgb:b3f6c0" + green1="rgb:b3f6c0" + green2="rgb:00b894" blue1="rgb:81a2be" - blue2="rgb:81dad9" + blue2="rgb:81cac9" blue3="rgb:82aaff" aqua="rgb:8abeb7" purple="rgb:b294bb" @@ -31,31 +32,31 @@ evaluate-commands %sh{ echo " face global value ${blue1} face global type ${blue1} - face global variable ${blue1} + face global variable white + face global const_variable white face global numeric ${orange} face global module ${blue1} face global function ${blue2} - face global string ${green} - face global keyword ${accent2} + face global string ${green1} + face global keyword ${accent1} face global operator ${aqua} face global attribute ${blue1} face global comment ${comment} face global documentation comment face global meta ${foreground} face global builtin ${yellow} - face global const_variable ${blue1} " ## markup echo " face global title ${blue1} face global header ${accent2} - face global mono ${green} + face global mono ${green1} face global block ${orange} face global link ${blue1} face global bullet ${red} face global list ${red} - face global inlineBold ${green}+b + face global inlineBold ${accent2}+b face global inlineItalic +i face global inlineStrikethrough ${foreground3}+fs face global inlineUnderline ${foreground}+fu @@ -64,7 +65,7 @@ evaluate-commands %sh{ face global header1 ${accent3}+b face global header2 ${accent1}+b face global header3 ${blue1}+b - face global header4 ${green}+b + face global header4 ${green1}+b face global header5 ${purple}+b face global header6 ${aqua}+b face global checkboxChecked ${foreground3} @@ -72,7 +73,7 @@ evaluate-commands %sh{ face global checkboxPending ${orange} face global checkboxTodo ${red} face global orgTaskStateTodo ${black},${red}+b - face global orgTaskStateDone ${black},${green}+b + face global orgTaskStateDone ${black},${green1}+b face global orgTaskStateActive ${black},${orange}+b face global markup_codeblock ${foreground2},${mildhighlight1}+a face global orgCodeBlock markup_codeblock @@ -93,8 +94,8 @@ evaluate-commands %sh{ echo " face global PrimaryCursor black,${foreground}+fg face global SecondaryCursor black,${foreground3}+fg - face global PrimaryCursorEol ${background},${green} - face global SecondaryCursorEol ${background},${green} + face global PrimaryCursorEol ${background},${green1} + face global SecondaryCursorEol ${background},${green1} face global InsertCursor black,${orange}+fg " @@ -114,7 +115,7 @@ evaluate-commands %sh{ face global StatusLine ${foreground},${background} face global StatusLineMode ${yellow}+b face global StatusLineInfo ${aqua},default - face global StatusLineValue ${green} + face global StatusLineValue ${green1} face global StatusCursor ${window},${aqua} face global Prompt ${accent1},${background} face global MatchingChar ${yellow},${background}+b |
