define-repl-mode global s 'Shell' %{ set global xrepl_current_cmd 'kcr shell' } define-repl-mode global n 'Node' %{ set global xrepl_current_cmd 'node' } define-repl-mode global a 'AI: Claude' %{ set global xrepl_current_cmd 'claude' } # Send makecmd to shell define-repl-mode global M 'Makecmd' %{ set global xrepl_current_cmd 'kcr shell' set global xrepl_current_transform 'cat > /dev/null; echo $kak_opt_makecmd' } hook global BufSetOption filetype=haskell %{ define-repl-mode buffer h 'Haskell: cabal test' %{ # TODO: maybe use current test file path set global xrepl_current_cmd 'cabal test' set global xrepl_current_clear_screen true } } hook global BufSetOption filetype=ruby %{ define-repl-mode buffer c 'Rails console' %{ set global xrepl_current_cmd '${KAK_BUNDLE_EXEC:-"bundle exec"} rails console' } define-repl-mode buffer r 'Rspec' %{ set global xrepl_current_cmd 'kcr shell' set global xrepl_current_transform 'cat > /dev/null path=$(realpath -s --relative-to="$PWD" "$kak_buffile") if [ "$kak_cursor_line" -gt 5 ]; then path="$path:$kak_cursor_line"; fi echo "eval \${KAK_BUNDLE_EXEC:-"bundle exec"} rspec -fd ''$path'' " ' set global xrepl_current_clear_screen true } } hook global BufSetOption filetype=(?:javascript|typescript|jsx|tsx) %{ # TODO: Search for root cypress config file and cd into it # set global xrepl_current_cmd '(echo "::$kak_config::" | tee foob) && ' define-repl-mode buffer c 'Cypress' %{ set global xrepl_current_cmd 'kcr shell' set global xrepl_current_transform 'cat > /dev/null cypress_config_files="cypress.config.json cypress.config.ts cypress.config.js" project=$($kak_config/scripts/utils.sh find_closest "$kak_buffile" $cypress_config_files) echo "npx cypress run --headless --e2e -P" "''$project''" "--spec ''$kak_buffile'';" ' set global xrepl_current_clear_screen true } define-repl-mode global j 'Jest' %{ set global xrepl_current_cmd 'kcr shell' set global xrepl_current_transform 'cat > /dev/null echo "sh -c \\"cd ''$(dirname "$kak_buffile")''; npx jest --runTestsByPath ''$kak_buffile''\\";" ' set global xrepl_current_clear_screen true } } # hook global BufSetOption filetype=clojure %{ # # TODO: Just temporary for messing around. Remove module name # map buffer repl r ': xrepl-send-text %{(require ''[pluribus.core :as p] :reload)}; xrepl-send-keys Enter' -docstring 'Cljs reload' # define-repl-mode buffer j 'Clojurescript repl' %{ # set global xrepl_current_cmd 'clj -M -m cljs.main --repl-opts "{:launch-browser false}" --compile pluribus.core --repl' # set global xrepl_current_split_size 30%% # set global xrepl_current_split_vertical true # } # }