diff --git a/.dotbot.conf.yaml b/.dotbot.conf.yaml index e00e7ca..fef3868 100644 --- a/.dotbot.conf.yaml +++ b/.dotbot.conf.yaml @@ -30,6 +30,7 @@ ~/.config/nvim: nvim ~/.config/oatmeal: oatmeal ~/.config/ranger: ranger + ~/.config/sesh: sesh ~/.config/sketchybar: sketchybar ~/.config/skhd: skhd ~/.config/starship.toml: prompt/starship.toml diff --git a/bin/d b/bin/d new file mode 100755 index 0000000..42f0230 --- /dev/null +++ b/bin/d @@ -0,0 +1,72 @@ +#!/bin/sh +# Shamelessly copied from Josh Medeski +# https://github.com/joshmedeski/dotfiles/blob/main/.config/bin/d + +# Get argument for script key/name, default to dev +DEV_SCRIPT="${1:-dev}" + +# First, check if the jq command is available +# AND there is a package.json file in the current directory +if command -v jq &>/dev/null && [[ -f "package.json" ]]; then + # if we have jq, + # then use it to extract the first occurence of a key in package.json's scripts object + # that starts with the argument passed in (or dev) + DEV_SCRIPT="$(jq \ + -r \ + --arg ds "$DEV_SCRIPT" \ + 'first(.scripts | keys[] | select(. | test("^\($ds)[^\"]*")))' \ + package.json)" + # if this didn't match anything, fallback to dev + DEV_SCRIPT="${DEV_SCRIPT:-dev}" +fi + +if [ -f "d" ]; then + ./d "$@" + exit 0 +fi + +if [ -f package-lock.json ]; then + echo "npm run $DEV_SCRIPT" + npm run "$DEV_SCRIPT" + exit 0 +fi + +if [ -f yarn.lock ]; then + echo "yarn $DEV_SCRIPT" + yarn "$DEV_SCRIPT" + exit 0 +fi + +if [ -f pnpm-lock.yaml ]; then + echo "pnpm run $DEV_SCRIPT" + pnpm run "$DEV_SCRIPT" + exit 0 +fi + +if [ -f bun.lockb ]; then + echo "bun $DEV_SCRIPT" + pnpm run "$DEV_SCRIPT" + exit 0 +fi + +BASE_NAME="$(basename "$(pwd)")" + +cd .. +if [ -f pnpm-lock.yaml ]; then + cd "$BASE_NAME" || exit + pnpm run "$DEV_SCRIPT" + exit 0 +fi + +PARENT_BASE_NAME="$(basename "$(pwd)")" + +cd .. +if [ -f pnpm-lock.yaml ]; then + cd "$PARENT_BASE_NAME" || exit + cd "$BASE_NAME" || exit + pnpm run "$DEV_SCRIPT" + exit 0 +fi + +echo " Node package not detected" +exit 1 diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 4e637f7..c3f1c61 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -21,7 +21,7 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "codewindow.nvim": { "branch": "master", "commit": "8c8f5ff66e123491c946c04848d744fcdc7cac6c" }, "committia.vim": { "branch": "master", "commit": "a187b8633694027ab5ef8a834527d33093282f95" }, - "conform.nvim": { "branch": "master", "commit": "a605ce4b2db397c84ae6fa8bcfc85f00b985bc73" }, + "conform.nvim": { "branch": "master", "commit": "67ee2258e08ccb91345d52f62484b657feccef25" }, "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, "dashboard-nvim": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, @@ -80,7 +80,7 @@ "nvim-dap-ruby": { "branch": "main", "commit": "a2248b7b31f6f096b9e847e769afd00060e0aae4" }, "nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "baa5b0dc6663284cce32e0d00ac1f2511b13496f" }, - "nvim-lint": { "branch": "master", "commit": "d78c8ab992f48890580653f74a362c6e5ef2eccc" }, + "nvim-lint": { "branch": "master", "commit": "03b1fc593638098a35de26d768d5f43b0fe57041" }, "nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, @@ -142,7 +142,7 @@ "vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" }, "vim-visincr": { "branch": "master", "commit": "57cd943a31b0b5ec36a884b5b5b8758843c74c1a" }, "vim-visual-multi": { "branch": "master", "commit": "fe1ec7e430013b83c8c2dee85ae496251b71e253" }, - "vim-wakatime": { "branch": "master", "commit": "285c2e4e48fb0c63ced233c00fb10a2edb3b6c94" }, + "vim-wakatime": { "branch": "master", "commit": "4faeea55c895b9f2d27ea1db68a68780b2e4585b" }, "vim-xtract": { "branch": "master", "commit": "65e47be935080f112f219b5f0bc1bf411c783f27" }, "vimux": { "branch": "master", "commit": "f7c41607d9246ec4b6cc28587cce84d75d106e3e" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, diff --git a/sesh/scripts/node_dev b/sesh/scripts/node_dev new file mode 100644 index 0000000..8c773d7 --- /dev/null +++ b/sesh/scripts/node_dev @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +tmux split-window -v -l 10 d +tmux select-pane -t :.+ +tmux send-keys "nvim +GoToFile" Enter diff --git a/sesh/scripts/open_files b/sesh/scripts/open_files new file mode 100644 index 0000000..fb66b03 --- /dev/null +++ b/sesh/scripts/open_files @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +tmux send-keys "nvim +GoToFile" Enter diff --git a/sesh/sesh.toml b/sesh/sesh.toml new file mode 100644 index 0000000..18567c9 --- /dev/null +++ b/sesh/sesh.toml @@ -0,0 +1,5 @@ +default_startup_script = "~/.config/sesh/scripts/open_files" + +[[startup_scripts]] +session_path = "~/Code/GitHub/websites/stefanimhoff-de" +script_path = "~/.config/sesh/scripts/node_dev"