From d03776e58316d31bf87240b3882897cb7beac877 Mon Sep 17 00:00:00 2001 From: aleidk Date: Wed, 23 Jul 2025 15:19:41 -0400 Subject: [PATCH] add task runner --- .../.config/fish/functions/split_run.fish | 31 +++++++++++++++++++ Configs/kitty/.config/kitty/kitty.conf | 2 ++ Configs/nvim/.config/nvim/lazy-lock.json | 2 ++ .../nvim/lua/aleidk/plugins/training.lua | 8 +++++ 4 files changed, 43 insertions(+) create mode 100644 Configs/fish/.config/fish/functions/split_run.fish create mode 100644 Configs/nvim/.config/nvim/lua/aleidk/plugins/training.lua diff --git a/Configs/fish/.config/fish/functions/split_run.fish b/Configs/fish/.config/fish/functions/split_run.fish new file mode 100644 index 0000000..1198e18 --- /dev/null +++ b/Configs/fish/.config/fish/functions/split_run.fish @@ -0,0 +1,31 @@ +function split_run + argparse mask r/restart -- $argv + or return + + if not set -qg MPROCS_PORT + set -gx MPROCS_PORT $(random 1024 2048) + kitten @ env "MPROCS_PORT=$MPROCS_PORT" + end + + if set -ql _flag_restart + # Send commands to server + mprocs --server "127.0.0.1:$MPROCS_PORT" --ctl "{c: restart-proc}" + return 0 + end + + + if set -ql _flag_mask + set -l cmd "mask $(mask --introspect | jq ".commands[] | [.name, .description] | @tsv" -r | fzf --accept-nth=1)" + # check if server is running + if nc -w 1 -zv 127.0.0.1 $MPROCS_PORT &>/dev/null + mprocs --server "127.0.0.1:$MPROCS_PORT" --ctl "{c: add-proc, cmd: \"$cmd\"}" + mprocs --server "127.0.0.1:$MPROCS_PORT" --ctl "{c: select-proc, index: 0}" + mprocs --server "127.0.0.1:$MPROCS_PORT" --ctl "{c: prev-proc}" + else + # Start server + kitten @ launch --cwd=current --location last --dont-take-focus mprocs --server "127.0.0.1:$MPROCS_PORT" "$cmd" + end + end + + +end diff --git a/Configs/kitty/.config/kitty/kitty.conf b/Configs/kitty/.config/kitty/kitty.conf index ce4f320..77d48f2 100644 --- a/Configs/kitty/.config/kitty/kitty.conf +++ b/Configs/kitty/.config/kitty/kitty.conf @@ -2003,6 +2003,8 @@ map ctrl+space>ctrl+v launch --location=split #:: . map ctrl+space>g launch --cwd=current --type=overlay --var lazy_float=true lazygit +map ctrl+p>ctrl+p launch --cwd=current --type=background fish -c 'split_run --restart' +map ctrl+space>p launch --cwd=current --type=overlay fish -c 'split_run --mask' #: New OS window diff --git a/Configs/nvim/.config/nvim/lazy-lock.json b/Configs/nvim/.config/nvim/lazy-lock.json index 3702b64..9fc7452 100644 --- a/Configs/nvim/.config/nvim/lazy-lock.json +++ b/Configs/nvim/.config/nvim/lazy-lock.json @@ -8,11 +8,13 @@ "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "fzf-lua": { "branch": "main", "commit": "758173f499d15410ecb50c5519a41b27c33e645d" }, "grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" }, + "hardtime.nvim": { "branch": "main", "commit": "3541ad24faff78274669eceaf130502eb7f1261a" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" }, "neogen": { "branch": "main", "commit": "b2e78708876f4da507839726816010a68e33fec8" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, "nvim-lspconfig": { "branch": "master", "commit": "b8e7957bde4cbb3cb25a13a62548f7c273b026e9" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, diff --git a/Configs/nvim/.config/nvim/lua/aleidk/plugins/training.lua b/Configs/nvim/.config/nvim/lua/aleidk/plugins/training.lua new file mode 100644 index 0000000..60e9071 --- /dev/null +++ b/Configs/nvim/.config/nvim/lua/aleidk/plugins/training.lua @@ -0,0 +1,8 @@ +return { + { + "m4xshen/hardtime.nvim", + lazy = false, + dependencies = { "MunifTanjim/nui.nvim" }, + opts = {}, + }, +}