This commit is contained in:
max_richter 2023-06-22 17:17:26 +02:00
parent 2d81e0a579
commit b024b8c828
17 changed files with 521 additions and 146 deletions

177
completions/_arduino-cli Normal file
View File

@ -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=<TAB>)
# 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

View File

@ -5,5 +5,6 @@ fi
compdef _fx fx; compdef _fx fx;
compdef _arduino-cli arduino-cli;
autoload -U compinit autoload -U compinit
compinit compinit

View File

@ -143,5 +143,4 @@ export PNPM_HOME="/home/max/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH" export PATH="$PNPM_HOME:$PATH"
# pnpm end # pnpm end
# Fig post block. Keep at the bottom of this file. zvm_after_init_commands+=("bindkey '^[[A' up-line-or-search" "bindkey '^[[B' down-line-or-search")
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"

View File

@ -1,71 +1,71 @@
{ {
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "8d6c0a93dec34900577ba725e91c44b8d3ca1f45" }, "LuaSnip": { "branch": "master", "commit": "a83e4b1ba7edc6fecdad09e39753a7d5eee1d01c" },
"alpha-nvim": { "branch": "main", "commit": "87c204040e3f5d4c1c95067b35905d8f8a2f2545" }, "alpha-nvim": { "branch": "main", "commit": "1838ae926e8d49fe5330d1498ee8289ae2c340bc" },
"arduino-helper.nvim": { "branch": "master", "commit": "5ec57de680a94f8e948e2e0c6328939b9b63a598" },
"autolist.nvim": { "branch": "main", "commit": "0936e384b10315f65b8ef3bf1be938314d23a528" }, "autolist.nvim": { "branch": "main", "commit": "0936e384b10315f65b8ef3bf1be938314d23a528" },
"barbar.nvim": { "branch": "master", "commit": "8edf23fe94a2486a8bc74cb64efb9211810f7e83" }, "barbar.nvim": { "branch": "master", "commit": "f0212c318e0f118ccb0e6166198895f78aa87efd" },
"boole.nvim": { "branch": "main", "commit": "f4f9996f91159e54b8f1893b20e2e599c91bc1bd" }, "boole.nvim": { "branch": "main", "commit": "f4f9996f91159e54b8f1893b20e2e599c91bc1bd" },
"catppuccin": { "branch": "main", "commit": "939be5f7fcbc15abeaad9214bb253a4551f6f6e6" }, "catppuccin": { "branch": "main", "commit": "1d3eda15703ba70f57e94e6451db55914ff7017f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"copilot-cmp": { "branch": "master", "commit": "99467081478aabe4f1183a19a8ba585e511adc20" }, "copilot-cmp": { "branch": "master", "commit": "c2cdb3c0f5078b0619055af192295830a7987790" },
"copilot.lua": { "branch": "master", "commit": "decc8d43bcd73a288fa689690c20faf0485da217" }, "copilot.lua": { "branch": "master", "commit": "653bbdc44cd569a5fd0617e5a9d3df2b1359e230" },
"flit.nvim": { "branch": "main", "commit": "f60e4b3d49bb5a5e97cfffe66f2e671eb422078e" }, "flit.nvim": { "branch": "main", "commit": "f60e4b3d49bb5a5e97cfffe66f2e671eb422078e" },
"friendly-snippets": { "branch": "main", "commit": "b1b78a6433268fc172adb5a843e165035e83861e" }, "friendly-snippets": { "branch": "main", "commit": "ef6547d2f586e08e071efeebac835e545f3015cc" },
"git-conflict.nvim": { "branch": "main", "commit": "f2ed4dc910a7dd23f1762fc57c1986cfd210283b" }, "git-conflict.nvim": { "branch": "main", "commit": "8d962d83cae924a314965f738ed1e05a4000d682" },
"gitsigns.nvim": { "branch": "main", "commit": "7d5a2132a54e1158990074b536de5c7d773126f5" }, "gitsigns.nvim": { "branch": "main", "commit": "f868d82a36f7f7f5e110eb0a9659993984f59875" },
"hologram.nvim": { "branch": "main", "commit": "f5194f71ec1578d91b2e3119ff08e574e2eab542" }, "lazy.nvim": { "branch": "main", "commit": "97c2f8858c43bc9124b8b43369a1a5862deef817" },
"lazy.nvim": { "branch": "main", "commit": "5c89dc52f42e5058a46b0912d7d9042f564e44e0" }, "leap.nvim": { "branch": "main", "commit": "be918a8e6aa00a6cfa7270d4bfcc11b2f80d6902" },
"leap.nvim": { "branch": "main", "commit": "0eb3611593e135150e2f7880ec67568ccb51c17a" },
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" }, "lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
"lspsaga.nvim": { "branch": "main", "commit": "c483c9b43fa6cb47fb8c18a8ebd4ece45bbf07f4" }, "lspsaga.nvim": { "branch": "main", "commit": "01b9633aefd010f272d6c7e3d8293c44fcfe7696" },
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
"lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "7034065099c1665143091c7282b3b1b8f0b23783" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "f0ce33f4794a2364eb08d09d09380e8b04ec5e6a" },
"mason.nvim": { "branch": "main", "commit": "4b357eded58ef0993fb49a591ed70306c6b44e08" }, "mason.nvim": { "branch": "main", "commit": "08b2fd308e0107eab9f0b59d570b69089fd0b522" },
"mini.nvim": { "branch": "main", "commit": "590ac69a6c249ee94c390ab4b46147480409b646" }, "mini.nvim": { "branch": "main", "commit": "09476036cbaa7676172f7dd37a26a51a92388aab" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "7a6b0d43d70636edfec183fb49c02f725765da73" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "8c89efb93b8383666a6f989762c2f610f5f2c930" },
"neoai.nvim": { "branch": "main", "commit": "b90180e30d143afb71490b92b08c1e9121d4416a" }, "neoai.nvim": { "branch": "main", "commit": "b90180e30d143afb71490b92b08c1e9121d4416a" },
"neotest": { "branch": "master", "commit": "8d279ac31542553461f5377db1596ae52e042d00" }, "neotest": { "branch": "master", "commit": "6435a367a57f267039c4c69a723cec09ae61b17e" },
"neotest-jest": { "branch": "main", "commit": "22b1050dda3ebd401780ec4b8e193cf52523a4da" }, "neotest-jest": { "branch": "main", "commit": "22b1050dda3ebd401780ec4b8e193cf52523a4da" },
"neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" }, "neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" },
"noice.nvim": { "branch": "main", "commit": "7bd435a48a2d2b3f028c633126e3f669ae6b902f" }, "noice.nvim": { "branch": "main", "commit": "1478f7295806d354e7689edc2a58f3bc2e697f78" },
"nui.nvim": { "branch": "main", "commit": "ecd9def93891b9260b15b5fcef542eaabf4145c9" }, "nui.nvim": { "branch": "main", "commit": "2b2732528e4a79eb8542568bd51d25f710395bd6" },
"null-ls.nvim": { "branch": "main", "commit": "f8ffcd7cb8fb3325c711d459152ef132b5b65aed" }, "null-ls.nvim": { "branch": "main", "commit": "77e53bc3bac34cc273be8ed9eb9ab78bcf67fa48" },
"nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, "nvim-cmp": { "branch": "main", "commit": "a0225043ab823fcad8d0d802e276d9838fb48c30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-dap": { "branch": "master", "commit": "debd7c2f80eaf20c5f5df25db8d8c1b9b18f4421" }, "nvim-dap": { "branch": "master", "commit": "56118cee6af15cb9ddba9d080880949d8eeb0c9f" },
"nvim-dap-ui": { "branch": "master", "commit": "286f682f366fbc652b38dff893569374e9433dd3" }, "nvim-dap-ui": { "branch": "master", "commit": "4ce7b97dd8f50b4f672948a34bf8f3a56214fdb8" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
"nvim-lspconfig": { "branch": "master", "commit": "eddaef928c1e1dd79a96f5db45f2fd7f2efe7ea0" }, "nvim-lspconfig": { "branch": "master", "commit": "465042c0f786992212284311ebb5da1f89479774" },
"nvim-notify": { "branch": "master", "commit": "159c6cf1be25a933f35e97499314c9faab55c98f" }, "nvim-notify": { "branch": "master", "commit": "f3024b912073774111202f5fa6518b0cd2a74432" },
"nvim-recorder": { "branch": "main", "commit": "0f6dec901a530c41095cff8def0c723877374cb4" }, "nvim-recorder": { "branch": "main", "commit": "0f6dec901a530c41095cff8def0c723877374cb4" },
"nvim-scrollbar": { "branch": "main", "commit": "f85b29805cf917f9b1d5ff0c9a52c5b1bdca5943" }, "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "1c5996ee3c30b54751093fe68d40676859e7778f" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "a44313fb28ed9bc9837c2b99dec1c6eed3a4f47f" },
"nvim-treesitter": { "branch": "master", "commit": "654216eb04f3fdf0f847ff2d410319fba6cee847" }, "nvim-treesitter": { "branch": "master", "commit": "a76db88548bb7fe008cd7e4f2d2ec2ccc080dede" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "95b76b95eff25e1e64f363938cd853852355d70a" },
"nvim-ts-autotag": { "branch": "main", "commit": "26761ba6848d814605a629bc8d2694eeb1e48007" }, "nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" },
"nvim-web-devicons": { "branch": "master", "commit": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e" }, "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" },
"oil.nvim": { "branch": "master", "commit": "3ac035e5ac448ce898c9aad7158a47378be4e85a" }, "oil.nvim": { "branch": "master", "commit": "64d2f305d30cec13938aa99f8f13bd84c502e020" },
"persisted.nvim": { "branch": "main", "commit": "dbdd6af1847105f5cc7f7c51a648b32a78598eec" }, "persisted.nvim": { "branch": "main", "commit": "c58219567d9b0ad3c1f1e30a76df996e54ccab60" },
"plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, "plenary.nvim": { "branch": "master", "commit": "52544825d6b8be677eb395983515ad5e30ae1f2e" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"rest.nvim": { "branch": "main", "commit": "df826bc0a76d5eb79b458db894d47a5538b454fe" }, "rest.nvim": { "branch": "main", "commit": "d8dc204e9f6fd930d9d1d709f0d19138f804431a" },
"sniprun": { "branch": "master", "commit": "7afcd7797e2d265732c718264f95e093bae9acfe" }, "sniprun": { "branch": "master", "commit": "83791b87a8ede5275a2c060605bf1fec782205cc" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope.nvim": { "branch": "master", "commit": "6258d50b09f9ae087317e392efe7c05a7323492d" }, "telescope.nvim": { "branch": "master", "commit": "6d3fbffe426794296a77bb0b37b6ae0f4f14f807" },
"todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" },
"translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" }, "translate.nvim": { "branch": "main", "commit": "35b71090a398eaca4d7cd2478f6a09d0fa3130bd" },
"trouble.nvim": { "branch": "main", "commit": "d56bfc0c501ced4002a57cb60433362fb2ce9c4d" }, "trouble.nvim": { "branch": "main", "commit": "324c977cfeacb8498ca9ba1c74cc35bd18858a8d" },
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }, "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
"vim-dadbod": { "branch": "master", "commit": "3f57c0cd41523423fd781422dfc833820095a3e8" }, "vim-dadbod": { "branch": "master", "commit": "7d80bbd11c407a09e0f7b869c38f3dec3902805f" },
"vim-dadbod-completion": { "branch": "master", "commit": "e71eb6140556c5ced80de6299a1fdfe22bd3c1b1" }, "vim-dadbod-completion": { "branch": "master", "commit": "fc7321a17f4c55db11fae89a884ddf4724020bae" },
"vim-dadbod-ui": { "branch": "master", "commit": "4c306bef457ebfdbe71c76b49672d48ef310ddd3" }, "vim-dadbod-ui": { "branch": "master", "commit": "36a67e67926345c0b11b32c378c057c7f9d9110d" },
"which-key.nvim": { "branch": "main", "commit": "94cb020ff33a1e0e22fac1c41663d2c439741f17" } "which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" }
} }

View File

@ -0,0 +1,10 @@
return {
"vlelo/arduino-helper.nvim",
lazy = false,
setup = function()
vim.notify("Setup")
require("arduino-helper").setup {
ui = "telescope",
}
end
}

View File

@ -1,8 +0,0 @@
return {
"edluffy/hologram.nvim",
ft = "markdown",
lazy = false,
opts = {
auto_display = true,
}
}

View File

@ -31,7 +31,7 @@ return {
}, },
should_attach = function() should_attach = function()
return lsp.util.root_pattern(".eslintrc", ".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.json")( 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, 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 = { custom_lsp.rust_analyzer = {
settings = { settings = {
["rust-analyzer"] = { ["rust-analyzer"] = {

View File

@ -1,4 +1,7 @@
return { return {
"stevearc/oil.nvim", "stevearc/oil.nvim",
cmd = {
"Oil"
},
config = true config = true
} }

View File

@ -22,6 +22,41 @@ return {
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true }) vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { 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({ local pnpm = Terminal:new({
dir = "git_dir", dir = "git_dir",
direction = "float", direction = "float",

View File

@ -63,8 +63,11 @@ set $select_wifi $wofi_scripts/select-wifi
input * { input * {
xkb_layout de xkb_layout de
xkb_capslock disabled xkb_capslock disabled
} }
input "type:keyboard" xkb_options caps:escape
smart_gaps off smart_gaps off
gaps inner 3 gaps inner 3
gaps outer 3 gaps outer 3
@ -213,6 +216,7 @@ input "1739:24385:Synaptics_TM2438-005" {
set $ws3 "3:  Music" set $ws3 "3:  Music"
assign [class="Spotify"] $ws3 assign [class="Spotify"] $ws3
assign [class="spotify"] $ws3 assign [class="spotify"] $ws3
assign [app_id="feishin"] $ws3
assign [app_id="dev.alextren.Spot"] $ws3 assign [app_id="dev.alextren.Spot"] $ws3
set $ws4 "4:  Chat" set $ws4 "4:  Chat"

View File

@ -26,7 +26,9 @@ function getprop() {
SELECT_ID=$(echo ".. | (.nodes? // empty)[] | select(.id == $window_id) | $CLEAR_OBJ ") 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)" selected="$(swaymsg -t get_tree | jq -r "$ALL_NODES" | jq -c ". | select(.id==$window_id)" | jq)"
echo "$selected" echo "$selected"
echo "$selected" > /tmp/sway_debug_window.json
notify-send "Debug:" "$(echo $selected | jq -c "$CLEAR_OBJ" | jq)"; notify-send "Debug:" "$(echo $selected | jq -c "$CLEAR_OBJ" | jq)";
wezterm start -- nvim /tmp/sway_debug_window.json;
fi fi
} }

114
configs/sway/scripts/wl-present Executable file
View File

@ -0,0 +1,114 @@
#!/bin/bash
usage() {
echo "usage: wl-present <command> [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 <<EOF | "$DMENU" -p "wl-present custom"
--verbose
--no-verbose
--show-cursor
--no-show-cursor
--invert-colors
--no-invert-colors
--freeze
--unfreeze
--toggle-freeze
--scaling linear
--scaling nearest
--scaling exact
--transform
--region
--no-region
EOF
[[ $? -ne 0 ]] && exit 1
}
if [[ $# -eq 0 || $# -gt 2 ]]; then
usage
fi
case "$1" in
help) usage;;
mirror) mirror "${2:-$(ask-output)}";;
set-output) set-output "${2:-$(ask-output)}";;
set-region) set-region "${2:-$(ask-region)}";;
set-scaling) set-scaling "${2:-$(ask-scaling)}";;
freeze) mirror-cmd --freeze;;
unfreeze) mirror-cmd --unfreeze;;
toggle-freeze) mirror-cmd --toggle-freeze;;
custom) mirror-cmd "${2:-$(ask-custom)}";;
*) usage;;
esac

View File

@ -13,14 +13,23 @@
"sway/workspaces" "sway/workspaces"
], ],
"modules-right": [ "modules-right": [
// "custom/power-consumption", "tray",
"custom/power-profile", "custom/power-profile",
"custom/dpi", "custom/dpi",
"custom/theme", "custom/theme",
"pulseaudio", "pulseaudio",
"network", "network",
"battery" "battery",
], ],
"custom/pacman": {
"format": "{} ",
"interval": 3600, // every hour
"exec": "(checkupdates;pacman -Qm | aur vercmp) | wc -l", // # of updates
"exec-if": "exit 0", // always run; consider advanced run conditions
"on-click": "wezterm start -- yay; echo Done - Press enter to exit; read; pkill -SIGRTMIN+8 waybar", // update system
"signal": 8,
"tooltip": false,
},
"custom/theme": { "custom/theme": {
"exec": "~/.config/waybar/scripts/toggle-theme", "exec": "~/.config/waybar/scripts/toggle-theme",
"on-click": "~/.config/waybar/scripts/toggle-theme --toggle", "on-click": "~/.config/waybar/scripts/toggle-theme --toggle",
@ -114,7 +123,7 @@
"custom/waybar-mpris": { "custom/waybar-mpris": {
"max-length": 30, "max-length": 30,
"return-type": "json", "return-type": "json",
"exec": "waybar-mpris --position --autofocus", "exec": "waybar-mpris --position --autofocus --order ARTIST:ALBUM:TITLE:POSITION:SYMBOL",
"on-click": "waybar-mpris --send toggle", "on-click": "waybar-mpris --send toggle",
// This option will switch between players on right click. // This option will switch between players on right click.
"on-click-right": "waybar-mpris --send player-next", "on-click-right": "waybar-mpris --send player-next",
@ -125,6 +134,10 @@
// "on-scroll-up": "waybar-mpris --send next", // "on-scroll-up": "waybar-mpris --send next",
// "on-scroll-down": "waybar-mpris --send prev", // "on-scroll-down": "waybar-mpris --send prev",
"escape": true "escape": true
} },
"tray": {
"icon-size": 16,
"spacing": 0
},
} }
// vi: ft=jsonc // vi: ft=jsonc

View File

@ -72,12 +72,23 @@ window > box {
color: #fe8019; color: #fe8019;
} }
#tray > widget > * {
margin-right:8px;
}
#tray > widget:last-child > * {
margin-right:0px;
}
#custom-power-consumption, #custom-power-consumption,
#custom-power-profile, #custom-power-profile,
#custom-dpi, #custom-dpi,
#custom-theme, #custom-theme,
#pulseaudio, #pulseaudio,
#battery, #battery,
#tray,
#custom-pacman,
#network { #network {
/* margin: 0px 5px; */ /* margin: 0px 5px; */
/* padding: 0px 5px; */ /* padding: 0px 5px; */

View File

@ -1,4 +1,5 @@
return { return {
transparent = "none",
rosewater = "#F4DBD6", rosewater = "#F4DBD6",
flamingo = "#F0C6C6", flamingo = "#F0C6C6",
pink = "#F5BDE6", pink = "#F5BDE6",

View File

@ -32,7 +32,6 @@ end)
local os_config = {} local os_config = {}
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
local wsl_domains = wezterm.default_wsl_domains() local wsl_domains = wezterm.default_wsl_domains()
for _, dom in ipairs(wsl_domains) do for _, dom in ipairs(wsl_domains) do
dom.default_cwd = "/home/max" dom.default_cwd = "/home/max"
@ -52,6 +51,71 @@ else
} }
end 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({ return utils.merge({
font = wezterm.font_with_fallback({ font = wezterm.font_with_fallback({
"Liga SFMono Nerd Font", "Liga SFMono Nerd Font",
@ -84,97 +148,34 @@ return utils.merge({
tab_max_width = 50, tab_max_width = 50,
hide_tab_bar_if_only_one_tab = true, hide_tab_bar_if_only_one_tab = true,
disable_default_key_bindings = false, disable_default_key_bindings = false,
colors = { color_scheme = '3024 Night',
split = colors.surface0, colors = _colors,
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",
leader = { key = "a", mods = "CTRL" }, leader = { key = "a", mods = "CTRL" },
keys = { keys = {
-- Keybindings similar to tmux -- Keybindings similar to tmux
{ key = "-", mods = "LEADER", action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } }, { key = "-", mods = "LEADER", action = wezterm.action { SplitVertical = { domain = "CurrentPaneDomain" } } },
{ key = "|", mods = "LEADER", action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } }, { key = "|", mods = "LEADER", action = wezterm.action { SplitHorizontal = { domain = "CurrentPaneDomain" } } },
-- --
{ key = "z", mods = "LEADER", action = "TogglePaneZoomState" }, { key = "z", mods = "LEADER", action = "TogglePaneZoomState" },
{ key = "c", mods = "LEADER", action = wezterm.action { SpawnTab = "CurrentPaneDomain" } }, { key = "c", mods = "LEADER", action = wezterm.action { SpawnTab = "CurrentPaneDomain" } },
-- --
{ key = "n", 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 = "p", mods = "LEADER", action = wezterm.action.ActivateTabRelative(-1) },
-- --
{ key = "h", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Left" }) }, { key = "h", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Left" }) },
{ key = "l", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Right" }) }, { key = "l", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Right" }) },
{ key = "k", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Up" }) }, { key = "k", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Up" }) },
{ key = "j", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Down" }) }, { key = "j", mods = "LEADER", action = wezterm.action({ ActivatePaneDirection = "Down" }) },
-- --
{ key = "H", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Left", 2 } }) }, { key = "H", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Left", 2 } }) },
{ key = "L", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Right", 2 } }) }, { key = "L", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Right", 2 } }) },
{ key = "J", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Down", 2 } }) }, { key = "J", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Down", 2 } }) },
{ key = "K", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Up", 2 } }) }, { key = "K", mods = "SHIFT|ALT", action = wezterm.action({ AdjustPaneSize = { "Up", 2 } }) },
--- ---
{ key = 'P', mods = 'CMD|SHIFT', action = wezterm.action.ActivateCommandPalette, }, { key = 'P', mods = 'CMD|SHIFT', action = wezterm.action.ActivateCommandPalette, },
{ key = 'U', mods = 'CMD|SHIFT', action = wezterm.action.Nop, }, { key = 'U', mods = 'CMD|SHIFT', action = wezterm.action.Nop, },
{ key = 'F11', mods = '', action = wezterm.action.ToggleFullScreen, }, { key = 'F11', mods = '', action = wezterm.action.ToggleFullScreen, },
}, },
hyperlink_rules = { hyperlink_rules = {
{ {

View File

@ -55,6 +55,8 @@ alias p="git pull"
alias lt="tree -L 2 --filelimit 150 --dirsfirst" 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 if docker compose &> /dev/null
then then
alias dc="sudo docker compose" alias dc="sudo docker compose"