From b024b8c828b47a970a7df1efb72c375d9da6a2ed Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 22 Jun 2023 17:17:26 +0200 Subject: [PATCH] helloo --- completions/_arduino-cli | 177 ++++++++++++++++++++ completions/init.zsh | 1 + configs/.zshrc | 3 +- configs/nvim/lazy-lock.json | 96 +++++------ configs/nvim/lua/max/plugins/arduino.lua | 10 ++ configs/nvim/lua/max/plugins/hologram.lua | 8 - configs/nvim/lua/max/plugins/lsp.lua | 12 +- configs/nvim/lua/max/plugins/oil.lua | 3 + configs/nvim/lua/max/plugins/toggleterm.lua | 35 ++++ configs/sway/config | 4 + configs/sway/scripts/debug-window | 2 + configs/sway/scripts/wl-present | 114 +++++++++++++ configs/waybar/config | 21 ++- configs/waybar/style.css | 11 ++ configs/wezterm/colors.lua | 1 + configs/wezterm/wezterm.lua | 167 +++++++++--------- configs/zsh/aliases.sh | 2 + 17 files changed, 521 insertions(+), 146 deletions(-) create mode 100644 completions/_arduino-cli create mode 100644 configs/nvim/lua/max/plugins/arduino.lua delete mode 100644 configs/nvim/lua/max/plugins/hologram.lua create mode 100755 configs/sway/scripts/wl-present diff --git a/completions/_arduino-cli b/completions/_arduino-cli new file mode 100644 index 0000000..83ac92b --- /dev/null +++ b/completions/_arduino-cli @@ -0,0 +1,177 @@ +#compdef _arduino-cli arduino-cli + +# zsh completion for arduino-cli -*- shell-script -*- + +__arduino-cli_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_arduino-cli() +{ + local shellCompDirectiveError=1 + local shellCompDirectiveNoSpace=2 + local shellCompDirectiveNoFileComp=4 + local shellCompDirectiveFilterFileExt=8 + local shellCompDirectiveFilterDirs=16 + + local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace + local -a completions + + __arduino-cli_debug "\n========= starting completion logic ==========" + __arduino-cli_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __arduino-cli_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __arduino-cli_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., arduino-cli -n=) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} __complete ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __arduino-cli_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __arduino-cli_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __arduino-cli_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%s\n" "${out[@]}") + __arduino-cli_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __arduino-cli_debug "No directive found. Setting do default" + directive=0 + fi + + __arduino-cli_debug "directive: ${directive}" + __arduino-cli_debug "completions: ${out}" + __arduino-cli_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __arduino-cli_debug "Completion received error. Ignoring completions." + return + fi + + while IFS='\n' read -r comp; do + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab=$(printf '\t') + comp=${comp//$tab/:} + + __arduino-cli_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%s\n" "${out[@]}") + + if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then + __arduino-cli_debug "Activating nospace." + noSpace="-S ''" + fi + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __arduino-cli_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subDir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __arduino-cli_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __arduino-cli_debug "Listing directories in ." + fi + + local result + _arguments '*:dirname:_files -/'" ${flagPrefix}" + result=$? + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + return $result + else + __arduino-cli_debug "Calling _describe" + if eval _describe "completions" completions $flagPrefix $noSpace; then + __arduino-cli_debug "_describe found some completions" + + # Return the success of having called _describe + return 0 + else + __arduino-cli_debug "_describe did not find completions." + __arduino-cli_debug "Checking if we should do file completion." + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __arduino-cli_debug "deactivating file completion" + + # We must return an error code here to let zsh know that there were no + # completions found by _describe; this is what will trigger other + # matching algorithms to attempt to find completions. + # For example zsh can match letters in the middle of words. + return 1 + else + # Perform file completion + __arduino-cli_debug "Activating file completion" + + # We must return the result of this command, so it must be the + # last command, or else we must store its result to return it. + _arguments '*:filename:_files'" ${flagPrefix}" + fi + fi + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_arduino-cli" ]; then + _arduino-cli +fi diff --git a/completions/init.zsh b/completions/init.zsh index 6a9723a..94b225a 100644 --- a/completions/init.zsh +++ b/completions/init.zsh @@ -5,5 +5,6 @@ fi compdef _fx fx; +compdef _arduino-cli arduino-cli; autoload -U compinit compinit diff --git a/configs/.zshrc b/configs/.zshrc index 46e1aff..fe26b23 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -143,5 +143,4 @@ export PNPM_HOME="/home/max/.local/share/pnpm" export PATH="$PNPM_HOME:$PATH" # pnpm end -# Fig post block. Keep at the bottom of this file. -[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh" +zvm_after_init_commands+=("bindkey '^[[A' up-line-or-search" "bindkey '^[[B' down-line-or-search") diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json index 0579987..8e64de1 100644 --- a/configs/nvim/lazy-lock.json +++ b/configs/nvim/lazy-lock.json @@ -1,71 +1,71 @@ { "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "8d6c0a93dec34900577ba725e91c44b8d3ca1f45" }, - "alpha-nvim": { "branch": "main", "commit": "87c204040e3f5d4c1c95067b35905d8f8a2f2545" }, + "LuaSnip": { "branch": "master", "commit": "a83e4b1ba7edc6fecdad09e39753a7d5eee1d01c" }, + "alpha-nvim": { "branch": "main", "commit": "1838ae926e8d49fe5330d1498ee8289ae2c340bc" }, + "arduino-helper.nvim": { "branch": "master", "commit": "5ec57de680a94f8e948e2e0c6328939b9b63a598" }, "autolist.nvim": { "branch": "main", "commit": "0936e384b10315f65b8ef3bf1be938314d23a528" }, - "barbar.nvim": { "branch": "master", "commit": "8edf23fe94a2486a8bc74cb64efb9211810f7e83" }, + "barbar.nvim": { "branch": "master", "commit": "f0212c318e0f118ccb0e6166198895f78aa87efd" }, "boole.nvim": { "branch": "main", "commit": "f4f9996f91159e54b8f1893b20e2e599c91bc1bd" }, - "catppuccin": { "branch": "main", "commit": "939be5f7fcbc15abeaad9214bb253a4551f6f6e6" }, + "catppuccin": { "branch": "main", "commit": "1d3eda15703ba70f57e94e6451db55914ff7017f" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "copilot-cmp": { "branch": "master", "commit": "99467081478aabe4f1183a19a8ba585e511adc20" }, - "copilot.lua": { "branch": "master", "commit": "decc8d43bcd73a288fa689690c20faf0485da217" }, + "copilot-cmp": { "branch": "master", "commit": "c2cdb3c0f5078b0619055af192295830a7987790" }, + "copilot.lua": { "branch": "master", "commit": "653bbdc44cd569a5fd0617e5a9d3df2b1359e230" }, "flit.nvim": { "branch": "main", "commit": "f60e4b3d49bb5a5e97cfffe66f2e671eb422078e" }, - "friendly-snippets": { "branch": "main", "commit": "b1b78a6433268fc172adb5a843e165035e83861e" }, - "git-conflict.nvim": { "branch": "main", "commit": "f2ed4dc910a7dd23f1762fc57c1986cfd210283b" }, - "gitsigns.nvim": { "branch": "main", "commit": "7d5a2132a54e1158990074b536de5c7d773126f5" }, - "hologram.nvim": { "branch": "main", "commit": "f5194f71ec1578d91b2e3119ff08e574e2eab542" }, - "lazy.nvim": { "branch": "main", "commit": "5c89dc52f42e5058a46b0912d7d9042f564e44e0" }, - "leap.nvim": { "branch": "main", "commit": "0eb3611593e135150e2f7880ec67568ccb51c17a" }, + "friendly-snippets": { "branch": "main", "commit": "ef6547d2f586e08e071efeebac835e545f3015cc" }, + "git-conflict.nvim": { "branch": "main", "commit": "8d962d83cae924a314965f738ed1e05a4000d682" }, + "gitsigns.nvim": { "branch": "main", "commit": "f868d82a36f7f7f5e110eb0a9659993984f59875" }, + "lazy.nvim": { "branch": "main", "commit": "97c2f8858c43bc9124b8b43369a1a5862deef817" }, + "leap.nvim": { "branch": "main", "commit": "be918a8e6aa00a6cfa7270d4bfcc11b2f80d6902" }, "lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" }, - "lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, - "lspsaga.nvim": { "branch": "main", "commit": "c483c9b43fa6cb47fb8c18a8ebd4ece45bbf07f4" }, + "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, + "lspsaga.nvim": { "branch": "main", "commit": "01b9633aefd010f272d6c7e3d8293c44fcfe7696" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, - "lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "7034065099c1665143091c7282b3b1b8f0b23783" }, - "mason.nvim": { "branch": "main", "commit": "4b357eded58ef0993fb49a591ed70306c6b44e08" }, - "mini.nvim": { "branch": "main", "commit": "590ac69a6c249ee94c390ab4b46147480409b646" }, - "neo-tree.nvim": { "branch": "v2.x", "commit": "7a6b0d43d70636edfec183fb49c02f725765da73" }, + "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f0ce33f4794a2364eb08d09d09380e8b04ec5e6a" }, + "mason.nvim": { "branch": "main", "commit": "08b2fd308e0107eab9f0b59d570b69089fd0b522" }, + "mini.nvim": { "branch": "main", "commit": "09476036cbaa7676172f7dd37a26a51a92388aab" }, + "neo-tree.nvim": { "branch": "v2.x", "commit": "8c89efb93b8383666a6f989762c2f610f5f2c930" }, "neoai.nvim": { "branch": "main", "commit": "b90180e30d143afb71490b92b08c1e9121d4416a" }, - "neotest": { "branch": "master", "commit": "8d279ac31542553461f5377db1596ae52e042d00" }, + "neotest": { "branch": "master", "commit": "6435a367a57f267039c4c69a723cec09ae61b17e" }, "neotest-jest": { "branch": "main", "commit": "22b1050dda3ebd401780ec4b8e193cf52523a4da" }, "neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" }, - "noice.nvim": { "branch": "main", "commit": "7bd435a48a2d2b3f028c633126e3f669ae6b902f" }, - "nui.nvim": { "branch": "main", "commit": "ecd9def93891b9260b15b5fcef542eaabf4145c9" }, - "null-ls.nvim": { "branch": "main", "commit": "f8ffcd7cb8fb3325c711d459152ef132b5b65aed" }, - "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, + "noice.nvim": { "branch": "main", "commit": "1478f7295806d354e7689edc2a58f3bc2e697f78" }, + "nui.nvim": { "branch": "main", "commit": "2b2732528e4a79eb8542568bd51d25f710395bd6" }, + "null-ls.nvim": { "branch": "main", "commit": "77e53bc3bac34cc273be8ed9eb9ab78bcf67fa48" }, + "nvim-cmp": { "branch": "main", "commit": "a0225043ab823fcad8d0d802e276d9838fb48c30" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, - "nvim-dap": { "branch": "master", "commit": "debd7c2f80eaf20c5f5df25db8d8c1b9b18f4421" }, - "nvim-dap-ui": { "branch": "master", "commit": "286f682f366fbc652b38dff893569374e9433dd3" }, + "nvim-dap": { "branch": "master", "commit": "56118cee6af15cb9ddba9d080880949d8eeb0c9f" }, + "nvim-dap-ui": { "branch": "master", "commit": "4ce7b97dd8f50b4f672948a34bf8f3a56214fdb8" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, - "nvim-lspconfig": { "branch": "master", "commit": "eddaef928c1e1dd79a96f5db45f2fd7f2efe7ea0" }, - "nvim-notify": { "branch": "master", "commit": "159c6cf1be25a933f35e97499314c9faab55c98f" }, + "nvim-lspconfig": { "branch": "master", "commit": "465042c0f786992212284311ebb5da1f89479774" }, + "nvim-notify": { "branch": "master", "commit": "f3024b912073774111202f5fa6518b0cd2a74432" }, "nvim-recorder": { "branch": "main", "commit": "0f6dec901a530c41095cff8def0c723877374cb4" }, - "nvim-scrollbar": { "branch": "main", "commit": "f85b29805cf917f9b1d5ff0c9a52c5b1bdca5943" }, - "nvim-toggleterm.lua": { "branch": "main", "commit": "1c5996ee3c30b54751093fe68d40676859e7778f" }, - "nvim-treesitter": { "branch": "master", "commit": "654216eb04f3fdf0f847ff2d410319fba6cee847" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" }, - "nvim-ts-autotag": { "branch": "main", "commit": "26761ba6848d814605a629bc8d2694eeb1e48007" }, + "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, + "nvim-toggleterm.lua": { "branch": "main", "commit": "a44313fb28ed9bc9837c2b99dec1c6eed3a4f47f" }, + "nvim-treesitter": { "branch": "master", "commit": "a76db88548bb7fe008cd7e4f2d2ec2ccc080dede" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "95b76b95eff25e1e64f363938cd853852355d70a" }, + "nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" }, - "nvim-web-devicons": { "branch": "master", "commit": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e" }, - "oil.nvim": { "branch": "master", "commit": "3ac035e5ac448ce898c9aad7158a47378be4e85a" }, - "persisted.nvim": { "branch": "main", "commit": "dbdd6af1847105f5cc7f7c51a648b32a78598eec" }, - "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, + "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, + "oil.nvim": { "branch": "master", "commit": "64d2f305d30cec13938aa99f8f13bd84c502e020" }, + "persisted.nvim": { "branch": "main", "commit": "c58219567d9b0ad3c1f1e30a76df996e54ccab60" }, + "plenary.nvim": { "branch": "master", "commit": "52544825d6b8be677eb395983515ad5e30ae1f2e" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, - "rest.nvim": { "branch": "main", "commit": "df826bc0a76d5eb79b458db894d47a5538b454fe" }, - "sniprun": { "branch": "master", "commit": "7afcd7797e2d265732c718264f95e093bae9acfe" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, - "telescope.nvim": { "branch": "master", "commit": "6258d50b09f9ae087317e392efe7c05a7323492d" }, - "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, - "translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" }, - "trouble.nvim": { "branch": "main", "commit": "d56bfc0c501ced4002a57cb60433362fb2ce9c4d" }, + "rest.nvim": { "branch": "main", "commit": "d8dc204e9f6fd930d9d1d709f0d19138f804431a" }, + "sniprun": { "branch": "master", "commit": "83791b87a8ede5275a2c060605bf1fec782205cc" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, + "telescope.nvim": { "branch": "master", "commit": "6d3fbffe426794296a77bb0b37b6ae0f4f14f807" }, + "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" }, + "translate.nvim": { "branch": "main", "commit": "35b71090a398eaca4d7cd2478f6a09d0fa3130bd" }, + "trouble.nvim": { "branch": "main", "commit": "324c977cfeacb8498ca9ba1c74cc35bd18858a8d" }, "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }, - "vim-dadbod": { "branch": "master", "commit": "3f57c0cd41523423fd781422dfc833820095a3e8" }, - "vim-dadbod-completion": { "branch": "master", "commit": "e71eb6140556c5ced80de6299a1fdfe22bd3c1b1" }, - "vim-dadbod-ui": { "branch": "master", "commit": "4c306bef457ebfdbe71c76b49672d48ef310ddd3" }, - "which-key.nvim": { "branch": "main", "commit": "94cb020ff33a1e0e22fac1c41663d2c439741f17" } + "vim-dadbod": { "branch": "master", "commit": "7d80bbd11c407a09e0f7b869c38f3dec3902805f" }, + "vim-dadbod-completion": { "branch": "master", "commit": "fc7321a17f4c55db11fae89a884ddf4724020bae" }, + "vim-dadbod-ui": { "branch": "master", "commit": "36a67e67926345c0b11b32c378c057c7f9d9110d" }, + "which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" } } \ No newline at end of file diff --git a/configs/nvim/lua/max/plugins/arduino.lua b/configs/nvim/lua/max/plugins/arduino.lua new file mode 100644 index 0000000..ef38e04 --- /dev/null +++ b/configs/nvim/lua/max/plugins/arduino.lua @@ -0,0 +1,10 @@ +return { + "vlelo/arduino-helper.nvim", + lazy = false, + setup = function() + vim.notify("Setup") + require("arduino-helper").setup { + ui = "telescope", + } + end +} diff --git a/configs/nvim/lua/max/plugins/hologram.lua b/configs/nvim/lua/max/plugins/hologram.lua deleted file mode 100644 index 79f2ad4..0000000 --- a/configs/nvim/lua/max/plugins/hologram.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "edluffy/hologram.nvim", - ft = "markdown", - lazy = false, - opts = { - auto_display = true, - } -} diff --git a/configs/nvim/lua/max/plugins/lsp.lua b/configs/nvim/lua/max/plugins/lsp.lua index e9686a8..0cdb222 100644 --- a/configs/nvim/lua/max/plugins/lsp.lua +++ b/configs/nvim/lua/max/plugins/lsp.lua @@ -31,7 +31,7 @@ return { }, should_attach = function() return lsp.util.root_pattern(".eslintrc", ".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.json")( - vim.fn.expand("%:p")) ~= nil; + vim.fn.expand("%:p")) ~= nil; end, }) @@ -162,6 +162,16 @@ return { }, } + -- custom_lsp['arduino_language_server'] = { + -- on_new_config = require("arduino").on_new_config, + -- } + + -- custom_lsp.clangd = { + -- cmd = { "clangd", + -- "--query-driver=/home/max/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/**/bin/xtensa-esp32-elf-*" }, + -- root_dir = lsp.util.root_pattern('build/compile_commands.json', '.git'), + -- } + custom_lsp.rust_analyzer = { settings = { ["rust-analyzer"] = { diff --git a/configs/nvim/lua/max/plugins/oil.lua b/configs/nvim/lua/max/plugins/oil.lua index a013bce..27ba6b4 100644 --- a/configs/nvim/lua/max/plugins/oil.lua +++ b/configs/nvim/lua/max/plugins/oil.lua @@ -1,4 +1,7 @@ return { "stevearc/oil.nvim", + cmd = { + "Oil" + }, config = true } diff --git a/configs/nvim/lua/max/plugins/toggleterm.lua b/configs/nvim/lua/max/plugins/toggleterm.lua index c52feeb..cbea8f0 100644 --- a/configs/nvim/lua/max/plugins/toggleterm.lua +++ b/configs/nvim/lua/max/plugins/toggleterm.lua @@ -22,6 +22,41 @@ return { vim.api.nvim_set_keymap("n", "", "lua _Lazygit_toggle()", { noremap = true, silent = true }) + + + local arduinoMonitor = Terminal:new({ + cmd = "arduino-cli monitor -p /dev/ttyUSB0", + direction = "horizontal", + float_opts = { + winblend = 0, + padding = 10, + border = "single", + }, + on_close = function() + Terminal:close() + end, + }) + vim.api.nvim_create_user_command("ArduinoMonitor", function() + arduinoMonitor:toggle() + end, {}) + + local arduinoUpload = Terminal:new({ + cmd = "arduino-cli compile --upload", + direction = "horizontal", + float_opts = { + winblend = 0, + padding = 10, + border = "single", + }, + on_close = function() + Terminal:close() + end, + }) + vim.api.nvim_create_user_command("ArduinoUpload", function() + arduinoUpload:toggle() + end, {}) + + local pnpm = Terminal:new({ dir = "git_dir", direction = "float", diff --git a/configs/sway/config b/configs/sway/config index 62c6be8..ccf8da4 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -63,8 +63,11 @@ set $select_wifi $wofi_scripts/select-wifi input * { xkb_layout de xkb_capslock disabled + } +input "type:keyboard" xkb_options caps:escape + smart_gaps off gaps inner 3 gaps outer 3 @@ -213,6 +216,7 @@ input "1739:24385:Synaptics_TM2438-005" { set $ws3 "3:  Music" assign [class="Spotify"] $ws3 assign [class="spotify"] $ws3 + assign [app_id="feishin"] $ws3 assign [app_id="dev.alextren.Spot"] $ws3 set $ws4 "4:  Chat" diff --git a/configs/sway/scripts/debug-window b/configs/sway/scripts/debug-window index 93f4c5c..884513f 100755 --- a/configs/sway/scripts/debug-window +++ b/configs/sway/scripts/debug-window @@ -26,7 +26,9 @@ function getprop() { SELECT_ID=$(echo ".. | (.nodes? // empty)[] | select(.id == $window_id) | $CLEAR_OBJ ") selected="$(swaymsg -t get_tree | jq -r "$ALL_NODES" | jq -c ". | select(.id==$window_id)" | jq)" echo "$selected" + echo "$selected" > /tmp/sway_debug_window.json notify-send "Debug:" "$(echo $selected | jq -c "$CLEAR_OBJ" | jq)"; + wezterm start -- nvim /tmp/sway_debug_window.json; fi } diff --git a/configs/sway/scripts/wl-present b/configs/sway/scripts/wl-present new file mode 100755 index 0000000..ab6dcc8 --- /dev/null +++ b/configs/sway/scripts/wl-present @@ -0,0 +1,114 @@ +#!/bin/bash + +usage() { + echo "usage: wl-present [argument]" + echo + echo "start wl-mirror and control the mirrored output and region in a convenient way" + echo + echo "commands:" + echo " help show this help" + echo " mirror [output] start wl-mirror on output [output] (default asks via slurp)" + echo " set-output [output] set the recorded output (default asks via slurp)" + echo " set-region [region] set the recorded region (default asks via slurp)" + echo " set-scaling [scale] set the scaling mode (default asks via rofi)" + echo " freeze freeze the screen" + echo " unfreeze resume the screen capture after freeze" + echo " toggle-freeze toggle freeze state of screen capture" + echo " custom [options] send custom options to wl-mirror (default asks via rofi)" + echo + echo "dependencies:" + echo " wl-mirror, pipectl, slurp, and rofi or dmenu" + exit 0 +} + +type -p rofi >/dev/null +if [[ $? -eq 0 ]]; then + DMENU=dmenu-rofi +else + DMENU=dmenu +fi + +dmenu-rofi() { + rofi -dmenu -width 30 -columns 1 "$@" +} + +slurp-output() { + slurp -b \#00000000 -B \#00000000 -c \#859900 -w 4 -f %o -or 2>/dev/null +} + +slurp-region() { + slurp -b \#00000000 -c \#859900 -w 2 2>/dev/null +} + +mirror() { + pipectl -n wl-present -o | wl-mirror -S "$1" +} + +mirror-cmd() { + pipectl -n wl-present -i <<< "$1" +} + +set-output() { + mirror-cmd "$1" +} + +set-region() { + mirror-cmd "-r '$1'" +} + +set-scaling() { + mirror-cmd "-s $1" +} + +ask-output() { + slurp-output + [[ $? -ne 0 ]] && exit 1 +} + +ask-region() { + slurp-region + [[ $? -ne 0 ]] && exit 1 +} + +ask-scaling() { + (echo linear; echo nearest; echo exact) | "$DMENU" -p "wl-present scaling" + [[ $? -ne 0 ]] && exit 1 +} + +ask-custom() { + cat < box { color: #fe8019; } + +#tray > widget > * { + margin-right:8px; +} + +#tray > widget:last-child > * { + margin-right:0px; +} + #custom-power-consumption, #custom-power-profile, #custom-dpi, #custom-theme, #pulseaudio, #battery, +#tray, +#custom-pacman, #network { /* margin: 0px 5px; */ /* padding: 0px 5px; */ diff --git a/configs/wezterm/colors.lua b/configs/wezterm/colors.lua index 80df899..597be5c 100644 --- a/configs/wezterm/colors.lua +++ b/configs/wezterm/colors.lua @@ -1,4 +1,5 @@ return { + transparent = "none", rosewater = "#F4DBD6", flamingo = "#F0C6C6", pink = "#F5BDE6", diff --git a/configs/wezterm/wezterm.lua b/configs/wezterm/wezterm.lua index d1e0931..ad11e19 100644 --- a/configs/wezterm/wezterm.lua +++ b/configs/wezterm/wezterm.lua @@ -32,7 +32,6 @@ end) local os_config = {} if wezterm.target_triple == 'x86_64-pc-windows-msvc' then - local wsl_domains = wezterm.default_wsl_domains() for _, dom in ipairs(wsl_domains) do dom.default_cwd = "/home/max" @@ -52,6 +51,71 @@ else } end +local _colors = { + split = colors.surface0, + foreground = colors.text, + background = colors.black, + cursor_bg = colors.rosewater, + cursor_border = colors.rosewater, + cursor_fg = colors.base, + selection_bg = colors.surface2, + selection_fg = colors.text, + visual_bell = colors.surface0, + indexed = { + [16] = colors.peach, + [17] = colors.rosewater, + }, + scrollbar_thumb = colors.surface2, + compose_cursor = colors.flamingo, + ansi = { + colors.surface1, + colors.red, + colors.green, + colors.yellow, + colors.blue, + colors.pink, + colors.teal, + colors.subtext0, + }, + brights = { + colors.subtext0, + colors.red, + colors.green, + colors.yellow, + colors.blue, + colors.pink, + colors.teal, + colors.surface1, + }, + tab_bar = { + background = colors.crust, + active_tab = { + bg_color = "none", + fg_color = colors.subtext1, + intensity = "Bold", + underline = "None", + italic = false, + strikethrough = false, + }, + inactive_tab = { + bg_color = colors.crust, + fg_color = colors.surface2, + }, + inactive_tab_hover = { + bg_color = colors.mantle, + fg_color = colors.subtext0, + }, + new_tab = { + bg_color = colors.crust, + fg_color = colors.subtext0, + }, + new_tab_hover = { + bg_color = colors.crust, + fg_color = colors.subtext0, + }, + }, +} + return utils.merge({ font = wezterm.font_with_fallback({ "Liga SFMono Nerd Font", @@ -84,97 +148,34 @@ return utils.merge({ tab_max_width = 50, hide_tab_bar_if_only_one_tab = true, disable_default_key_bindings = false, - colors = { - split = colors.surface0, - foreground = colors.text, - background = colors.base, - cursor_bg = colors.rosewater, - cursor_border = colors.rosewater, - cursor_fg = colors.base, - selection_bg = colors.surface2, - selection_fg = colors.text, - visual_bell = colors.surface0, - indexed = { - [16] = colors.peach, - [17] = colors.rosewater, - }, - scrollbar_thumb = colors.surface2, - compose_cursor = colors.flamingo, - ansi = { - colors.surface1, - colors.red, - colors.green, - colors.yellow, - colors.blue, - colors.pink, - colors.teal, - colors.subtext0, - }, - brights = { - colors.subtext0, - colors.red, - colors.green, - colors.yellow, - colors.blue, - colors.pink, - colors.teal, - colors.surface1, - }, - tab_bar = { - background = colors.crust, - active_tab = { - bg_color = "none", - fg_color = colors.subtext1, - intensity = "Bold", - underline = "None", - italic = false, - strikethrough = false, - }, - inactive_tab = { - bg_color = colors.crust, - fg_color = colors.surface2, - }, - inactive_tab_hover = { - bg_color = colors.mantle, - fg_color = colors.subtext0, - }, - new_tab = { - bg_color = colors.crust, - fg_color = colors.subtext0, - }, - new_tab_hover = { - bg_color = colors.crust, - fg_color = colors.subtext0, - }, - }, - }, - color_scheme = "3024 Night", + color_scheme = '3024 Night', + colors = _colors, leader = { key = "a", mods = "CTRL" }, keys = { -- Keybindings similar to tmux - { key = "-", mods = "LEADER", action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } }, - { key = "|", mods = "LEADER", action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } }, + { key = "-", mods = "LEADER", action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } }, + { key = "|", mods = "LEADER", action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } }, -- - { key = "z", mods = "LEADER", action = "TogglePaneZoomState" }, - { key = "c", mods = "LEADER", action = wezterm.action { SpawnTab = "CurrentPaneDomain" } }, + { key = "z", mods = "LEADER", action = "TogglePaneZoomState" }, + { key = "c", mods = "LEADER", action = wezterm.action { SpawnTab = "CurrentPaneDomain" } }, -- - { key = "n", mods = "LEADER", action = wezterm.action.ActivateTabRelative(1) }, - { key = "p", mods = "LEADER", action = wezterm.action.ActivateTabRelative(-1) }, + { key = "n", mods = "LEADER", action = wezterm.action.ActivateTabRelative(1) }, + { key = "p", mods = "LEADER", action = wezterm.action.ActivateTabRelative(-1) }, -- - { key = "h", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Left" }) }, - { key = "l", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Right" }) }, - { key = "k", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Up" }) }, - { key = "j", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Down" }) }, + { key = "h", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Left" }) }, + { key = "l", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Right" }) }, + { key = "k", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Up" }) }, + { key = "j", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Down" }) }, -- - { key = "H", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Left", 2 } }) }, - { key = "L", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Right", 2 } }) }, - { key = "J", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Down", 2 } }) }, - { key = "K", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Up", 2 } }) }, + { key = "H", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Left", 2 } }) }, + { key = "L", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Right", 2 } }) }, + { key = "J", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Down", 2 } }) }, + { key = "K", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Up", 2 } }) }, --- - { key = 'P', mods = 'CMD|SHIFT', action = wezterm.action.ActivateCommandPalette, }, - { key = 'U', mods = 'CMD|SHIFT', action = wezterm.action.Nop, }, - { key = 'F11', mods = '', action = wezterm.action.ToggleFullScreen, }, + { key = 'P', mods = 'CMD|SHIFT', action = wezterm.action.ActivateCommandPalette, }, + { key = 'U', mods = 'CMD|SHIFT', action = wezterm.action.Nop, }, + { key = 'F11', mods = '', action = wezterm.action.ToggleFullScreen, }, }, hyperlink_rules = { { diff --git a/configs/zsh/aliases.sh b/configs/zsh/aliases.sh index d3de28b..b6f04a0 100644 --- a/configs/zsh/aliases.sh +++ b/configs/zsh/aliases.sh @@ -55,6 +55,8 @@ alias p="git pull" alias lt="tree -L 2 --filelimit 150 --dirsfirst" +alias captive="xdg-open http://$(ip --oneline route get 1.1.1.1 | awk '{print $3}')" + if docker compose &> /dev/null then alias dc="sudo docker compose"