diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-10-21 12:46:57 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-10-21 19:36:46 +0530 |
| commit | d8acf7b147b180c2333eb4122f28a4dd972cd402 (patch) | |
| tree | 80eccd46e505419c89edc04504aa13ffa8dc353c /autoload | |
| parent | 188c0207d7debf0ab5a20f6d27fae32f4a3d3f2e (diff) | |
| download | kakoune-config-d8acf7b147b180c2333eb4122f28a4dd972cd402.tar.gz kakoune-config-d8acf7b147b180c2333eb4122f28a4dd972cd402.zip | |
Fix symlinking + some experiments
Diffstat (limited to '')
| -rw-r--r-- | autoload/+init.kak | 6 | ||||
| -rw-r--r-- | autoload/build.kak | 6 | ||||
| -rw-r--r-- | autoload/folding.kak | 8 | ||||
| -rw-r--r-- | autoload/grep.kak | 16 | ||||
| -rw-r--r-- | autoload/snippets/typescript.kak | 42 | ||||
| l--------- | autoload/standard-library | 2 |
6 files changed, 69 insertions, 11 deletions
diff --git a/autoload/+init.kak b/autoload/+init.kak index 243df1d..4012f0f 100644 --- a/autoload/+init.kak +++ b/autoload/+init.kak @@ -1,5 +1,5 @@ # Link builtin autoloads -nop %sh{ ln -s "$kak_runtime/rc" "$kak_config/autoload/standard-library" 2>/dev/null || true } +nop %sh{ ln -sf "$kak_runtime/rc" "$kak_config/autoload/standard-library" 2>/dev/null || true } evaluate-commands %sh{kcr init kakoune} evaluate-commands %sh{kak-tree-sitter -dksvv --init "${kak_session}" --with-highlighting --with-text-objects} @@ -44,6 +44,7 @@ map global user r '*%s<ret>' -docstring 'Replace selection' map global user s ': w<ret>' -docstring 'Save' map global normal <c-j> 15j -docstring '15 down' map global normal <c-k> 15k -docstring '15 up' + # Clipboard management mappings map global user y "<a-|> xclip -selection clipboard<ret>" -docstring "yank the selection into the clipboard" map global user p "<a-!> xclip -selection clipboard -o<ret>" -docstring "paste the clipboard" @@ -81,10 +82,11 @@ map global code f :format<ret> -docstring 'Format buffer' def casecamel %{ exec '`s[-_<space>]<ret>d~<a-i>w' } def casesnake %{ exec '<a-:><a-;>s-|[a-z][A-Z]<ret>;a<space><esc>s[-\s]+<ret>c_<esc><a-i>w`' } def casekebab %{ exec '<a-:><a-;>s_|[a-z][A-Z]<ret>;a<space><esc>s[_\s]+<ret>c-<esc><a-i>w`' } -map global code <a-k> :casekebab<ret> -docstring 'kebab-casing' +map global code <a-minus> :casekebab<ret> -docstring 'kebab-casing' map global code <a-_> :casesnake<ret> -docstring 'snake_casing' map global code <a-c> :casecamel<ret> -docstring 'camelCasing' # Editorconfig hook global BufOpenFile .* %{ try %{ editorconfig-load } } hook global BufNewFile .* %{ try %{ editorconfig-load } } + diff --git a/autoload/build.kak b/autoload/build.kak index e882b9e..e8c3189 100644 --- a/autoload/build.kak +++ b/autoload/build.kak @@ -2,13 +2,13 @@ set-option global makecmd 'make -j8' # TODO: For some reason <ret> doesnt jump to error hook global BufSetOption filetype=(?:typescript|javascript) %{ - set-option global makecmd "%val{config}/scripts/tsc-vimgrep.sh" + set-option buffer makecmd "%val{config}/scripts/tsc-vimgrep.sh" } hook global BufSetOption filetype=haskell %{ - set-option global makecmd "cabal build" + set-option buffer makecmd "cabal build" } hook global BufSetOption filetype=rust %{ - set-option global makecmd "cargo build" + set-option buffer makecmd "cargo build" } diff --git a/autoload/folding.kak b/autoload/folding.kak index b19af5f..5bfd62c 100644 --- a/autoload/folding.kak +++ b/autoload/folding.kak @@ -4,9 +4,9 @@ # # 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}|Texthere'" +# echo "set-option -remove buffer fold_ranges '${1}|++++'" # else -# echo "set-option -add buffer fold_ranges '${1}|Texthere'" +# echo "set-option -add buffer fold_ranges '${1}|++++'" # fi # } # } @@ -21,3 +21,7 @@ # } # 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/grep.kak b/autoload/grep.kak index 13a44bd..27b6d65 100644 --- a/autoload/grep.kak +++ b/autoload/grep.kak @@ -9,6 +9,16 @@ define-command grep-write %{ } } -# TODO: Proper mappings for next/prev on results -hook global -always BufOpenFifo '\*grep\*' %{ map global normal <minus> ': grep-next-match<ret>' } -hook global -always BufOpenFifo '\*make\*' %{ map global normal <minus> ': make-next-error<ret>' } +hook global -always BufOpenFifo '\*grep\*' %{ + map global file ] ': grep-next-match<ret>' + map global file [ ': grep-previous-match<ret>' +} +hook global -always BufOpenFifo '\*make\*' %{ + map global file ] ': make-next-error<ret>' + map global file [ ': make-previous-error<ret>' +} + +# TODO: Prevent exiting command mode from grep +# define-command live-grep %{ +# prompt -on-change %{ eval %sh{ [ -z "$kak_text" ] || echo "grep $kak_text" } } 'live-grep: ' %{ info done } +# } diff --git a/autoload/snippets/typescript.kak b/autoload/snippets/typescript.kak new file mode 100644 index 0000000..86f46e7 --- /dev/null +++ b/autoload/snippets/typescript.kak @@ -0,0 +1,42 @@ +# declare-option -hidden str-list snippet_list + +# define-command snippets-insert %{ +# evaluate-commands %sh{ +# cmds="echo $(echo "$kak_opt_snippet_list" | sed 's/=.*//')" +# # TODO: Fix this shit +# echo "prompt -menu -shell-script-candidates '$cmd' 'Snippet: ' 'evaluate-commands %val{text}'" +# } +# } + +# map global normal <c-p> ':snippets-insert<ret>' + +# define-command define-snippet -params 3 %{ +# set-option -add %arg{1} snippet_list %sh{ echo -e "$2=$3\n" } +# } + +# define-snippet global "React component" snip-react-component +# define-snippet global "React useState" snip-react-usestate + +# # hook global BufSetOption filetype=(?:javascript|typescript) %{ +# # define-snippet buffer "React component" snip-react-component +# # define-snippet buffer "React useState" snip-react-usestate +# # } + +# define-command snip-react-usestate %{ +# prompt 'Name: ' %{ +# evaluate-commands %sh{ +# echo "info %{$kak_text}" +# st=$(echo "$kak_text" | sed 's/^[A-Z]/\L\0/') +# setst="set$(echo "$kak_text" | sed 's/^[a-z]/\U\0/')" +# echo "execute-keys '<esc>,iconst [$st, $setst] = useState();<esc>'" +# } +# } +# } + +# define-command snip-react-component %{ +# prompt 'Component name: ' %{ +# execute-keys "<esc>,iconst %val{text} = ({ children }: React.PropsWithChildren) => {<ret>" +# execute-keys " return <lt>div><lt>/div>;" +# execute-keys "<ret>}<esc>" +# } +# } diff --git a/autoload/standard-library b/autoload/standard-library index f679584..206c960 120000 --- a/autoload/standard-library +++ b/autoload/standard-library @@ -1 +1 @@ -/nix/store/ag5zk1qgp13as02psyql5bkc76wgc5a0-kakoune-2025.06.03/share/kak/rc
\ No newline at end of file +/nix/store/jqyklnpbcy1snmz5vc0fr6wkfxqhjgb9-kakoune-2025.06.03/share/kak/rc
\ No newline at end of file |
