about summary refs log tree commit diff
path: root/config/kak/compilation-mode.kak
diff options
context:
space:
mode:
authorvenomade <venomade@venomade.com>2026-04-08 15:07:12 +0100
committervenomade <venomade@venomade.com>2026-04-08 15:07:12 +0100
commitd422bc2b77ece72be1098bf05728275ef3306ee5 (patch)
tree8b6b6f0da228dc99f36d91cf7841c425963e73f5 /config/kak/compilation-mode.kak
parenta6543a0ba0e5399515e3dbe507a8bd12958839cc (diff)
Before the Return of the Mac HEAD master
Asahi Bugs
- Forked GL is very annoying to deal with
- Fairydust branch requires 8GB of RAM for display
- AArch64 Linux is not very compatible with much software
- DRM and other video related things are buggy/do not work
- Updating can often break fairydust
Diffstat (limited to 'config/kak/compilation-mode.kak')
-rw-r--r--config/kak/compilation-mode.kak61
1 files changed, 61 insertions, 0 deletions
diff --git a/config/kak/compilation-mode.kak b/config/kak/compilation-mode.kak
new file mode 100644
index 0000000..bdbb5e2
--- /dev/null
+++ b/config/kak/compilation-mode.kak
@@ -0,0 +1,61 @@
+# Requires kakpipe and unbuffer
+
+declare-option -docstring "The last command ran in compilation-mode
+"\
+str compile_last_command ""
+
+declare-option -docstring "How the compile buffer should be displayed
+Options:
+            'default': Create a new buffer in the current kakoune window
+                'new': Create a new window via ':terminal'
+      'tmux_vertical': Create a tmux vertical split
+    'tmux_horizontal': Create a tmux horizontal split
+         'tmux_popup': Create a tmux popup window
+"\
+str compile_run_mode "default"
+
+define-command -hidden -params 1.. compile-exec %{
+    evaluate-commands %sh{
+        case "$kak_opt_compile_run_mode" in
+            default)
+                exec kakpipe fifo -s "$kak_session" -- unbuffer "$@"
+                ;;
+            new)
+                printf 'terminal kak -e "set-option global compile_run_mode default; compile %s"\n' "$*"
+                ;;
+            tmux_vertical|tmux_horizontal|tmux_popup)
+                if [ -z "$kak_client_env_TMUX" ]; then
+                    echo 'fail "tmux is not running"'
+                    exit
+                fi
+                case "$kak_opt_compile_run_mode" in
+                    tmux_vertical)
+                        tmux_args="split-window -t '${kak_client_env_TMUX_PANE}' -v"
+                        ;;
+                    tmux_horizontal)
+                        tmux_args="split-window -t '${kak_client_env_TMUX_PANE}' -h"
+                        ;;
+                    tmux_popup)
+                        tmux_args="popup -E -t '${kak_client_env_TMUX_PANE}'"
+                        ;;
+                esac
+                printf "nop %%sh{ tmux %s kak -e 'set-option global compile_run_mode default; compile %s' }\n" "$tmux_args" "$*"
+                ;;
+        esac
+    }
+}
+
+define-command -docstring "Compile: run a command in a fifo buffer" compile -params 1.. %{
+    set-option global compile_last_command "%arg{@}"
+    compile-exec %arg{@}
+}
+
+define-command -docstring "Recompile: re-run the last compile command" recompile %{
+    evaluate-commands %sh{
+        if [ -z "$kak_opt_compile_last_command" ]; then
+            echo 'fail "No previous compile command"'
+        else
+            echo "compile-exec $kak_opt_compile_last_command"
+        fi
+    }
+}