diff --git a/.devContainer/devcontainer.json b/.devContainer/devcontainer.json new file mode 100644 index 0000000..5116165 --- /dev/null +++ b/.devContainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "name": "Node.js", + "image": "docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest", + + // Use 'settings' to set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created in the array below. + "extensions": [ + "bungcip.better-toml", + "EditorConfig.EditorConfig", + "donjayamanne.githistory", + "eamodio.gitlens", + "oderwat.indent-rainbow", + "yzhang.markdown-all-in-one", + "shd101wyy.markdown-preview-enhanced", + "christian-kohler.path-intellisense", + "lfs.vscode-emacs-friendly", + "ms-azuretools.vscode-docker", + "dbaeumer.vscode-eslint", + "firsttris.vscode-jest-runner", + "VisualStudioExptTeam.vscodeintellicode" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [3000], + + // Specifies a command that should be run after the container has been created. + "postCreateCommand": "npm ci" + + // Comment out the next line to run as root instead. + // "remoteUser": "runner" +} diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..32ab5e5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,3 @@ +- Please use the reaction to show that you are affected by the same issue. +- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue. +- Subscribe to receive notifications on status change and new comments. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..873cc83 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'enhancement' +assignees: 'orangzz' +--- + + + + +**What you want to do:** + +**What we does currently:** + + +**Why you think this should be added:** + + +**Examples of other projects that have something similar:** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e4e41ad --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ + +## Types of changes + +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) +- [ ] Documentation (no code change) + +## Checklist + +- [ ] I have documented what and why the change is made. +- [ ] I have followed the code style of this project. +- [ ] I have added tests to cover my changes. diff --git a/.github/actions/image-push.yml b/.github/actions/image-push.yml new file mode 100644 index 0000000..e57753c --- /dev/null +++ b/.github/actions/image-push.yml @@ -0,0 +1,32 @@ +name: Build and Push Image + +on: + push: + tags: ['v*.*.*'] + +env: + acr_registry: + aws_registry: + dockerhub: docker.io + ghcr_registry: ghcr.io + # ghcr_registry_username: ${{ env.GHCR_USERNAME }} + # ghcr_registry_token: ${{ secrets.GHCR_TOKEN }} + +jos: + build: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + - name: Login to ghcr.io + uses: redhat-actions/podman-login@v2 + with: + username: ${{ env.GHCR_USERNAME }} + password: ${{ secrets.GHCR_TOKEN }} + registry: ${{ env.ghcr_registry }} + # - name: Login to ghcr.io + # run: | + # echo ${{ secrets.ghcr_token }} | docker login -u ${{ env.ghcr_username}} --password-stdin ${{ env.ghcr_registry }} diff --git a/.github/actions/release.yml b/.github/actions/release.yml new file mode 100644 index 0000000..a4bc50f --- /dev/null +++ b/.github/actions/release.yml @@ -0,0 +1,31 @@ +on: + workflow_dispatch: + push: + tags: ['v*'] +jobs: + release: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + node-version: [22] + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + - name: checkout to release branch + run: git checkout ${{ github.ref }} + - name: configure ci user + run: | + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: https://registry.npmjs.org/ + - uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node + - run: npm install diff --git a/.github/workflow-scripts/bump-version.js b/.github/workflow-scripts/bump-version.js new file mode 100644 index 0000000..8b0dcba --- /dev/null +++ b/.github/workflow-scripts/bump-version.js @@ -0,0 +1,15 @@ +// bump-version: +// runs-on: ubuntu-latest +// steps: +// - uses: actions/checkout +// - uses: actions/setup-node +// with: +// node-version: '22' +// - name: Setup Git +// run: | +// git config.user.name ${{ github.actor }} +// git config.user.email ${{ github.actor }}@users.noreply.github.com +// - name: Bump version +// run: npm version ${{ github.event.inputs.version }} +// - name: Push latest version +// run: git push --tags origin main diff --git a/.github/workflow-scripts/changelog-pr.js b/.github/workflow-scripts/changelog-pr.js new file mode 100644 index 0000000..149ba3c --- /dev/null +++ b/.github/workflow-scripts/changelog-pr.js @@ -0,0 +1,59 @@ +function _generateChangelog(prevVersion, version) {} + +function _pushCommit(version) { + log(`Pushing commit to changelog/v${version}`) + run(`git checkout -b changelog/v${version}`) + run(`git add CHANGELOG.md`) + run(`git commit -m "changelog: Add changelog for v${version}`) + run(`git push origin changelog/v${version}`) +} + +async function _createPR(version, token) { + log(`Creating changelog pr`) + const url = 'https://api.github.com/repos/orangzz/dotfiles/pulls' + const body = ` +## Summary +Add Changelog for ${version} + ` + const response = await fetch(url, { + method: 'POST', + headers: { + Accept: 'Accept: application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28', + Authorization: `Bearer ${token}`, + }, + body: JSON.stringify({ + title: `changelog: Add changelog for v${version}`, + head: `changelog/v${version}`, + base: 'main', + body: body, + }), + }) + const data = await response.json() + if (response.status !== 201) { + throw new Error(` + Failed to create PR + received status code ${response.status} + ${data.message}\n${JSON.stringify(data.errors)}`) + } + return data.html_url +} + +async function generateChangelog(version, token) { + if (version.startsWith('v')) { + version = version.substring(1) + } + + const previousVersion = await _computePreviousVersionFrom(version) + if (previousVersion) { + log(`Previous version is ${previousVersion}`) + _generateChangelog(previousVersion, version, token) + _pushCommit(version) + const prURL = await _createPR(version, token) + log(`Created PR: ${prURL}`) + } +} + +module.exports = { + generateChangelog, +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6c7606c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +on: + pull_request: + types: [closed] + branches: [$default-branch] + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest] + node-version: [22.x, 23.x] + runs-on: ${{ matrix.os}} + steps: + - uses: actions/checkout + - uses: actions/setup-node + - run: npx playwright install --with-deps # # instead of local installed binary + - run: npx playwright test + - uses: actions/upload-artifact + if: always() + with: + name: release-report + path: playwright-report + retention-days: 30 + notify: + runs-on: ubuntu-latest + needs: test + if: failure() && (github.repository_owner == 'orangzz') + steps: + - name: Notify IRC + uses: Gottox/irc-message-action@v2 + with: + channel: '#dotfiles' + nickname: ghaction-ci-bot + message: '${{ github.ref }} failed tests: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml new file mode 100644 index 0000000..9c227d4 --- /dev/null +++ b/.github/workflows/deploy-site.yml @@ -0,0 +1,74 @@ +on: + push: + branches: [$default-branch] + paths: ['/docs/**', 'README.md', '.github/workflows/deploy-site.yml'] + pull_request: + paths: ['/docs/**', 'README.md', '.github/workflows/deploy-site.yml'] + workflow_dispatch: + +concurrency: + group: "pages" + cancel-in-progress: true + +permissions: + contents: write + id-token: write # request the OIDC id-token + pages: write + +jobs: + deploy-site: + name: Build and deploy site + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + - name: Prepare docs + run: | + cp README.md docs/src/README.md + - name: Install mdbook + run: | + tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') + url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" + # url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-aarch64-apple-darwin.tar.gz" + mkdir mdbook + curl -sSL $url | tar -xz --directory=./mdbook + # curl -sSL $url | tar -xz --directory=$HOME/.local/bin + echo "$(pwd)/mdbook" >> $GITHUB_PATH + - name: Build Book + run: | + mdbook build docs --dest-dir book + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/book + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + # - name: Upload artifact + # run: | + # git worktree add gh-pages + # git config --local user.name "github-actions[bot]" + # git config --local user.email "github-actions[bot]@users.noreply.github.com" + # cd gh-pages + # git update-ref -d refs/heads/gh-pages + # rm -rf * + # mv ../docs/* . + # git add . + # git commit -m "deploy ${GITHUB_SHA} to gh-pages" + # git push --force --set-upstream origin gh-pages + # - name: Upload artifact + # uses: actions/upload-pages-artifact@v3 + # with: + # path: ./docs/book + # - name: Deploy site to Github Page + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./docs/book + # user_name: 'github-actions[bot]' + # user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/generate-changelog.yml b/.github/workflows/generate-changelog.yml new file mode 100644 index 0000000..55f1061 --- /dev/null +++ b/.github/workflows/generate-changelog.yml @@ -0,0 +1,20 @@ +name: Generate Changelog + +on: + workflow_call: +jobs: + generate-changelog: + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + - name: Generate changelog + uses: actions/github-script@v6 + with: + script: | + const {generateChangelog} = require('./github/workflow-scripts/generateChangelog') + const version = '${{ github.ref_name}}' + await generateChangelog(version, '${{ github.token}}') diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..d71557b --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,31 @@ +name: Release + +on: + push: + tags: ['v*.*.*'] +# defaults: +# run: +# working-directory: ./docs + +env: + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN}} + # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + +jobs: + npm-publish: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os}} + steps: + - uses: actions/checkout + - uses: actions/setup-node@v4 + with: + node-version-file: '.tool-versions' + cache: 'pnpm' + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + npm publish --access public + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN}} diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index cf160fb..da9a1bf 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -1,15 +1,14 @@ -name: Release +name: Tag Release on: push: tags: ['v*.*.*'] + workflow_dispatch: # defaults: # run: # working-directory: ./docs -env: - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN}} - # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + jobs: create-gh-release: @@ -21,14 +20,14 @@ jobs: os: [ubuntu-latest] runs-on: ${{ matrix.os}} steps: - - uses: actions/checkout + - uses: actions/checkout@v4 - name: Extract tag name id: extract_tag run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT # - run: npx semantic-release # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: create release + - name: Create Release for Tag uses: actions/github-script@v7 with: script: | diff --git a/.gitignore b/.gitignore index 7de0111..56873ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# split config into that which is checked into source control and that which is not; .DS_Store wallpaper/ - +editor/vscode/extensions +git/user.local +docs/book/ +node_modules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 34cb749..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "plugins/zsh-autosuggestions"] - path = plugins/zsh-autosuggestions - url = https://github.com/zsh-users/zsh-autosuggestions -[submodule "plugins/zsh-syntax-highlighting"] - path = plugins/zsh-syntax-highlighting - url = https://github.com/zsh-users/zsh-syntax-highlighting.git diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..dd8afb4 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +.github/ +package-lock.json diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 0000000..caa8f07 --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,12 @@ +/** + * @type {import('prettier').Config} + */ + +module.exports = { + trailingComma: 'all', + tabWidth: 2, + semi: true, + singleQuote: true, + printWidth: 100, + bracketSpacing: true, +}; diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..9df0736 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 22.18.0 diff --git a/.vscode/settings.yml b/.vscode/settings.yml new file mode 100644 index 0000000..b82fb39 --- /dev/null +++ b/.vscode/settings.yml @@ -0,0 +1,24 @@ +{ + 'conventionalCommits.scopes': ['maintenance', 'workspace', 'community', 'general', 'theme', 'ci'], + 'markdownlint.config': { 'extends': '.github/.markdownlint.yaml' }, + 'files.associations': { '__*': 'zsh' }, + 'shellcheck.ignorePatterns': + { + '**/*.xonshrc': true, + '**/*.xsh': true, + '**/*.zsh': true, + '**/*.zshrc': true, + '**/zshrc': true, + '**/*.zprofile': true, + '**/zprofile': true, + '**/*.zlogin': true, + '**/zlogin': true, + '**/*.zlogout': true, + '**/zlogout': true, + '**/*.zshenv': true, + '**/zshenv': true, + '**/*.zsh-theme': true, + '**/*za-*': true, + }, + 'shellformat.useEditorConfig': true, +} diff --git a/README.md b/README.md index b0b1552..5247334 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,18 @@ + + + + + + + + Setup Config + **[ Install ][Install]** **[ Usage Instruction ][Quick Start]** -**[ Configure ][Configure]** - +**[ Configure ][Configure]** +> 用的上的工具才叫工具,用不上的只是数字安慰剂 documented changelog, forum, wiki, @@ -11,10 +20,9 @@ feedback chat, calendar,ticket opinionated, sensible, decent defaults -backup, migrate and restore execution environments +backup, migrate and restore execution environments sync config with remote(ssh teleported) - ## Winodw tiling manager hyberland @@ -22,80 +30,44 @@ Aerospace shkd Synology NAS +## vscode: zen mode setup + +zen mode: minimal ui, distraction +productivity lab + ## Shell setup +> battery-included, out-of-box, opinionated, sensible defaults + systemd completions operating system's process manager -macos defaults,cstuils completions - -- stratup time profiling/behckmark - - broot, zxoide directory navigation - - fzf takeover tab complete and history naviagtion, fuzzy search, directory entry, file content thumbnail +- startup time profiling/benchmark + - broot, zxoide directory tree navigation + - fzf takeover tab complete and history naviagtion, fuzzy search, directory entry, file content thumbnail - syntax highlighting - auto suggestion - command prompt - - tmux + - session,job,screen + - window tilde manager and terminal multiplexer tmux,zellij - teleport shell environment, history to remote host when connecting over ssh. + - lualine word count, estimated read time + - cluster management, container management + - shows the floating completion suggestion panel as you type +shell startup time benchmark - - - -``` +```bash time /bin/zsh -i -c exit -num calls time self name ------------------------------------------------------------------------------------ - 1) 2 12.17 6.08 73.03% 12.17 6.08 73.03% compaudit - 2) 1 16.28 16.28 97.69% 4.11 4.11 24.67% compinit - 3) 3 0.26 0.09 1.58% 0.26 0.09 1.58% add-zsh-hook - 4) 1 0.05 0.05 0.28% 0.05 0.05 0.28% compdef - 5) 2 0.04 0.02 0.26% 0.04 0.02 0.26% zsh_add_fpath - 6) 1 0.03 0.03 0.18% 0.03 0.03 0.18% zsh_add_file - ------------------------------------------------------------------------------------ - - 2) 1 16.28 16.28 97.69% 4.11 4.11 24.67% compinit - 1/2 12.17 12.17 73.03% 0.15 0.15 compaudit [1] - ------------------------------------------------------------------------------------ - - 1/2 12.17 12.17 73.03% 0.15 0.15 compinit [2] - 1/2 12.02 12.02 72.14% 12.02 12.02 compaudit [1] - 1) 2 12.17 6.08 73.03% 12.17 6.08 73.03% compaudit - 1/2 12.02 12.02 72.14% 12.02 12.02 compaudit [1] - ------------------------------------------------------------------------------------ - - 3) 3 0.26 0.09 1.58% 0.26 0.09 1.58% add-zsh-hook - ------------------------------------------------------------------------------------ - - 4) 1 0.05 0.05 0.28% 0.05 0.05 0.28% compdef - ------------------------------------------------------------------------------------ - - 5) 2 0.04 0.02 0.26% 0.04 0.02 0.26% zsh_add_fpath - ------------------------------------------------------------------------------------ - - 6) 1 0.03 0.03 0.18% 0.03 0.03 0.18% zsh_add_file -/bin/zsh -i -c exit 0.07s user 0.06s system 87% cpu 0.151 total - ``` - fish - tab subcommand/option completion, syntax highlighting, work out of box - - - starup file - prompt themeo - nerd font - - rc file and profile file `.zprofile`, any expensive shell settings only needs initialized once at login, @@ -108,66 +80,56 @@ sourcing `.bashrc` into `.bash_profile` to keep things working in all the scenar take inspiration from symbol link farm manager ### shell scripts + shellbang line: which interpreter should be used to execute them share your script, use env to allow for the interpreter to be installed in other locations The shebang line is only used when scripts are executed without specifying the interpreter. - ## devContainer +setup runtime environment + - app sandbox - lang interpeter, complier, packager manager, lsp - database +## roadmap -## fongConfig for system and shell - - - -## valut -seceret storage and retrivement +## project kanban +## 大模型接入 dump historical baggage - if it ain’t broke, don’t fix it” restore, replicate the syteem preferences and application settings under Arch Linux and Macos backup,sync -organize as snipptet +organize as snippet `conf.d` `paths.d` - - link: - ~/.tmux.conf: - path: .tmux.conf - ~/.gitconfig: - path: .gitconfig - # Take all of the files and directories in .config dir of this repo, - # and link them to the target system - # at ~/.config. - ~/.config/: - glob: true - path: .config/* - ~/.gnupg/gpg-agent.conf: - path: gpg-agent.conf - ~/.ansible.cfg: - path: .ansible.cfg - # This is the neat part: dotbot configuration manages Mackup configuration. - ~/.mackup.cfg: - path: .mackup.cfg - # These two launchctl agents are only required on Mac OS - # to make gpg-agent play nice with ssh auth in apps that don't start - # from shell with it's environment. - ~/Library/LaunchAgents/homebrew.gpg.gpg-agent.plist: - path: Library/LaunchAgents/homebrew.gpg.gpg-agent.plist - ~/Library/LaunchAgents/link-ssh-auth-sock.plist: - path: Library/LaunchAgents/link-ssh-auth-sock.plist -source of inspiration + ~/.tmux.conf: + path: .tmux.conf + ~/.gitconfig: + path: .gitconfig # Take all of the files and directories in .config dir of this repo, # and link them to the target system # at ~/.config. + ~/.config/: + glob: true + path: .config/\* + ~/.gnupg/gpg-agent.conf: + path: gpg-agent.conf + ~/.ansible.cfg: + path: .ansible.cfg # This is the neat part: dotbot configuration manages Mackup configuration. + ~/.mackup.cfg: + path: .mackup.cfg # These two launchctl agents are only required on Mac OS # to make gpg-agent play nice with ssh auth in apps that don't start # from shell with it's environment. + ~/Library/LaunchAgents/homebrew.gpg.gpg-agent.plist: + path: Library/LaunchAgents/homebrew.gpg.gpg-agent.plist + ~/Library/LaunchAgents/link-ssh-auth-sock.plist: + path: Library/LaunchAgents/link-ssh-auth-sock.plist + source of inspiration ## Terminal emulator @@ -180,15 +142,10 @@ xterm ## how we organize dotfiles - - - # Keep shell config clean and stop polluting `$HOME` directory - ## file manager in shell - ## App launcher raycast @@ -197,15 +154,15 @@ raycast - tmux - zellij -floating panel: toggle a pane floating on top of everything else—I often use this for Lazygit. + floating panel: toggle a pane floating on top of everything else—I often use this for Lazygit. ## Git setup - [lazygit]() - gitkarden - [magit](https://magit.vc) -## Text editor/IDE setup +## Text editor/IDE setup - [helix](https://helix-editor.com) - LSP (including autocompletion, show signature, go to definition, show references, etc.) just works @@ -217,7 +174,6 @@ floating panel: toggle a pane floating on top of everything else—I often use t - [astronvim]() - [nvchad]() - ### nvim `mason`: lanaguage-sever autocomplete @@ -237,6 +193,7 @@ cargo/rust `nvimtree` - file explorer `nvim-linter` - create auto command to run the linter when opening a buffer, saving or leaving insert mode `telescrope`: telescope nvchad theme selector + ```bash # check file type of buffer :echo &filetype @@ -246,7 +203,6 @@ cargo/rust :set filetype=bash ``` - ```bash # check file type @@ -261,6 +217,7 @@ cargo/rust :TSDisable highlight :TSEnable highlightch ``` + ```bash # check defualt args :lua print(vim.inspect(require('lint').linters.luacheck.args)) @@ -273,14 +230,10 @@ cargo/rust .ansible.cfg ``` - - ## devContainer - Patterns of Enterprise Application Architecture and Refactoring. - capturing established practices and promoting practices that are not yet widely used include your judgment cal @@ -288,17 +241,16 @@ include your judgment cal ### codebase version control ### lanauage runtime,package release and dependency manager installed + system packages scope to project containing the app dependency declaration manifest pip is used for declaration and virtualenv for isolation. - ### Store App deploy config in environment credentails/locator to external service such amazon s3 - ### Back service intergration third party/external/attached services. @@ -313,20 +265,17 @@ map service metric gathering service [music discorvery service](https://www.last.fm/api) - ### Build, release, run - - Build: transform a codebase into an executable bundle release: -run: runs the app in the execution environment, run at-scale -run as daemon, managed by process manager,run when the operating system starts up, and should be restarted if the process crashes for any reason. - +run: runs the app in the execution environment, run at-scale +run as daemon, managed by process manager,run when the operating system starts up, and should be restarted if the process crashes for any reason. deploy: process binding to a port and awaiting incoming requests -### admin-process +### admin-process + A process type is the prototype from which one or more processes are instantiated a class is the prototype from which one or more objects are instantiated in object-oriented programming. @@ -334,17 +283,15 @@ one-off task, such as a database migration scheduled jobs such as database backup worker process - continouse deployment live edits to a local deploy distrutbuited deploy accessed by end users. - after ship 云服务 基于云的文件存储架构 数据存储 块存储,对象存储(oss)api 访问,文件存储(nas)挂载访问 -数据迁移和同步 localfs, networkfs syntchning, sever meessaging block(smb) +数据迁移和同步 localfs, networkfs syntchning, sever meessaging block(smb) 备份:归档存储,快照 备份策略 @@ -353,7 +300,7 @@ after ship 函数计算 挂载点管理 -挂载点是计算节点(ECS实例、函数计算或容器服务)访问文件系统的入口。挂载点定义了什么类型网络的计算节点,采用怎样的权限来访问文件系统。同一个挂载点可以被多个计算节点同时挂载,共享访问。 +挂载点是计算节点(ECS 实例、函数计算或容器服务)访问文件系统的入口。挂载点定义了什么类型网络的计算节点,采用怎样的权限来访问文件系统。同一个挂载点可以被多个计算节点同时挂载,共享访问。 地域,可用区,专有网络 vpc sudo yum install nfs-utils sudo apt-get install nfs-common diff --git a/act/.actrc b/act/.actrc new file mode 100644 index 0000000..bf71f86 --- /dev/null +++ b/act/.actrc @@ -0,0 +1 @@ +--container-architecture=linux/amd64 diff --git a/shell/zsh/.zlogin b/act/act.env similarity index 100% rename from shell/zsh/.zlogin rename to act/act.env diff --git a/shell/zsh/.zlogout b/act/act.secrets similarity index 100% rename from shell/zsh/.zlogout rename to act/act.secrets diff --git a/boostrap.zsh b/boostrap.zsh index 332ee36..004be7e 100755 --- a/boostrap.zsh +++ b/boostrap.zsh @@ -1,40 +1,100 @@ #!/usr/bin/env zsh -platform=$(command uname -sm) -platform=$(printf '%s' "$platform" | command tr '[A-Z]' '[a-z]') +[[ -n $HOME/.hushlogin ]] && touch $HOME/.hushlogin -case "$platform" in - 'darwin arm64');; - 'darwin x86_64');; - 'linux aarch64');; - 'linux x86_64');; - *) - >&2 'printf' '\033[33mz4h\033[0m: sorry, unsupported platform: \033[31m%s\033[0m\n' "$platform" - 'exit' '1' - ;; -esac +# fonts +# terminal + +# + + +info() { + printf "\033[36m$*\033[0m\n" +} + +warn() { + printf "\033[33m$*\033[0m\n" +} + +error() { + printf "\033[31merror\033[0m: $*\n" >&2 +} + +fatal() { + error "$@" + exit 1 +} + + + + +function discover_platform() { + + local platform=$(uname)/$(uname -m) + # platform=$(printf '%s' "$platform" | command tr '[A-Z]' '[a-z]') + platform=$(printf '%s' "$platform" | command tr '[:upper:]' '[:lower:]') + + case "$platform" in + 'darwin/arm64');; + 'darwin/x86_64');; + 'linux/aarch64');; + 'linux/x86_64');; + *) + fatal "Unsupported platform: $platform" + ;; + esac + echo $platform +} + + +function fs-watcher-clean() { + if [[ "$OSTYPE" == "darwin"* ]]; then + sudo sysctl -w kern.maxfiles=524288 + sudo sysctl -w kern.maxfilesperproc=524288 + elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + sudo sysctl -n -w fs.inotify.max_queued_events=524288 + sudo sysctl -n -w fs.inotify.max_user_instances=512 + sudo sysctl -n -w fs.inotify.max_user_watches=524288 + fi +} -DOTFILES="${DOTFILES:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}" function init_homebrew() { # install from release # install from main branch - if [[ $(which brew) ]]; then - commnad bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + if [[ -z $commands[brew] ]]; then + bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # post-homebrew install # echo 'eval "$(brew shellenv)"' >> $HOME/.zprofile + chmod +x $DOTFILES/homebrew/run-brewfile.zsh && $XDG_CONFIG_HOME/homebrew/run-brewfile.zsh fi } +function init_nix() { + + # create initial configuration in current directory and activate it +} +profile() { + SHELL_PATH=${SHELL:-"/bin/sh"} + case $SHELL_PATH in + */zsh) + PROFILE=${ZDOTDIR:-$HOME}/.zshrc ;; + */bash) + PROFILE=${BASHRC:-$HOME}/.bashrc ;; + */fish) + PROFILE=${FISH_CONFIG_DIR:-$HOME/.config/fish}/config.fish ;; + esac + info "Configuring path variable in ~${PROFILE#$HOME}..." +} diff --git a/browser/safari/bookmarks.json b/browser/safari/bookmarks.json new file mode 100644 index 0000000..e69de29 diff --git a/browser/safari/extension.yml b/browser/safari/extension.yml new file mode 100644 index 0000000..e69de29 diff --git a/browser/safari/settings.json b/browser/safari/settings.json new file mode 100644 index 0000000..e69de29 diff --git a/darwin/amethyst/amethyst.yml b/darwin/amethyst/amethyst.yml new file mode 100644 index 0000000..0123e9a --- /dev/null +++ b/darwin/amethyst/amethyst.yml @@ -0,0 +1,214 @@ +# register changes restart Amethyst +# If you experience issues pulling in the changes you can also quit Amethyst and run: `defaults delete com.amethyst.Amethyst.plist` +# This removes the current preferences and causes Amethyst to restart with default preferences and pull configs from this file. +mod1: + - control + - option +mod2: + - option + - shift +################################################################################ +# Layout +################################################################################ +layouts: + - tall + - two-pane +cycle-layout: + mod: mod1 + key: space +cycle-layout-backward: + mod: mod2 + key: space + +# Focus the next window counter-clockwise. +focus-ccw: + mod: mod1 + key: j + +# Focus the next window clockwise. +focus-cw: + mod: mod1 + key: k + +# Focus the next screen counter-clockwise. +focus-screen-ccw: + mod: mod1 + key: j + +# Focus the next screen clockwise. +focus-screen-cw: + mod: mod2 + key: k + +# Move the focused window onto the next screen counter-clockwise. +swap-screen-ccw: + mod: mod2 + key: h + +# Move the focused window onto the next screen clockwise. +# swap-screen-cw: +# mod: mod2 +# key: l + +# Swap the position of the focused window with the next window in the list counter-clockwise. +swap-ccw: + mod: mod1 + key: ';' + +# Swap the position of the focused window with the next window clockwise. +swap-cw: + mod: mod1 + key: '"' +################################################################################ +# Main panel control +################################################################################ +shrink-main: + mod: mod1 + key: h +expand-main: + mod: mod1 + key: l +increase-main: + mod: mod1 + key: ',' +decrease-main: + mod: mod1 + key: '.' +# Swap the position of the focused window with the main window in the list. +swap-main: + mod: mod1 + key: enter +# Focus the main window in the list. +focus-main: + mod: mod1 + key: m +# insert new windows into the first position and false to insert new windows into the last position (default false). +new-windows-to-main: false + +################################################################################ +# Throw space +################################################################################ + +# Move focus to the n-th screen in the list +# the main window in the given scr1een will be focused. +focus-screen-1: + mod: mod2 + key: 1 +focus-screen-2: + mod: mod2 + key: 2 +# Move focused window to the space left. +throw-space-left: + mod: mod2 + key: h +# Move currently the focused window to the to the space right. +throw-space-right: + mod: mod2 + key: l + +# display the name of the layout when moving to a new space (default true) +enables-layout-hud-on-space-change: false + +# Select tall layout +select-tall-layout: + mod: mod1 + key: a + +# Display the layout HUD with the current layout on each screen. +# display-current-layout: +# mod: mod1 +# key: / + +# Turn on or off tiling entirely. +toggle-tiling: + mod: mod2 + key: t + +# Rerun the current layout's algorithm. +reevaluate-windows: + mod: mod2 + key: z + +# Turn on or off focus-follows-mouse. +toggle-focus-follows-mouse: + mod: mod1 + key: x + +# Automatically quit and reopen Amethyst. +relaunch-amethyst: + mod: mod1 + key: z + +# disable screen padding on builtin display +disable-padding-on-builtin-display: false + +# add margins between windows +window-margins: true +window-margin-size: 25 + +# whether or not to set window margins if there is only one window on the screen, assuming window margins are enabled (default false). +smart-window-margins: false + +# The max number of windows that may be visible on a screen at one time before +# additional windows are minimized. A value of 0 disables the feature. +window-max-count: 3 + +# The smallest height that a window can be sized to regardless of its layout frame (in px, default 0). +window-minimum-height: 0 + +# The smallest width that a window can be sized to regardless of its layout frame (in px, default 0) +window-minimum-width: 0 + +################################################################################ +# Floating Control +################################################################################ +# default floating application list +# List of bundle identifiers for applications to be floating +# floating: [] +# false if open windows should be tiled by default +# true if open windows should be floating by default +floating-is-blacklist: true +# Toggle the floating state of the focused window +toggle-float: + mod: mod1 + key: f +float-small-windows: false + +# if screen frames should exclude the status bar +ignore-menu-bar: false +hide-menu-bar-icon: false + +# if the mouse should move position to the center of a window when it becomes focused (default false). +mouse-follows-focus: false +# true if the windows underneath the mouse should become focused as the mouse moves (default false). +focus-follows-mouse: false +# if dragging and dropping windows on to each other should swap their positions (default false). +mouse-swaps-windows: false +# if changing the frame of a window with the mouse should update the layout to accommodate the change (default false) +mouse-resizes-windows: false + +# true to automatically move to a space when throwing a window to it (default true). +follow-space-thrown-windows: true + +# The integer percentage of the screen dimension to increment and decrement main pane ratios by (default 5). +window-resize-step: 5 + +# Padding to apply between windows and the left edge of the screen (in px, default 0). +screen-padding-left: 25 +# Padding to apply between windows and the right edge of the screen (in px, default 0). +screen-padding-right: 25 +# Padding to apply between windows and the top edge of the screen (in px, default 0). +screen-padding-top: 25 +# Padding to apply between windows and the bottom edge of the screen (in px, default 0). +screen-padding-bottom: 25 + +# true to maintain layout state across application executions (default true). +restore-layouts-on-launch: true +# true to display some optional debug information in the layout HUD (default false). +debug-layout-info: false + +# true to get updates to beta versions of the software (default false). +use-canary-build: false + +# display the name of the layout when a new layout is selected (default true). +enables-layout-hud: true diff --git a/darwin/hammerspoon/apps.lua b/darwin/hammerspoon/apps.lua new file mode 100644 index 0000000..7096c04 --- /dev/null +++ b/darwin/hammerspoon/apps.lua @@ -0,0 +1,34 @@ +-- quick open +local super = {"ctrl", "alt" } + + if app and name == 'Safari' then + hs.osascript.applescriptFromFile('applescripts/openApp.applescript') + end + +function open_app(appName, bundleID) + app = hs.appfinder.appFromName(appName) + if app then + if app:isFrontmost() then + return + else + app:activate() + app:unhide() + end + else + hs.application.launchOrFocusByBundleID(bundleID) + end +end + +-- Apps +-- osascript -e 'id of app "Finder"' + +hs.hotkey.bind(super, "c", open_app("Visual Studio Code", "com.microsoft.VSCode")) +hs.hotkey.bind(super, "s", open_app("Safari", "com.apple.Safari")) +hs.hotkey.bind(super, "p", open_app("System Settings", "com.apple.systempreferences")) +hs.hotkey.bind(super, "g", open_app("Ghostty", "com.mitchellh.ghostty")) +hs.hotkey.bind(super, "f", open_app("Finder", "com.apple.finder")) +-- show shortcut +hs.hotkey.bind(super, "/", open_app("Finder", "com.apple.finder")) +-- mission control +-- google calendar +-- google mail diff --git a/darwin/hammerspoon/init.lua b/darwin/hammerspoon/init.lua new file mode 100644 index 0000000..a2537ce --- /dev/null +++ b/darwin/hammerspoon/init.lua @@ -0,0 +1,15 @@ +-- defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua" +hs.loadSpoon("SpoonInstall") +spoon.SpoonInstall.user_syncinstall = true +spoon.SpoonInstall:andUse("AClock") +spoon.SpoonInstall:andUse("ReloadConfiguration") +hs.loadSpoon("ReloadConfiguration") +spoon.ReloadConfiguration:start() + +require("commands") +require("apps") +require("windows") + +return { + init = module_init +} diff --git a/darwin/hammerspoon/scripts/openSafari.applescript b/darwin/hammerspoon/scripts/openSafari.applescript new file mode 100644 index 0000000..2613220 --- /dev/null +++ b/darwin/hammerspoon/scripts/openSafari.applescript @@ -0,0 +1,17 @@ +if application "Safari" is running then + tell application "Brave Browser" + if (count every window) = 0 then + make new window + else + reopen + activate + tell front window + make new tab at end of tabs + end tell + end if + end tell +else + tell application "Safari" + activate + end tell +end if diff --git a/darwin/hammerspoon/watcher.lua b/darwin/hammerspoon/watcher.lua new file mode 100644 index 0000000..5bbcc2c --- /dev/null +++ b/darwin/hammerspoon/watcher.lua @@ -0,0 +1,14 @@ + + +function appWatcher(appName, eventType) + if (appName == 'Ghostty' or appName == 'kitty') then + end + if (eventType == hs.application.watcher.deactivated) then + if (appName == 'Ghostty' or appName == 'kitty') then + hs.osascript.applescriptFromFile('applescripts/ghostty.applescript') + end +end + + +appWatcher = hs.application.watcher.new(appWatcher) +appWatcher:start() diff --git a/darwin/hammerspoon/windows.lua b/darwin/hammerspoon/windows.lua new file mode 100644 index 0000000..4a49635 --- /dev/null +++ b/darwin/hammerspoon/windows.lua @@ -0,0 +1,306 @@ +-- position to either full screen, maximum screen, half screen (edges), or quarter screen (corners) + +-- drag to snap zone + +-- window movement +-- edit mode cmd+x +-- wasdc move-left move-bottom move-top move-right move center +-- yuio top-left bottom-left bottom-right top-right +-- hjkl right-half bottom-half top-half left-half + +-- window positioning +-- window resizing + +-- space movement +-- circle space +-- jump to space + + + +-- recalculates window sizes when moving between displays. +-- resizing windows near screen edges and/or the Dock. +-- when disconnecting an external display. +-- Grow and Shrink via keyboard now repeat when you hold the assigned keys down +--- overlapping, obscuring +-- assign window to screen + +local config = { + windowGap = 10, + outerGap = 20, + animationDuration = 0.2, + modifier = {"shift", "cmd"} +} + +{ + "saved-layouts": [ + -- split side by side, main panel on left.If either pane has more than one window, that pane will split into columns + -- all the remaining windows are placed in the other pane with only one window being visible at a time + "tall", + + "two-pane" + ], + "mod1": [ + "control", + "shift" + ], + + "actions": { + "resize", + "move", + "swap", + "focus" + } + + "layouts-on-screen-1": [ + "tall", + "fullscreen" + ], + "layouts-on-screen-2": [ + "two-pane", + "tall" + ], + "layouts-on-screen-3": [ + "floating" + ], + + "window-resize-step": 5, + + "floating-applications": [ + "Activity Monitor", + ], + +} +-- layout actions/controls +-- `expandMain` +-- `shrinkMain` +-- `increaseMainCount` +-- `decreaseMainCount` + +-- change/events +-- a window has been added to tracking +-- a window has been removed from tracking +-- the current focused window has changes +-- two windows have been swapped in position +-- "space_change" +-- "layout_change" + + + +function toggle_maximizescreen() + return function() + local win = hs.window.focusedWindow() + if not win then + win:setFullScreen(not win:isFullScreen()) + end + end +end + + + +local function moveToLeftHalf() + return function() + local win = hs.window.focusedWindow() + local frame = win:frame() + local screen = win:screen(),frame() + f.x = max.x + f.y = max.y + f.w = max.w / 2 + f.h = max.h + win:setFrame(frame, config.animationDuration) + end +end + +local function moveToRightHalf() + return function() + local win = hs.window.focusedWindow() + local f = win:frame() + local screen = win:screen() + local max = screen:frame() + f.x = max.x + max.w / 2 + f.y = max.y + f.w = max.w / 2 + f.h = max.h + win:setFrame(f) + end +end + +local function getCurrentWindow() + local win = hs.window.focusedWindow() + if not win then + hs.alert.show("No focused window") + return + end + return win +end + +local function positionWindow(positionFn) + return function() + local win = getCurrentWindow() + if not win then return end + local frame = win:frame() + local screen = screen:frame():frame() + + positionFn(frame, screen) + win:setFrame(frame, config.animationDuration) +end + +local windowPositions = { + leftHalf = positionWindow(function(frame, screen) + frame.x = screen.x + frame.y = screen.y + frame.w = screen.w / 2 + frame.h = screen.h + end), + rightHalf = positionWindow(function(frame, screen) + frame.x = screen.x + screen.w / 2 + frame.y = screen.y + frame.w = screen.w / 2 + frame.h = screen.h + end), + topHalf = positionWindow(function(frame, screen) + frame.x = screen.x + frame.y = screen.y + frame.w = screen.w + frame.h = screen.h / 2 + end), + bottomHalf = positionWindow(function(frame, screen) + frame.x = screen.x + frame.y = screen.y + screen.h / 2 + frame.w = screen.w + frame.h = screen.h / 2 + end), +} + + +local function executeAmethystCommand(args) + local task = hs.task.new("/usr/local/bin/amethyst", nil, args) + if task then + task:start() + else + hs.alert.show("Failed to execute Amethyst command") + end +end + +local amethystCommands = { + toggleFloat = function() + executeAmethystCommand({"-m", "window", "--toggle", "float"}) + end, + + cycleLayoutForward = function() + executeAmethystCommand({"-m", "layout", "--cycle", "forward"}) + end, + + cycleLayoutBackward = function() + executeAmethystCommand({"-m", "layout", "--cycle", "backward"}) + end, + + expandMainPane = function() + executeAmethystCommand({"-m", "layout", "--expand-main"}) + end, + + shrinkMainPane = function() + executeAmethystCommand({"-m", "layout", "--shrink-main"}) + end, + + increaseMainCount = function() + executeAmethystCommand({"-m", "layout", "--increase-main"}) + end, + + decreaseMainCount = function() + executeAmethystCommand({"-m", "layout", "--decrease-main"}) + end, + + focusClockwise = function() + executeAmethystCommand({"-m", "window", "--focus", "clockwise"}) + end, + + focusCounterClockwise = function() + executeAmethystCommand({"-m", "window", "--focus", "counterclockwise"}) + end, + + swapClockwise = function() + executeAmethystCommand({"-m", "window", "--swap", "clockwise"}) + end, + + swapCounterClockwise = function() + executeAmethystCommand({"-m", "window", "--swap", "counterclockwise"}) + end, + + swapWithMain = function() + executeAmethystCommand({"-m", "window", "--swap", "main"}) + end +} + +local function setupHotkeys() + local mod = config.super +local function setupHotkeys() + local mod = config.modifier + + -- Window positioning hotkeys + hs.hotkey.bind(mod, "h", windowPositions.leftHalf) -- Left half + hs.hotkey.bind(mod, "l", windowPositions.rightHalf) -- Right half + hs.hotkey.bind(mod, "k", windowPositions.topHalf) -- Top half + hs.hotkey.bind(mod, "j", windowPositions.bottomHalf) -- Bottom half + hs.hotkey.bind(mod, "m", windowPositions.maximize) -- Maximize + hs.hotkey.bind(mod, "f", toggleFullscreen()) -- Toggle fullscreen + + -- Amethyst integration hotkeys + hs.hotkey.bind(mod, "space", amethystCommands.toggleFloat) -- Toggle float + hs.hotkey.bind(mod, "tab", amethystCommands.cycleLayoutForward) -- Next layout + hs.hotkey.bind(mod, "`", amethystCommands.cycleLayoutBackward) -- Previous layout + + -- main pane adjustments + hs.hotkey.bind(mod, "=", amethystCommands.expandMainPane) -- Expand main + hs.hotkey.bind(mod, "-", amethystCommands.shrinkMainPane) -- Shrink main + hs.hotkey.bind(mod, "]", amethystCommands.increaseMainCount) -- More main windows + hs.hotkey.bind(mod, "[", amethystCommands.decreaseMainCount) -- Fewer main windows + + -- Focus and swapping + hs.hotkey.bind(mod, "n", amethystCommands.focusClockwise) -- Focus next + hs.hotkey.bind(mod, "p", amethystCommands.focusCounterClockwise) -- Focus previous + hs.hotkey.bind(mod, "return", amethystCommands.swapWithMain) -- Swap with main + hs.hotkey.bind(mod, ".", amethystCommands.swapClockwise) -- Swap clockwise + hs.hotkey.bind(mod, ",", amethystCommands.swapCounterClockwise) -- Swap counter-clockwise +end + +-- clockwise position + + +-- swap position + + +-- cycle layout forward +-- cycle layout backward +-- increase main panel count +-- decrease main panel count +-- custom layout 1 +-- custom layout 2 +-- move focus counter clockwise +-- move focus clockwise +-- move focus to main window +-- move focus to clockwise screen +-- swap focus window to counter clockwise screen +-- swap focus window to clockwise screen +-- swap focus window to clockwise +-- swap focus window to counter clockwise +-- swap focus window with main window +-- throw focus window to space left +-- throw focus window to space right +-- throw focus window to space 1 +-- throw focus window to space 2 +-- throw focus window to space screen 1 +-- focus screen 1 +-- throw focus window to space screen 2 +-- focus screen 2 +end + +-- Reload hotkey +hs.hotkey.bind(config.modifier, "r", function() + hs.reload() +end) + + +hs.hotkey.bind(config.modifier, "space", function() + hs.execute('opt/homebrew/bin/sketchybar --trigger swap_menus_and_spaces') +end) + diff --git a/macos/.macos.zsh b/darwin/system/.macos.zsh similarity index 94% rename from macos/.macos.zsh rename to darwin/system/.macos.zsh index 73b6bcd..cfb5f40 100644 --- a/macos/.macos.zsh +++ b/darwin/system/.macos.zsh @@ -57,9 +57,9 @@ defaults delete -g AppleHighlightColor # Used for local network service discovery,.local suffix is added for you sudo scutil --set LocalHostName orangzz # see in finder machine name, airdrop, screen sharing service device name,are resolved using Multicast DNS (Bonjour) by defaultr -sudo scutil --set ComputerName {name}.device +sudo scutil --set ComputerName mac-m1.device # resolve using dns server, The name provided to the DHCP server -sudo scutil --set HostName +sudo scutil --set HostName mac-m1.device ############################################################################### @@ -101,9 +101,9 @@ sudo scutil --set HostName # id -Gn -############################################################################### -# Finder # -############################################################################### +######################################################################### +# finder +######################################################################### # always on list view defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" @@ -123,6 +123,14 @@ defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" killall Finder +### Network {{{ + # scutil --proxy + +### }}} + + + + ############################################################################### # Dock - backup and restore macos dock settings @@ -139,7 +147,7 @@ defaults write com.apple.dock magnification -bool true defaults write com.apple.dock tilesize -int 54 defaults write com.apple.dock minimize-to-application -bool true -defaults write com.apple.dock mineffect -string "genie" +defaults write com.apple.dock mineffect -string "scale" defaults write com.apple.dock launchanim -bool false @@ -150,3 +158,10 @@ echo "✅ Dock apps configured" # Restart Dock to apply changes echo "🔄 Restarting Dock..." killall Dock + + +# window +defaults write com.apple.dock workspaces-auto-swoosh -bool NO +killall Dock + + diff --git a/macos/plist/homebrew.gpg.gpg-agent.plist b/darwin/system/plist/homebrew.gpg.gpg-agent.plist similarity index 100% rename from macos/plist/homebrew.gpg.gpg-agent.plist rename to darwin/system/plist/homebrew.gpg.gpg-agent.plist diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..25f7065 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,47 @@ +FROM ubnutu:rolling +LABEL maintainer="orangzz " + +WORKDIR /app + +ARG UID=1000 +ARG GID=1000 +ARG USERNAME=zsh +ARG USERGROUP=shell + + +RUN rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \ + && apt-get clean \ + && groupadd -g ${GID} $USERGROUP \ + && useradd --create-home --no-log-init -u ${UID} -g ${GID} $USERNAME \ + && chown $USERNAME:$USERGROUP -R /app \ + && usermod --shell /bin/zsh $USERNAME + +ENV PYTHONUNBUFFERED=true \ + PYTHONPATH=. \ + PATH="(/home/$USERNAME/.local/bin $PATH)" \ + USER=${USERNAME} + + +USER ${USERNAME} + +# COPY --chown=$USERNAME:$USERGROUP webserver /usr/local/bin +COPY --chown=${USERNAME}:${USERGROUP} zsh /home/${USERNAME} + +RUN if [ -f /home/${USERNAME}/boostrap.sh]; then \ + chmod +x /home/${USERNAME}/bootstrap.sh; \ + /home/${USERNAME}/bootstrap.sh; \ +fi + +WORKDIR /home/${USERNAME} + +RUN cp -vf /home/${USERNAME}/zshrc.zsh /home/${USERNAME}/.zshrc +# RUN SHELL=/bin/zsh zsh -i -lc -- '' +CMD ["zsh", "-i", "-l"] + + + +# EXPOSE 8008 +# COPY entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# CMD ["webserver", "0.0.0.0:8008"] diff --git a/docker/Makefile b/docker/Makefile new file mode 100644 index 0000000..c81e06c --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,27 @@ +GHCR_REGISTRY ?= ghcr.io +IMAGE_NAME ?= orangzz/dotfiles +IMAGE_VERSION ?= latest + +build-and-push: + podman build --squash --no-cache -t + +docker build \ + --platform ${{ steps.metadata.outputs.docker_platforms }} \ + --output "type=image,push" \ + --tag ${{ ACR_REGISTRY}}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }} \ + --tag ${{ ACR_REGISTRY}}/${{ env.IMAGE_NAME }}:latest \ + --file Dockerfile . + + + +# qemu support emulation of various arch, x86,arm +multi-platform-build: + docker buildx build \ + --platform linux/amd64,linux/arm64/v8 \ + --tag $(GHCR_REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION) \ + --tag orangzz/dotfiles:latest \ + --file docker/Dockerfile . +multi-registry-push: + docker buildx build \ + --push \ + --platform linux/amd64,linux/arm64/v8 \ diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..e69de29 diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000..7d91a27 --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,12 @@ +[book] +src = "src" +language = "en" +multilingual = true +title = "dotfiles" +authors = ["orangzz"] + + + +[output.html] +git-repository-url = "https://github.com/orangzz/dotfiles" +edit-url-template = "https://github.com/orangzz/dotfiles/edit/main/{path}" diff --git a/docs/CHANGELOG.md b/docs/src/CHANGELOG.md similarity index 100% rename from docs/CHANGELOG.md rename to docs/src/CHANGELOG.md diff --git a/docs/src/CONTRIBUTING.md b/docs/src/CONTRIBUTING.md new file mode 100644 index 0000000..2b988ac --- /dev/null +++ b/docs/src/CONTRIBUTING.md @@ -0,0 +1,4 @@ + +## CONTRIBUTING A PATCH + +## REPORTING AN ISSUE diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 0000000..2c28a6a --- /dev/null +++ b/docs/src/SUMMARY.md @@ -0,0 +1,6 @@ +# User guide + +- [Readme](./README.md) +- [Changelog](./CHANGELOG.md) +- [Contributing](./CONTRIBUTING.md) +- [ZSH cheatsheet](./zsh-cheatsheet.md) diff --git a/docs/src/zsh-cheatsheet.md b/docs/src/zsh-cheatsheet.md new file mode 100644 index 0000000..88e8a7e --- /dev/null +++ b/docs/src/zsh-cheatsheet.md @@ -0,0 +1,142 @@ +one of struggle of zsh is find command in its man page that's why this cheatsheet exists + +zsh-quickstart-kit +awesome-zsh-plugins + +## String + +```zsh +# pad / trim +# trim leading and trailing space +# echo "$str" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' +# substitute the value of name with the matched portion deleted +# `#` removes at the start of the portion, `#` is the shortest match, and `##` is the longest. + + +# ${name#pattern} +# ${name##pattern} +# `%` removes at the end of the string, `%` is the shortest match, and `%%` is the longest. + +Get index of a value in an array (0 if not found) ${VARNAME[(Ie)value]} +Get index of a value in an array (${#VARNAME} + 1 if not found) ${VARNAME[(ie)value]} + + +# startsWith +if [[ $VARNAME = "startstr"* ]] +# contain +if [[ $VARNAME = *"substring"* ]] +# endsWith +if [[ $VARNAME = *"substring" ]] + +``` + +`$@`: Preserves each argument as separate entities +`$*`: Joins all arguments into a single string + +## Function + +trap functions +hook functions +autoloading functions +hook-like functions +API-like function + +## `add-zsh-hook` + +https://zsh.sourceforge.io/Doc/Release/Functions.html#Hook-Functions + +:warning: If you call `zplugin` outside your `.zshrc` file, the plugin you sourced will not be sourced at the next shell reload. + +# add-zsh-hook precmd vcs_info + +# builtin hook is one of chpwd, precmd, preexec, periodic, zshaddhistory, + +## Compsys + +executable script or autoloaded function + +`compdef()`: bind completion functions to commands +`compadd()` +`_arguments()`: + +```zsh +(( ${+functions[compdef]} )) + +``` + +store function used to completing commands in a file call `_`, +place file in one of directory in `$fpath`, +or create a directory in own home directory, and prepend that directory +to the list in `$fpath` + +``` + +# organized shell config, consider performance + +# restart shell: +# - Open a new tab or window in your terminal. +# - Replace the current shell with a new one: `exec zsh` +# reload config `source $ZDOTDIR/.zshrc` + + +# alias expansion + +# parameter substitution `${parameter}` +# command substitution `$(command)` +# process substitution `<(process)` +# `man zshall` +# `man zshbuiltins` autoload emulate +# eval: Execute arguments as a shell command. +# `man zshoptions` +# `man zshzle` + + +#=== parameter expansion and substitution === +# `man zshparam` +# ${name:+word} # Use word if name is set AND non-empty +# ${name:-word} # Use word if name is unset OR empty +# ${name:=word} # Set name to word if unset OR empty, then use it + +# variable expansian modifier +# each preceded by a ‘:’. +# :t - tail modifier: $(basename $1) ${1##*/} remove all leading pathname segment(keep filename) +# :h - head modifier: $(dirname $1) ${1%/*} remove trailing pathname segment(keep directory) +# a Turn a file name into an absolute path: prepends the current directory, if necessary; remove `.' path segments; and remove `..' path segments and the segments that immediately precede them. +# A Turn a file name into an absolute path as the `a' modifier does, and then pass the result through the realpath(3) library function to resolve symbolic links. + +Parameter Expansion Flags + + + +# `man zshexpen` -> `/Glob Qualifiers` +# N sets the NULL_GLOB option for the current pattern +# / directories +# . plain files +# @ symbolic links +# = sockets + + +# Subscript Flags +# ${(k)array} # Get the keys of an associative array +# ${(v)array} # Get the values of an associative array +# `#` = "strip this prefix from each element +# `:#` = "Remove elements that match this pattern" + + + + +# substr/slicing +# ${str[start,end]} +# Escape +# join/split +# spe=:, sep="\x00" null character + + +# https://zsh.sourceforge.io/Doc/Release/Arithmetic-Evaluation.html +# ${+name} If name is set, `1' is substituted, otherwise `0' is substituted. + +# (( ${+terminfo[cuu]} && ${+terminfo[ed]} && ${+terminfo[sc]} && ${+terminfo[rc]} )) || return 0 + +``` + +man zshmisc diff --git a/editor/nvim/lua/plugins/avante.lua b/editor/nvim/lua/plugins/avante.lua new file mode 100644 index 0000000..f962842 --- /dev/null +++ b/editor/nvim/lua/plugins/avante.lua @@ -0,0 +1,29 @@ + +return { + 'yetone/avante.nvim', + event = 'VeryLazy', + enabled = true, + opts = { + provider = "copilot", + cursor_applying_prodiver = nil, + behaviour = { + enable_cursor_planning_mode = true + }, + windows = { + position = "right", + width = 40, + sidebar_header = { + align = 'center', + rounded = true, + }, + input = { + prefix = '>', + height = 12, + } + }, + file_selector = { + provider = 'telescope', + } + + } +} diff --git a/editor/vscode/extensions.json b/editor/vscode/extensions.json new file mode 100644 index 0000000..5dbb1aa --- /dev/null +++ b/editor/vscode/extensions.json @@ -0,0 +1,60 @@ +{ + // code --list-extensions > extensions.list + // cat extensions.list | xargs -L 1 code --install-extension + "recommendations": [ + "alefragnani.project-manager", + "antfu.iconify", + "astro-build.astro-vscode", + "augment.vscode-augment", + "bradlc.vscode-tailwindcss", + "catppuccin.catppuccin-vsc-icons", + "dbaeumer.vscode-eslint", + "dnicolson.binary-plist", + "docker.docker", + "eamodio.gitlens", + "enkia.tokyo-night", + "esbenp.prettier-vscode", + "formulahendry.auto-close-tag", + "formulahendry.auto-complete-tag", + "formulahendry.auto-rename-tag", + "github.copilot", + "github.copilot-chat", + "github.vscode-github-actions", + "github.vscode-pull-request-github", + "golang.go", + "gruntfuggly.todo-tree", + "johnsoncodehk.vscode-tsconfig-helper", + "josemurilloc.aura-spirit-dracula", + "kisstkondoros.vscode-gutter-preview", + "laravel.vscode-laravel", + "liamhammett.inline-parameters", + "lzm0x219.vscode-markdown-github", + "meganrogge.template-string-converter", + "mhutchie.git-graph", + "ms-azuretools.vscode-containers", + "ms-azuretools.vscode-docker", + "ms-vscode-remote.remote-containers", + "ms-vscode-remote.remote-ssh", + "ms-vscode-remote.remote-ssh-edit", + "ms-vscode.makefile-tools", + "ms-vscode.remote-explorer", + "naumovs.color-highlight", + "nuxtr.nuxtr-vscode", + "patbenatar.advanced-new-file", + "pkief.material-icon-theme", + "qwtel.sqlite-viewer", + "rangav.vscode-thunder-client", + "rodrigovallades.es7-react-js-snippets", + "sanjulaganepola.github-local-actions", + "sdras.vue-vscode-snippets", + "sheltonlouis.astro-snippets", + "streetsidesoftware.code-spell-checker", + "subframe7536.custom-ui-style", + "unifiedjs.vscode-mdx", + "usernamehw.errorlens", + "vitest.explorer", + "vue.volar", + "vunguyentuan.vscode-css-variables", + "yoavbls.pretty-ts-errors" + ] +} diff --git a/editor/vscode/keybindings.json b/editor/vscode/keybindings.json new file mode 100644 index 0000000..0e37272 --- /dev/null +++ b/editor/vscode/keybindings.json @@ -0,0 +1,588 @@ +[ + // view focus + // search widge, quick input, command palette + // container view: explorer, extension, outline view, search editor + // panel + // text edito + { + "key": "shift+cmd+.", + "command": "workbench.action.openGlobalKeybindings" + }, + { + "key": "cmd+shift+x", + "command": "workbench.view.extensions" + }, + { + "key": "cmd+shift+e", + "command": "workbench.view.explorer" + }, + { + "key": "cmd+b", + "command": "workbench.action.togglePanel" + }, + { + "key": "alt+b", + "command": "workbench.action.toggleSidebarVisibility" + }, + { + "key": "cmd+shift+,", + "command": "workbench.action.openSettings" + }, + { + "key": "cmd+0", + "command": "workbench.action.zoomReset" + }, + { + "key": "escape", + "command": "notifications.hideToasts", + "when": "notificationToastsVisible" + }, + { + "key": "cmd+h", + "command": "workbench.action.focusSideBar", + "when": "editorTextFocus || terminalFocus" + }, + { + "key": "cmd+h", + "command": "workbench.action.focusActiveEditorGroup", + "when": "editorIsOpen && !editorTextFocus && !view.terminal.visible" + }, + { + "key": "cmd+h", + "command": "workbench.view.search.focus", + "when": "activeViewlet == 'workbench.view.search' && !inputFocus" + }, + { + "key": "cmd+k", + "command": "search.focus.nextInputBox", + "when": "(inSearchEditor && inputBoxFocus) || (inputBoxFocus && searchViewletVisible)" + }, + { + "key": "cmd+l", + "command": "search.focus.previousInputBox", + "when": "(inSearchEditor && inputBoxFocus) || (inputBoxFocus && searchViewletVisible)" + }, + { + "key": "alt+cmd+;", + "command": "search.action.collapseSearchResults" + }, + { + "key": "alt+cmd+'", + "command": "search.action.expandSearchResults" + }, + { + "key": "alt+cmd+0", + "command": "search.action.focusSearchList" + }, + { + "key": "alt+enter", + "command": "editor.action.showContextMenu", + "when": "editorTextFocus" + }, + + // code folding + { + "key": "shift+ctrl+[", + "command": "editor.fold", + "when": "editorTextFocus && foldingEnabled" + }, + { + "key": "shift+ctrl+]", + "command": "editor.unfold", + "when": "editorTextFocus && foldingEnabled" + }, + { + "key": "shift+cmd+[", + "command": "editor.foldAll", + "when": "editorTextFocus && foldingEnabled" + }, + { + "key": "shift+cmd+]", + "command": "editor.unfoldAll", + "when": "editorTextFocus && foldingEnabled" + }, + { + "key": "shift+alt+[", + "command": "editor.foldRecursively", + "when": "editorTextFocus && foldingEnabled" + }, + { + "key": "shift+alt+]", + "command": "editor.unfoldRecursively", + "when": "editorTextFocus && foldingEnabled" + }, + + // emmet + // { + // "key": "cmd+m cmd+w", + // "command": "editor.emmet.action.wrapWithAbbreviation", + // "when": "editorTextFocus" + // }, + // { + // "key": "cmd+m cmd+r", + // "command": "editor.emmet.action.updateTag", + // "when": "editorTextFocus" + // }, + // { + // "key": "cmd+m cmd+backspace", + // "command": "editor.emmet.action.removeTag", + // "when": "editorTextFocus" + // }, + // { + // "key": "cmd+m cmd+m", + // "command": "editor.emmet.action.matchTag", + // "when": "editorTextFocus" + // }, + // === explorer tree === + { + "key": "alt+,", + "command": "fileutils.newFile" + }, + { + "key": "alt+.", + "command": "fileutils.newFolder" + }, + { + "key": "shift+alt+,", + "command": "fileutils.newFileAtRoot" + }, + { + "key": "shift+alt+.", + "command": "fileutils.newFolderAtRoot" + }, + { + "key": "alt+c", + "command": "fileutils.duplicateFile" + }, + { + "key": "alt+d", + "command": "fileutils.removeFile" + }, + { + "key": "alt+m", + "command": "fileutils.moveFile" + }, + { + "key": "alt+r", + "command": "fileutils.renameFile" + }, + { + "key": "alt+cmd+c", + "command": "fileutils.copyFileName" + }, + { + "key": "cmd+\\", + "command": "workbench.files.action.collapseExplorerFolders" + }, + { + "key": "alt+\\", + "command": "workbench.files.action.showActiveFileInExplorer" + }, + // Select file + // Create file + { + "key": "cmd+n", + "command": "explorer.newFile", + "when": "explorerViewletVisible && filesExplorerFocus && !inputFocus" + }, + { + "key": "shift+cmd+n", + "command": "explorer.newFolder", + "when": "explorerViewletVisible && filesExplorerFocus && !inputFocus" + }, + + // === focus === + + { + "key": "ctrl+`", + "command": "workbench.action.terminal.focus", + "when": "!view.terminal.visible || (view.terminal.visible && !terminalFocus)" + }, + { + "key": "shift+cmd+enter", + "command": "workbench.action.toggleMaximizedPanel" + }, + { + "key": "Escape", + "command": "workbench.action.terminal.toggleTerminal", + "when": "terminalFocus" + }, + { + "key": "cmd+w", + "command": "workbench.action.terminal.kill", + "when": "terminalFocus" + }, + { + "key": "cmd+d", + "command": "workbench.action.terminal.split", + "when": "terminalFocus && terminalProcessSupported" + }, + { + "key": "cmd+v", + "command": "workbench.action.terminal.focus", + "when": "view.terminal.visible && !terminalFocus" + }, + { + "key": "cmd+;", + "command": "workbench.action.terminal.focusNextPane", + "when": "terminalFocus" + }, + { + "key": "cmd+'", + "command": "workbench.action.terminal.focusPreviousPane", + "when": "terminalFocus" + }, + { + "key": "ctrl+l", + "command": "workbench.action.terminal.clear", + "when": "terminalFocus" + }, + + // open recently closed tab + // open new tab + // close current tab + // close all tab + // close others tab + + // === Tab Navigation === + + { + "key": "cmd+h", + "command": "workbench.action.previousEditor", + "when": "!terminalFocus && !listFocus && !suggestWidgetVisible && !inQuickOpen && !inputBoxFocus" + }, + // window + { + "key": "alt+tab", + "command": "workbench.action.quickSwitchWindow" + }, + // === list traverse === + // Move to the previous/next editor. + { + "key": "cmd+k", + "command": "workbench.action.nextEditor", + "when": "textInputFocus" + }, + { + "key": "cmd+j", + "command": "workbench.action.previousEditor", + "when": "textInputFocus" + }, + // quick open active editor + { + "key": "ctrl+tab", + "command": "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup", + "when": "!activeEditorGroupEmpty" + }, + // quick open + { + "key": "cmd+k", + "command": "workbench.action.quickOpenSelectPrevious", + "when": "inQuickOpen" + }, + { + "key": "cmd+j", + "command": "workbench.action.quickOpenSelectNext", + "when": "inQuickOpen" + }, + // === suggestion box === + { + "key": "cmd+k", + "command": "selectPrevSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" + }, + { + "key": "cmd+j", + "command": "selectNextSuggestion", + "when": "uggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus" + }, + // container view: explorer tree, outline, search results + { + "key": "k", + "command": "list.focusUp", + "when": "listFocus && !inputFocus" + }, + { + "key": "cmd+j", + "command": "list.focusDown", + "when": "listFocus && !inputFocus" + }, + + // === editor panel === + // swap panel + // navigate panel + { + "key": "alt+s", + "command": "workbench.action.splitEditor", + "when": "!terminalFocus" + }, + { + "key": "cmd+ctrl+k", + "command": "moveActiveEditor", + "args": { + "to": "right" + }, + "when": "editorTextFocus" + }, + // resize panel + { + "key": "alt+s", + "command": "workbench.action.splitEditor", + "when": "!terminalFocus" + }, + { + "key": "alt+v", + "command": "workbench.action.splitEditorDown", + "when": "!terminalFocus" + }, + { + "key": "shift+alt+w", + "command": "workbench.action.closeAllEditors" + }, + { + "key": "alt+w", + "command": "workbench.action.closeGroup" + }, + { + "key": "alt+=", + "command": "workbench.action.increaseViewSize", + "when": "editorFocus" + }, + { + "key": "alt+-", + "command": "workbench.action.decreaseViewSize", + "when": "editorFocus" + }, + { + "key": "alt+h", + "command": "workbench.action.navigateLeft", + "when": "editorFocus" + }, + { + "key": "alt+j", + "command": "workbench.action.navigateDown", + "when": "editorFocus" + }, + { + "key": "alt+k", + "command": "workbench.action.navigateUp", + "when": "editorFocus" + }, + { + "key": "alt+l", + "command": "workbench.action.navigateRight", + "when": "editorFocus" + }, + + // === selection === + // line selection, match selection, block selection + // select to word start + { + "key": "shift+alt+left", + "command": "cursorWordStartLeftSelect", + "when": "textInputFocus" + }, + // select to word end + { + "key": "shift+alt+right", + "command": "cursorWordEndRightSelect", + "when": "textInputFocus" + }, + // select to line start + { + "key": "shift+cmd+left", + "command": "cursorLineStartSelect", + "when": "textInputFocus" + }, + // select to line end + { + "key": "shift+cmd+right", + "command": "cursorLineEndSelect", + "when": "textInputFocus" + }, + // expand selection to scope + { + "key": "ctrl+shift+right", + "command": "editor.action.smartSelect.expand", + "when": "editorTextFocus" + }, + // shrink selection + { + "key": "ctrl+shift+left", + "command": "editor.action.smartSelect.shrink", + "when": "editorTextFocus" + }, + + // === editing === + // move line up,down + // copy line up + // wrap + { + "key": "shift+alt+up", + "command": "editor.action.copyLinesUpAction", + "when": "editorTextFocus && !editorReadonly" + }, + // copy line down + { + "key": "shift+alt+down", + "command": "editor.action.copyLinesDownAction", + "when": "editorTextFocus && !editorReadonly" + }, + + // comment selection + { + "key": "shift+alt+a", + "command": "editor.action.blockComment", + "when": "editorTextFocus && !editorReadonly" + }, + // comment line + { + "key": "cmd+/", + "command": "editor.action.commentLine", + "when": "editorTextFocus && !editorReadonly" + }, + + // cursor movement and placement + // undo cusor placement + { + "key": "cmd+u", + "command": "cursorUndo", + "when": "textInputFocus" + }, + // navigate back to last edit position + { + "key": "", + "command": "workbench.action.navigateBackInEditLocations" + }, + // navigate back cursor position + { + "key": "ctrl+-", + "command": "workbench.action.navigateBack", + "when": "canNavigateBack" + }, + // navigate forward cursor position + { + "key": "ctrl+shift+-", + "command": "workbench.action.navigateForward", + "when": "canNavigateForward" + }, + // insert cursor above + { + "key": "alt+cmd+up", + "command": "editor.action.insertCursorAbove", + "when": "editorTextFocus" + }, + // insert cursor below + { + "key": "alt+cmd+down", + "command": "editor.action.insertCursorBelow", + "when": "editorTextFocus" + }, + { + "key": "shift+alt+i", + "command": "editor.action.insertCursorAtEndOfEachLineSelected", + "when": "editorTextFocus" + }, + { + "key": "shift+alt+down", + "command": "-editor.action.copyLinesDownAction", + "when": "editorTextFocus && !editorReadonly" + }, + { + "key": "shift+alt+up", + "command": "-editor.action.copyLinesUpAction", + "when": "editorTextFocus && !editorReadonly" + }, + { + "key": "shift+alt+o", + "command": "outline.focus" + }, + // === codebase navigation === + // symbol rename + + // focus symbol outline view + { + "key": "cmd+shift+o", + "command": "outline.focus" + }, + // goto line cmd+p then : + { + "key": "cmd+g", + "command": "workbench.action.gotoLine" + }, + // search symbol in textEditor + // cmd+p: then @, grouping symbol by pending : + { + "key": "cmd+r", + "command": "workbench.action.gotoSymbol" + }, + // search symbol in workspace + // cmd+p: then #, grouping symbol by pending : + { + "key": "shift+cmd+r", + "command": "workbench.action.showAllSymbols" + }, + // search text + // cmd+p: then #, grouping symbol by pending : + + // search file + + // goto definition, peek definition + + // goto reference, peek reference + // === debugging === + { + "key": "shift+f9", + "command": "editor.debug.action.toggleInlineBreakpoint", + "when": "editorTextFocus" + }, + { + "key": "f5", + "command": "workbench.action.debug.start", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+f5", + "command": "workbench.action.debug.continue", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+f5", + "command": "workbench.action.debug.stepInto", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+f5", + "command": "workbench.action.debug.stepOver", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+f5", + "command": "workbench.action.debug.stepOut", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+f5", + "command": "workbench.action.debug.stepBack", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+f5", + "command": "workbench.action.debug.stop", + "when": "focusedSessionIsAttach && inDebugMode" + }, + { + "key": "shift+cmd+m", + "command": "-workbench.actions.view.problems", + "when": "workbench.panel.markers.view.active" + }, + { + "key": "shift+cmd+right", + "command": "-cursorWordAccessibilityRightSelect", + "when": "accessibilityModeEnabled && isWindows && textInputFocus && focusedView == 'workbench.panel.output'" + } +] + +// cmd+enter - insert line below +// select all match cmd+shift+l +// error navigation diff --git a/editor/vscode/launch.json b/editor/vscode/launch.json new file mode 100644 index 0000000..3156f1a --- /dev/null +++ b/editor/vscode/launch.json @@ -0,0 +1,19 @@ +{ + "configurations": [ + { + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/node_modules/bin/${executable}", + "args": ["--trace", "true"], + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "stopAtEntry": false + }, + { + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} diff --git a/editor/vscode/settings.json b/editor/vscode/settings.json new file mode 100644 index 0000000..1861a9f --- /dev/null +++ b/editor/vscode/settings.json @@ -0,0 +1,399 @@ +{ + // ========= Layout and View ========= + "workbench.sideBar.location": "right", + "workbench.activityBar.location": "default", + "workbench.activityBar.iconClickBehavior": "toggle", + "workbench.editor.showTabs": "single", + "workbench.secondarySideBar.defaultVisibility": "hidden", + "workbench.panel.showLabels": false, + "workbench.panel.defaultLocation": "bottom", + "workbench.statusBar.visible": false, + "editor.minimap.enabled": false, + "breadcrumbs.enabled": false, + "workbench.startupEditor": "none", + "workbench.tips.enabled": false, + + "window.zoomLevel": 1, + "window.titleBarStyle": "native", + "window.customTitleBarVisibility": "never", + "window.newWindowDimensions": "inherit", + + "zenMode.centerLayout": false, + "zenMode.hideLineNumbers": false, + // ========= Explorer Tree ========= + "workbench.tree.renderIndentGuides": "none", + "explorer.decorations.badges": false, + "git.decorations.enabled": false, + "workbench.tree.enableStickyScroll": false, + "workbench.tree.indent": 8, + "workbench.tree.expandMode": "singleClick", + "explorer.compactFolders": false, + "explorer.confirmDelete": false, + "explorer.confirmDragAndDrop": false, + "explorer.sortOrder": "type", + "files.exclude": { + "**/.git": true, + "**/.next": false, + "**/.nuxt": false, + "**/node_modules": false + }, + "files.associations": { + "__*": "zsh" + }, + "shellformat.useEditorConfig": true, + "workbench.editorAssociations": { + "*.plist": "default" + }, + "search.exclude": { + "**/*.svg": true, + "**/.git": true, + "**/.github": false, + "**/.nuxt": true, + "**/.next": true, + "**/.pnpm": true, + "**/.vscode": true, + "**/assets": true, + "**/dist/**": true, + "**/logs": true, + "**/node_modules": true, + "**/package-lock.json": true, + "**/pnpm-lock.yaml": true, + "**/public": true, + "**/tmp": true, + "**/CHANGELOG*": true, + "**/LICENSE*": true + }, + + "custom-ui-style.electron": { + "titleBarStyle": "hiddenInset", + "trafficLightPosition": { + "x": 20, + "y": 16 + } + }, + "custom-ui-style.stylesheet": { + ".notification-toast": "box-shadow: none !important", + ".quick-input-widget.show-file-icons": "box-shadow: none !important", + ".quick-input-widget": "top: 25vh !important", + ".quick-input-list .scrollbar": "display: none", + ".monaco-action-bar.quick-input-inline-action-bar": "display: none", + ".editor-widget.find-widget": "box-shadow: none; border-radius: 4px", + ".quick-input-titlebar": "background: #100B15 !important", + ".monaco-workbench .part.editor > .content .editor-group-container > .title.title-border-bottom:after": "display: none", + ".monaco-scrollable-element > .shadow.top": "display: none", + ".sidebar .title-label": "padding: 0 !important", + ".sidebar": "border: none !important", + ".monaco-workbench .monaco-list:not(.element-focused):focus:before": "outline: none !important", + ".monaco-list-row.focused": "outline: none !important", + ".monaco-editor .scroll-decoration": "display: none", + ".title-actions": "display: none !important", + ".title.show-file-icons .label-container .monaco-icon-label.file-icon": "justify-content: center; padding: 0 !important", + ".title .monaco-icon-label:after": "margin-right: 0", + ".monaco-workbench .part.editor > .content .editor-group-container > .title > .label-container > .title-label": "padding-left: 60px", + ".title .monaco-icon-label.file-icon": "margin: 0 60px", + ".panel .composite.title.has-composite-bar": "visibility: hidden !important" + }, + + // ========= Themes ========== + "catppuccin-noctis-icons.hidesExplorerArrows": true, + "material-icon-theme.hidesExplorerArrows": true, + "workbench.iconTheme": "catppuccin noctis icons", + "workbench.colorTheme": "Aura Dracula Spirit (Soft)", + // "window.autoDetectColorScheme": true, + + // ========= Fonts ========= + "custom-ui-style.font.sansSerif": "DankMono Nerd Font", + "editor.fontFamily": "DankMono Nerd Font", + "editor.fontLigatures": "'ss01','ss02','ss03','ss04','ss05','dlig'", + "terminal.integrated.fontFamily": "Recursive Mono Casual Static", + "terminal.integrated.fontSize": 14, + "terminal.integrated.lineHeight": 1.8, + "editor.fontSize": 14, + "editor.lineHeight": 2.5, + "editor.tokenColorCustomizations": { + "textMateRules": [ + { + "scope": "comment", + "settings": { + "fontStyle": "italic" + } + } + ] + }, + + "editor.guides.bracketPairs": "active", + + "workbench.editor.tabActionLocation": "left", + "workbench.list.smoothScrolling": true, + + "editor.wordWrap": "bounded", + // ========= Cursor ========= + "editor.cursorBlinking": "solid", + "editor.cursorStyle": "block", + "editor.cursorSmoothCaretAnimation": "on", + "terminal.integrated.cursorBlinking": false, + "terminal.integrated.cursorStyle": "block", + "workbench.colorCustomizations": { + "editorCursor.background": "#000000", + "terminalCursor.foreground": "#c45dff", + "[Aura Dracula Spirit (Soft)]": { + "editorSuggestWidget.selectedBackground": "#3A334B", + "sideBar.background": "#191521" + } + }, + "editor.stickyScroll.enabled": false, + // mark and indication + "editor.lightbulb.enabled": "off", + "editor.showFoldingControls": "never", + "editor.guides.indentation": false, + "editor.renderWhitespace": "selection", + "workbench.editor.closeOnFileDelete": true, + "workbench.editor.highlightModifiedTabs": true, + "workbench.editor.limit.enabled": true, + "workbench.editor.limit.perEditorGroup": true, + "workbench.editor.limit.value": 5, + // highlight + "editor.renderLineHighlight": "line", + "editor.occurrencesHighlight": "off", + "editor.selectionHighlight": false, + // scrollbar + "editor.scrollbar.vertical": "hidden", + "editor.scrollbar.horizontal": "hidden", + "editor.overviewRulerBorder": false, + // cursor position overview indicator + "editor.hideCursorInOverviewRuler": true, + + // suggestion box + "editor.quickSuggestions": { + "other": "on" + }, + "editor.suggestOnTriggerCharacters": false, + "editor.snippetSuggestions": "top", + "editor.inlineSuggest.enabled": true, + "editor.suggestSelection": "first", + // tab completion + "emmet.showSuggestionsAsSnippets": true, + "emmet.triggerExpansionOnTab": true, + "editor.tabCompletion": "on", + // save mode + "files.autoSave": "onFocusChange", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": "never", + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + + // code foramt + "editor.tabSize": 2, + "editor.detectIndentation": false, + "files.eol": "\n", + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true, + + "prettier.printWidth": 200, + "prettier.semi": false, + "prettier.singleQuote": true, + "prettier.trailingComma": "es5", + // set perttier as default formatter for all astro files + "prettier.documentSelectors": ["**/*.astro"], + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[astro]": { + "editor.defaultFormatter": "astro-build.astro-vscode" + }, + + // ========= Gutter ========= + "scm.diffDecorations": "none", + "editor.lineNumbers": "relative", + + // "git.autofetch": true, + // "git.confirmSync": false, + // "git.enableSmartCommit": true, + // "git.untrackedChanges": "separate", + + "todo-tree.filtering.excludeGlobs": ["**/node_modules/*", "**/.env.*"], + "cssVariables.lookupFiles": ["**/*.css", "**/*.scss", "**/*.sass", "**/*.less"], + + "debug.toolBarLocation": "docked", + "debug.onTaskErrors": "debugAnyway", + + "diffEditor.ignoreTrimWhitespace": false, + "editor.multiCursorModifier": "ctrlCmd", + // ========= Terminal ========= + + "terminal.integrated.tabs.enabled": false, + "terminal.integrated.defaultProfile.osx": "zsh", + "terminal.integrated.profiles.osx": { + "fish": { + "path": "/opt/homebrew/bin/fish" + }, + "zsh": { + "path": "/opt/homebrew/bin/zsh", + "args": ["--login"] + } + }, + + // ========= Extension configs ========= + "extensions.autoUpdate": "onlyEnabledExtensions", + + "errorLens.enabledDiagnosticLevels": ["warning", "error"], + "errorLens.excludeBySource": ["cSpell", "Grammarly", "eslint"], + // ESLint config: https://github.com/antfu/eslint-config + "css.lint.unknownAtRules": "ignore", + "eslint.codeAction.showDocumentation": { + "enable": true + }, + "eslint.quiet": true, + // Silent the stylistic rules in you IDE, but still auto fix them + "eslint.rules.customizations": [ + { + "rule": "style/*", + "severity": "off" + }, + { + "rule": "format/*", + "severity": "off" + }, + { + "rule": "*-indent", + "severity": "off" + }, + { + "rule": "*-spacing", + "severity": "off" + }, + { + "rule": "*-spaces", + "severity": "off" + }, + { + "rule": "*-order", + "severity": "off" + }, + { + "rule": "*-dangle", + "severity": "off" + }, + { + "rule": "*-newline", + "severity": "off" + }, + { + "rule": "*quotes", + "severity": "off" + }, + { + "rule": "*semi", + "severity": "off" + } + ], + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "html", "markdown", "json", "jsonc", "yaml", "toml"], + "github.copilot.enable": { + "*": true, + "markdown": true, + "plaintext": false + }, + "cSpell.allowCompoundWords": true, + "cSpell.language": "en,en-US", + "css.lint.hexColorLength": "ignore", + + "svg.preview.mode": "svg", + + // ========= File Nesting ========= + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.expand": false, + "explorer.fileNesting.patterns": { + "*.ts": "$(capture).js, $(capture).d.ts.map, $(capture).*.ts, $(capture)_*.js, $(capture)_*.ts", + "*.js": "$(capture).js.map, $(capture).*.js, $(capture)_*.js", + "*.jsx": "$(capture).js, $(capture).*.jsx, $(capture)_*.js, $(capture)_*.jsx", + "*.tsx": "$(capture).ts, $(capture).*.tsx, $(capture)_*.ts, $(capture)_*.tsx", + "tsconfig.json": "tsconfig.*.json", + "package.json": ".browserslist*, .circleci*, .commitlint*, .cz-config.js, .czrc, .dlint.json, .dprint.json, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lintstagedrc*, .markdownlint*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .simple-git-hooks*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .versionrc*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, Procfile, apollo.config.*, appveyor*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, dangerfile*, dlint.json, dprint.json, eslint*, firebase.json, grunt*, gulp*, jenkins*, lerna*, lint-staged*, nest-cli.*, netlify*, nodemon*, npm-shrinkwrap.json, nx.*, package-lock.json, package.nls*.json, phpcs.xml, pm2.*, pnpm*, prettier*, pullapprove*, pyrightconfig.json, release-tasks.sh, release.config.*, renovate*, rollup.config.*, rspack*, simple-git-hooks*, stylelint*, tslint*, tsup.config.*, turbo*, typedoc*, unlighthouse*, vercel*, vetur.config.*, webpack*, workspace.json, xo.config.*, yarn*", + "*.asax": "$(capture).*.cs, $(capture).*.vb", + "*.ascx": "$(capture).*.cs, $(capture).*.vb", + "*.ashx": "$(capture).*.cs, $(capture).*.vb", + "*.aspx": "$(capture).*.cs, $(capture).*.vb", + "*.bloc.dart": "$(capture).event.dart, $(capture).state.dart", + "*.c": "$(capture).h", + "*.cc": "$(capture).hpp, $(capture).h, $(capture).hxx", + "*.cjs": "$(capture).cjs.map, $(capture).*.cjs, $(capture)_*.cjs", + "*.component.ts": "$(capture).component.html, $(capture).component.spec.ts, $(capture).component.css, $(capture).component.scss, $(capture).component.sass, $(capture).component.less", + "*.cpp": "$(capture).hpp, $(capture).h, $(capture).hxx", + "*.cs": "$(capture).*.cs", + "*.cshtml": "$(capture).cshtml.cs", + "*.csproj": "*.config, *proj.user, appsettings.*, bundleconfig.json", + "*.css": "$(capture).css.map, $(capture).*.css", + "*.cxx": "$(capture).hpp, $(capture).h, $(capture).hxx", + "*.dart": "$(capture).freezed.dart, $(capture).g.dart", + "*.ex": "$(capture).html.eex, $(capture).html.heex, $(capture).html.leex", + "*.go": "$(capture)_test.go", + "*.java": "$(capture).class", + "*.master": "$(capture).*.cs, $(capture).*.vb", + "*.mjs": "$(capture).mjs.map, $(capture).*.mjs, $(capture)_*.mjs", + "*.module.ts": "$(capture).resolver.ts, $(capture).controller.ts, $(capture).service.ts", + "*.pubxml": "$(capture).pubxml.user", + "*.resx": "$(capture).*.resx, $(capture).designer.cs, $(capture).designer.vb", + "*.tex": "$(capture).acn, $(capture).acr, $(capture).alg, $(capture).aux, $(capture).bbl, $(capture).blg, $(capture).fdb_latexmk, $(capture).fls, $(capture).glg, $(capture).glo, $(capture).gls, $(capture).idx, $(capture).ind, $(capture).ist, $(capture).lof, $(capture).log, $(capture).lot, $(capture).out, $(capture).pdf, $(capture).synctex.gz, $(capture).toc, $(capture).xdv", + "*.vbproj": "*.config, *proj.user, appsettings.*, bundleconfig.json", + "*.vue": "$(capture).*.ts, $(capture).*.js, $(capture).story.vue", + "*.xaml": "$(capture).xaml.cs", + "+layout.svelte": "+layout.ts,+layout.ts,+layout.js,+layout.server.ts,+layout.server.js,+layout.gql", + "+page.svelte": "+page.server.ts,+page.server.js,+page.ts,+page.js,+page.gql", + ".clang-tidy": ".clang-format, .clangd, compile_commands.json", + ".env": "*.env, .env.*, .envrc, env.d.ts", + ".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*", + ".project": ".classpath", + "//": "Last update at 4/29/2023, 2:04:58 PM", + "BUILD.bazel": "*.bzl, *.bazel, *.bazelrc, bazel.rc, .bazelignore, .bazelproject, WORKSPACE", + "CMakeLists.txt": "*.cmake, *.cmake.in, .cmake-format.yaml, CMakePresets.json", + "I*.cs": "$(capture).cs", + "artisan": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, server.php, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, webpack.mix.js, windi.config.*", + "astro.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "cargo.toml": ".clippy.toml, .rustfmt.toml, cargo.lock, clippy.toml, cross.toml, rust-toolchain.toml, rustfmt.toml", + "composer.json": ".php*.cache, composer.lock, phpunit.xml*, psalm*.xml", + "default.nix": "shell.nix", + "deno.json*": "*.env, .env.*, .envrc, api-extractor.json, deno.lock, env.d.ts, import-map.json, import_map.json, jsconfig.*, tsconfig.*, tsdoc.*", + "dockerfile": ".dockerignore, docker-compose.*, dockerfile*", + "flake.nix": "flake.lock", + "gatsby-config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, gatsby-browser.*, gatsby-node.*, gatsby-ssr.*, gatsby-transformer.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "gemfile": ".ruby-version, gemfile.lock", + "go.mod": ".air*, go.sum", + "go.work": "go.work.sum", + "mix.exs": ".credo.exs, .dialyzer_ignore.exs, .formatter.exs, .iex.exs, .tool-versions, mix.lock", + "next.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, next-env.d.ts, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "nuxt.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "pubspec.yaml": ".metadata, .packages, all_lint_rules.yaml, analysis_options.yaml, build.yaml, pubspec.lock, pubspec_overrides.yaml", + "pyproject.toml": ".pdm.toml, pdm.lock, pyproject.toml", + "quasar.conf.js": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, quasar.extensions.json, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "readme*": "authors, backers*, changelog*, citation*, code_of_conduct*, codeowners, contributing*, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors*", + "remix.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, remix.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "rush.json": ".browserslist*, .circleci*, .commitlint*, .cz-config.js, .czrc, .dlint.json, .dprint.json, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lintstagedrc*, .markdownlint*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .simple-git-hooks*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .versionrc*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, Procfile, apollo.config.*, appveyor*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, dangerfile*, dlint.json, dprint.json, eslint*, firebase.json, grunt*, gulp*, jenkins*, lerna*, lint-staged*, nest-cli.*, netlify*, nodemon*, npm-shrinkwrap.json, nx.*, package-lock.json, package.nls*.json, phpcs.xml, pm2.*, pnpm*, prettier*, pullapprove*, pyrightconfig.json, release-tasks.sh, release.config.*, renovate*, rollup.config.*, rspack*, simple-git-hooks*, stylelint*, tslint*, tsup.config.*, turbo*, typedoc*, unlighthouse*, vercel*, vetur.config.*, webpack*, workspace.json, xo.config.*, yarn*", + "shims.d.ts": "*.d.ts", + "svelte.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, houdini.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, mdsvex.config.js, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vite.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "vite.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "vue.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "*.sqlite": "${capture}.${extname}-*", + "*.db": "${capture}.${extname}-*", + "*.sqlite3": "${capture}.${extname}-*", + "*.db3": "${capture}.${extname}-*", + "*.sdb": "${capture}.${extname}-*", + "*.s3db": "${capture}.${extname}-*" + }, + + "[mdx]": { + "editor.defaultFormatter": "unifiedjs.vscode-mdx" + }, + + "github.copilot.nextEditSuggestions.enabled": true, + "githubLocalActions.dockerDesktopPath": "/Applications/OrbStack.app", + + "outline.collapseItems": "alwaysCollapse", + "custom-ui-style.external.imports": [], + "animations.Enabled": true, + "animations.Active": "Indent", + "animations.Tabs": "Flip", + "thunder-client.sidebar.layout": "compact", + "animations.Scrolling": "Slide", + "animations.Auto-Install": false, + "animations.Install-Method": "Custom UI Style" +} diff --git a/editor/vscode/snippets/global.code_snippets b/editor/vscode/snippets/global.code_snippets new file mode 100644 index 0000000..436b9d4 --- /dev/null +++ b/editor/vscode/snippets/global.code_snippets @@ -0,0 +1,93 @@ +{ + "import": { + "scope": "javascript,typescript", + "prefix": "im", + "body": [ + "import { $1 } from '$2';" + ], + "description": "Import a module" + }, + "export-all": { + "scope": "javascript,typescript", + "prefix": "ex", + "body": [ + "export * from '$2';" + ], + "description": "Export a module" + }, + "vue-script-setup": { + "scope": "vue", + "prefix": "", + "const props = defineProps<{", + " modelValue?: boolean,", + "}>()", + "$1", + "", + "", + "", + " ", + " ", + " ", + "", + ] + }, + "vue-template-ref": { + "scope": "javascript,typescript,vue", + "prefix": "tref", + "body": [ + "const ${1:el} = shallowRef()", + ] + }, + "vue-computed": { + "scope": "javascript,typescript,vue", + "prefix": "com", + "body": [ + "computed(() => { $1 })" + ] + }, + "vue-watch-effect": { + "scope": "javascript,typescript,vue", + "prefix": "watchE", + "body": [ + "watchEffect(() => {", + " $1", + "})" + ] + }, + "if-vitest": { + "scope": "javascript,typescript", + "prefix": "ifv", + "body": [ + "if (import.meta.vitest) {", + " const { describe, it, expect } = import.meta.vitest", + " ${1}", + "}" + ] + }, + "markdown-api-table": { + "scope": "markdown", + "prefix": "table", + "body": [ + "", + "", + "", + "", + "### API", + "", + "Description", + "", + "", + "", + "", + "```ts", + "// code block", + "```", + "", + "", + "", + "", + ], + } +} diff --git a/editor/vscode/snippets/vue.json b/editor/vscode/snippets/vue.json new file mode 100644 index 0000000..e69de29 diff --git a/editor/vscode/sync-extensions.sh b/editor/vscode/sync-extensions.sh new file mode 100644 index 0000000..57d56b4 --- /dev/null +++ b/editor/vscode/sync-extensions.sh @@ -0,0 +1,54 @@ +alefragnani.project-manager +antfu.iconify +astro-build.astro-vscode +augment.vscode-augment +bradlc.vscode-tailwindcss +catppuccin.catppuccin-vsc-icons +dbaeumer.vscode-eslint +dnicolson.binary-plist +docker.docker +eamodio.gitlens +enkia.tokyo-night +esbenp.prettier-vscode +formulahendry.auto-close-tag +formulahendry.auto-complete-tag +formulahendry.auto-rename-tag +github.copilot +github.copilot-chat +github.vscode-github-actions +github.vscode-pull-request-github +golang.go +gruntfuggly.todo-tree +johnsoncodehk.vscode-tsconfig-helper +josemurilloc.aura-spirit-dracula +kisstkondoros.vscode-gutter-preview +laravel.vscode-laravel +liamhammett.inline-parameters +lzm0x219.vscode-markdown-github +meganrogge.template-string-converter +mhutchie.git-graph +ms-azuretools.vscode-containers +ms-azuretools.vscode-docker +ms-vscode-remote.remote-containers +ms-vscode-remote.remote-ssh +ms-vscode-remote.remote-ssh-edit +ms-vscode.makefile-tools +ms-vscode.remote-explorer +naumovs.color-highlight +nuxtr.nuxtr-vscode +patbenatar.advanced-new-file +pkief.material-icon-theme +qwtel.sqlite-viewer +rangav.vscode-thunder-client +rodrigovallades.es7-react-js-snippets +sanjulaganepola.github-local-actions +sdras.vue-vscode-snippets +sheltonlouis.astro-snippets +streetsidesoftware.code-spell-checker +subframe7536.custom-ui-style +unifiedjs.vscode-mdx +usernamehw.errorlens +vitest.explorer +vue.volar +vunguyentuan.vscode-css-variables +yoavbls.pretty-ts-errors diff --git a/fontconfig/fonts.conf b/fontconfig/fonts.conf new file mode 100644 index 0000000..4667aca --- /dev/null +++ b/fontconfig/fonts.conf @@ -0,0 +1,37 @@ + + + + + serif + + Noto Serif CJK TC + Noto Serif CJK JP + Noto Serif CJK KR + jf-openhuninn-2.1 + Noto Serif CJK SC + + + + + sans-serif + + Noto Sans CJK TC + Noto Sans CJK JP + Noto Sans CJK KR + jf-openhuninn-2.1 + Noto Sans CJK SC + + + + + monospace + + Inconsolata + Noto Sans Mono CJK TC + Noto Sans Mono CJK JP + Noto Sans Mono CJK KR + jf-openhuninn-2.1 + Noto Sans Mono CJK SC + + + diff --git a/fontconfig/fonts/Dank Mono.zip b/fontconfig/fonts/Dank Mono.zip new file mode 100644 index 0000000..cc54b0f Binary files /dev/null and b/fontconfig/fonts/Dank Mono.zip differ diff --git a/fontconfig/fonts/DankMono Nerd Font.zip b/fontconfig/fonts/DankMono Nerd Font.zip new file mode 100644 index 0000000..ed44bcc Binary files /dev/null and b/fontconfig/fonts/DankMono Nerd Font.zip differ diff --git a/fontconfig/fonts/Operator Mono Lig Nerd Font.zip b/fontconfig/fonts/Operator Mono Lig Nerd Font.zip new file mode 100644 index 0000000..92b83af Binary files /dev/null and b/fontconfig/fonts/Operator Mono Lig Nerd Font.zip differ diff --git a/fontconfig/fonts/Recursive_Code.zip b/fontconfig/fonts/Recursive_Code.zip new file mode 100644 index 0000000..2b69a25 Binary files /dev/null and b/fontconfig/fonts/Recursive_Code.zip differ diff --git a/fontconfig/fonts/SF Mono.zip b/fontconfig/fonts/SF Mono.zip new file mode 100644 index 0000000..0c8d963 Binary files /dev/null and b/fontconfig/fonts/SF Mono.zip differ diff --git a/fontconfig/install-fonts.sh b/fontconfig/install-fonts.sh new file mode 100644 index 0000000..fde7673 --- /dev/null +++ b/fontconfig/install-fonts.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash + +# mkdir -p ~/.local/share/fonts/JetBrainsMono + +# curl -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz | tar --extract --xz --directory ~/.local/share/fonts/JetBrainsMono + +# curl -L https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.gz | tar --extract --gzip --directory /Library/Fonts + +#curl -L https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.4.8.tar.bz2 | tar --extract --bzip --directory . + + +set -euo pipefail + + +readonly SCRIPT_NAME=${0##*/} +readonly TEMP_DIR=/tmp/fonts_$$ +readonly SUPPORTED_EXTENSIONS=("ttf" "otf" "woff" "woff2") + +readonly MACOS_FONT_DIR="/Library/Fonts" +readonly LINUX_FONT_DIR="/usr/share/fonts/truetype" + + +readonly RED='\033[0;31m' +readonly GREEN='\033[0;32m' +readonly YELLOW='\033[1;33m' +readonly NC='\033[0m' # No Color + +# Logging functions +log_info() { + echo -e "${GREEN}[INFO]${NC} $*" >&2 +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $*" >&2 +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $*" >&2 +} + + +cleanup() { + local exit_code=$? + [[ -d "$TEMP_DIR" ]] && rm -rf "$TEMP_DIR" + exit $exit_code +} + +trap cleanup EXIT INT TERM + + + + + +check_tools_requested() { + local missing_tools=() + + [[ -z $commands[unzip] ]] && missing_tools+=("unzip") + [[ -z $commands[find] ]] && missing_tools+=("find") + + if [[ ! is_macos && -z $commands[fc-cache] ]]; then + missing_tools+=("fc-cache") + fi + + if [[ ${#missing_tools[@]} -gt 0 ]]; then + log_error "Missing required tools: ${missing_tools[*]}" + return 1 + fi +} + + + + +find_font_files() { + + local search_dir="$1" + local -a find_args=() + + + for i in "${!SUPPORTED_EXTENSIONS[@]}"; do + local ext="${SUPPORTED_EXTENSIONS[i]}" + if [[ $i -eq 0 ]]; then + find_args+=("-iname" "*.${ext}") + else + find_args+=("-o" "-iname" "*.${ext}") + fi + done + + find "$search_dir" -type f \( "${find_args[@]}" \) -print0 +} + +extract_fonts() { + local font_folder="$1" + local extracted_count=0 + while IFS= read -r -d '' zip_file; do + local filename=${zip_file##*/} + local filename_without_ext=${filename%.*} + local extract_dir="$TEMP_DIR/$filename_without_ext" + + if ! unzip -o -q "$zip_file" -d "$extract_dir" 2>/dev/null; then + log_warn "Failed to extract: $zip_file" + continue + fi + + ((extracted_count++)) + + done < <(command find $FONT_FOLDER -maxdepth 1 -type f -iname '*.zip' -print0 ) + +} + +install_fonts() { + local installed_count=0 + local failed_count=0 + + + log_info "Installation complete: $installed_count installed, $failed_count failed" + + while IFS= read -r -d '' font_file; do + if install_font_file "$font_file" "$font_dir"; then + ((installed_count++)) + else + ((failed_count++)) + fi + done < <(find_font_files "$TEMP_DIR") + + if [[ $installed_count -eq 0 ]]; then + log_warn "No fonts were installed" + return 1 + fi +} + + +show_usage() { + cat << EOF +Usage: $SCRIPT_NAME [FONT_FOLDER] + +Install fonts from ZIP archives in the specified directory. + +Arguments: + FONT_FOLDER Directory containing font ZIP files (default: current directory) + +Supported font formats: ${SUPPORTED_EXTENSIONS[*]} + +Examples: + $SCRIPT_NAME # Install from current directory + $SCRIPT_NAME ~/Downloads/fonts # Install from specific directory + +EOF +} + +main() { + # Parse arguments + if [[ $# -gt 1 ]] || [[ "${1:-}" == "-h" ]] || [[ "${1:-}" == "--help" ]]; then + show_usage + exit 0 + fi + + local font_folder="${1:-.}" + + + + check_tools_requested || exit 1 + validate_directory "$font_folder" || exit 1 + + # Create temporary directory + mkdir -p "$TEMP_DIR" + + # Execute main workflow + extract_font_archives "$font_folder" + install_fonts + update_font_cache + + log_info "Font installation completed successfully!" +} + +if [[ ${BASH_SOURCE[0]} == $0 ]]; then + main "$@" +fi diff --git a/git/.gitconfig b/git/.gitconfig deleted file mode 100644 index 29c567c..0000000 --- a/git/.gitconfig +++ /dev/null @@ -1,13 +0,0 @@ -[core] - editor = nvim - whitespace = trailing-space,space-before-tab - pager = diff-so-fancy | less --tabs=4 -RFX -[pager] - diff = diff-so-fancy | less --tabs=4 -RFX - show = diff-so-fancy | less --tabs=4 -RFX -[merge] - conflictstyle = zdiff3 -[init] - defaultBranch = main -[diff] - algorithm = histogram diff --git a/git/.gitconfig.user b/git/.gitconfig.user deleted file mode 100644 index 036ce44..0000000 --- a/git/.gitconfig.user +++ /dev/null @@ -1,15 +0,0 @@ -[user] - name = orangzz - email = bayesinaifeg1@gmail.com - signingkey = /Users/ayao/.ssh/id.account@github -[commit] - gpgsign = true -[tag] - gpgsign = true -[gpg] - format = ssh - program = /usr/local/bin/gpg -[http] - proxy = http://127.0.0.1:6152 -[https] - proxy = http://127.0.0.1:6152 diff --git a/git/.gitignore b/git/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/git/config b/git/config new file mode 100644 index 0000000..041f863 --- /dev/null +++ b/git/config @@ -0,0 +1,68 @@ +[core] + editor = nvim + whitespace = trailing-space,space-before-tab + pager = diff-so-fancy | less --tabs=4 -RFX + excludesfile = $HOME/.config/git/.gitignore + autocrlf = true +[color "decorate"] + HEAD = red + branch = blue + tag = yellow + remoteBranch = magenta +[pager] + diff = diff-so-fancy | less --tabs=4 -RFX + show = diff-so-fancy | less --tabs=4 -RFX +[interactive] + diffFilter = diff-so-fancy --patch + singlekey = true +[push] + followTags = true + default = current +[pull] + default = current + ff = only + rebase = true +[init] + defaultBranch = main +[diff] + algorithm = histogram +[status] + branch = true + showStash = true + showUntrackedFiles = all +[commit] + gpgsign = true +[tag] + gpgsign = true + sort = -committerdate +[branch] +[merge] + keepBackup = false + prompt = false + conflictstyle = zdiff3 + tool = code +[rebase] + autoStash = true +[mergetool "code"] + cmd = code --wait --merge $REMOTE $LOCAL $BASE $MERGED +[mergetool "nvimdiff"] + cmd = nvim -d $MERGED $LOCAL $REMOTE +e +[push] + followTags = true +[gpg] + program = /usr/local/bin/gpg + format = openpgp +[includeIf "gitdir:$HOME/repos/"] + path = $HOME/.config/git/.gitconfig.orangzz +[includeIf "gitdir:$HOME/team/ransomnia/"] + path = $HOME/.config/git/.gitconfig.ransomnia + + +# git config --global url."https://github".insteadOf git://github +[url "git@github.com:orangzz/"] + insteadof = "og:" + +# gcl gh:vitejs/vite +[url "git@github.com:"] + insteadof = "gh:" diff --git a/git/user.config b/git/user.config new file mode 100644 index 0000000..df3a5d8 --- /dev/null +++ b/git/user.config @@ -0,0 +1,11 @@ +[user] + name = orangzz + email = bayesinaifeg1@gmail.com + signingkey = ~/.ssh/id.account@github +[http] + proxy = http://127.0.0.1:6152 +[https] + proxy = http://127.0.0.1:6152 + + + diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf new file mode 100644 index 0000000..6805de6 --- /dev/null +++ b/gnupg/gpg-agent.conf @@ -0,0 +1,4 @@ +default-cache-ttl 28800 +max-cache-ttl 28800 +allow-loopback-pinentry +pinentry-program /usr/bin/pinentry-gtk-2 diff --git a/gnupg/gpg.conf b/gnupg/gpg.conf new file mode 100644 index 0000000..5c97430 --- /dev/null +++ b/gnupg/gpg.conf @@ -0,0 +1,6 @@ +# gpgconf --reload gpg-agent + +# gpgconf --launch gpg-agent + +use-agent +pinentry-mode loopback diff --git a/gnupg/gpginit.zsh b/gnupg/gpginit.zsh new file mode 100644 index 0000000..b46ca8c --- /dev/null +++ b/gnupg/gpginit.zsh @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh +GNUPGHOME=${XDG_DATA_HOME:-$HOME/.local/share}/gnupg +mkdir -p $GNUPGHOME +chown -R $(whoami) $GNUPGHOME +chmod 600 $GNUPGHOME/* +chmod 700 $GNUPGHOME + +GPG_TTY="$(tty)" +export GPG_TTY +# unset SSH_AGENT_PID +# if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then +# export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +# gpgconf --launch gpg-agent +# fi + + diff --git a/homebrew/Brewfile b/homebrew/Brewfile index 6a06cc4..a74933b 100644 --- a/homebrew/Brewfile +++ b/homebrew/Brewfile @@ -1,93 +1,3 @@ - - -# bat file | pbcopy -# bat file | xclip -# bat file --plain - - - -# brew leaves -# brew bundle add - -# `brew bundle add name […]`: Add entries to your Brewfile -# `brew bundle remove name […]`: Remove entries that match name from your Brewfile - -# brew bundle dump --file=$DOTFILES/brewfile -# brew bundle install --file=$DOTFILES/brewfile -# remove a package, including all it's dependencies.`brew rm --deps` -# cleanup installed package to match brewfile `brew bundle --force cleanup` - - -############################################################################### -# Core CLI Could Not Live Without # -############################################################################### - -# directory jump by path segement direct + frecency(frequency+recency) -# Setup shell integration: `echo 'eval "$(zoxide init --cmd cd zsh)"' >> ~/.zshrc` -brew "zoxide" -brew "broot" - - -# history search, directory search -# Set up fzf key bindings and fuzzy completion `source <(fzf --zsh)` -# nvim $(fzf -m --preview="bat --color=always {}") -brew "fzf" -# file exploer -brew "yazi" - - - -brew "bat" -# system monitor: disk, memory, netowork, process -brew "btop" -# disk tmpfs ext4 -brew "duf" -# tree view -brew "lsd" -brew "ripgrep" -brew "git" -brew "diff-so-fancy" -brew "lazygit" - - -brew "starship" -brew "neovim" -brew "luarocks" -# Arguing that you don't care about the right to privacy because you have nothing to hide is no different from saying you don't care about free speech because you have nothing to say. – Edward Snowden -brew "gpg" # The GNU Privacy Guard(open library) - -# utils - -brew "hexyl" # hex viewer - -brew "cointop" -brew "jq" -brew "imagemagick" -brew "ripgrep" -brew "pulumi/tap/pulumi" - -# http -brew "httpie" -brew "hurl" -brew "wget" -brew "curl" - # yotubedownloader - - - -# network utils -brew "doggo" -brew "iproute2mac" - -# audio/video -cask "obs" -# window tiling manager for macos -# hyperland,wayland compositor for unix -cask "loop" -cask "legcord" -cask 'ghostty' -cask "ngrok" -cask "orbstack" -cask "aerial" -# app launcher -cask "raycast" +tap 'homebrew/bundle' +tap 'homebrew/core' +tap 'homebrew/services' diff --git a/homebrew/Brewfile.d/aigc.Brewfile b/homebrew/Brewfile.d/aigc.Brewfile new file mode 100644 index 0000000..47d07e4 --- /dev/null +++ b/homebrew/Brewfile.d/aigc.Brewfile @@ -0,0 +1,16 @@ +### AIGC {{{ + # Get up and running with large language models. + cask 'ollama' + + + mas 'Perplexity: Ask Anything', id: 6714467650 + + # Interact with Google Gemini AI models from the command-line + brew 'gemini-cli' + + # Anthropic's official Claude AI desktop app + cask 'claude' + + # Manage multiple AI terminal agents like Claude Code, Aider, Codex, OpenCode, and Amp + brew 'claude-squad' +### }}} diff --git a/homebrew/Brewfile.d/automation.Brewfile b/homebrew/Brewfile.d/automation.Brewfile new file mode 100644 index 0000000..09edd77 --- /dev/null +++ b/homebrew/Brewfile.d/automation.Brewfile @@ -0,0 +1,37 @@ + + + + + +### Power and Charge management {{{ + cask "aldente" +}}} + + +### info channel {{{ + cask "folo" + cask "rsshub" +}}} + +### Database {{{ + # cask 'Navicat Premium' + # cask 'TablePlus' +}}} + + + + +### automation {{{ + cask "hammperspoon" # window movement, window resize, window position + cask "raycast" # app launcher + cask "loop" if OS.mac # window position + cask "amethyst" if OS.mac # window tiling manager + # `pluginkit -mAD -p com.apple.FinderSync -vvv` list finder extensions + cask "openinterminal" # FinderExtension, open current directory in Terminal or Editor, copy path +### }}} + +### Android SDK {{{ + # cask 'android-platform-tools' +### }}} + + diff --git a/homebrew/Brewfile.d/blockchain.Brewfile b/homebrew/Brewfile.d/blockchain.Brewfile new file mode 100644 index 0000000..7bd44c2 --- /dev/null +++ b/homebrew/Brewfile.d/blockchain.Brewfile @@ -0,0 +1,11 @@ + + +### Ethereum {{{ + + # brew 'ethereum' +### }}} + + +### Solidity {{{ + brew 'ethereum/ethereum/solidity' +### }}} diff --git a/homebrew/Brewfile.d/browser.Brewfile b/homebrew/Brewfile.d/browser.Brewfile new file mode 100644 index 0000000..7886d07 --- /dev/null +++ b/homebrew/Brewfile.d/browser.Brewfile @@ -0,0 +1,8 @@ +### Web Browser {{{ + brew "mas" + cask 'google-chrome-dev' + + cask 'zen' + cask "dia" + mas "Wappalyzer", id: 1520333300 +### }}} diff --git a/homebrew/Brewfile.d/dev-container.Brewfile b/homebrew/Brewfile.d/dev-container.Brewfile new file mode 100644 index 0000000..92a10bf --- /dev/null +++ b/homebrew/Brewfile.d/dev-container.Brewfile @@ -0,0 +1,45 @@ + + + + + +### Container {{{ + cask "orbstack" # replacement for docker desktop + brew 'dive' # exploring each layer in a docker image + brew 'lazydocker' # manage docker + + podman # daemonless and "rootless" userspace container engin (rootful) + + +### }}} + + + +### Kubernetes {{{ + + brew 'kubernetes-cli' + brew 'k9s' + brew 'helm/tap/helm' + brew 'helmfile' + brew 'chart-releaser' + brew 'chart-testing' + brew 'kustomize' + brew 'skaffold' + brew 'krew' + + ## Access Control + + brew 'kubectx' + + brew 'danielfoehrkn/switch/switch' + brew 'int128/kubelogin/kubelogin + + brew 'kyverno' + brew 'Ladicle/kubectl-bindrole/kubectl-rolesum' + brew 'boz/repo/kail' + brew 'stern' + + brew 'txn2/tap/kubefwd' + brew 'kops' + brew 'minikube' +### }}} diff --git a/homebrew/Brewfile.d/devops.Brewfile b/homebrew/Brewfile.d/devops.Brewfile new file mode 100644 index 0000000..4e2c79f --- /dev/null +++ b/homebrew/Brewfile.d/devops.Brewfile @@ -0,0 +1,71 @@ + + + + + + +### AZURE {{{ + brew 'az' +### }}} + + +### AWS {{{ + brew 'awscli' + cask 'aws-vault' # store and retrive aws credentail +### }}} + + +### HashiCorp: Terraform {{{ + # tap 'hashicorp/tap' + # brew 'terraform' + brew "hashicorp/tap/terraform" + brew "terragrunt" + brew 'hashicorp/tap/hcp' +### }}} + + +### HashiCorp: Vagrant {{{ + # cask 'hashicorp/tap/hashicorp-vagrant' + # cask 'vagrant-manager' +### }}} + + +### Pulumi {{{ + brew "pulumi/tap/pulumi" + +### }}} + + + +### Argo {{{ + tap 'argoproj/tap' + brew 'argocd' + brew 'argo' + brew 'kubectl-argo-rollouts' + + brew 'istioctl' +### }}} + + +### Ansible {{{ + brew 'ansible' + brew 'ansible-lint' + # brew 'molecule' +### }}} + + + +### CI/CD {{{ + # github action + brew 'act' + brew 'actionlint' + brew "gh" + # gitlab ci + + brew 'circleci' + brew 'travisci' + + # tap 'drone/drone' + # brew 'drone' +}}} + diff --git a/homebrew/Brewfile.d/env.Brewfile b/homebrew/Brewfile.d/env.Brewfile new file mode 100644 index 0000000..4fac40e --- /dev/null +++ b/homebrew/Brewfile.d/env.Brewfile @@ -0,0 +1,52 @@ + + + +# Arguing that you don't care about the right to privacy because you have nothing to hide is no different from saying you don't care about free speech because you have nothing to say. – Edward Snowden + +### env-manager {{{ + brew "dotenv" + brew "direnv" + + +}}} + + +### secret-manager {{{ + +}}} +### password-manager {{{ + brew "passwordstore" +}}} + + +### credential-helper {{{ + + # ssh-agent + # gpg-agent + + brew 'gnupg' + brew 'gpg-tui' + cask "gpg-suite" if OS.mac? + + # credential manager + cask '1password' + cask '1password-cli' + mas '1Password for Safari', id: 1569813296 + + cask 'git-credential-manager' # cross-platform credential helper with support multi-factor auth + cask "pass-git-helper" + brew "netrc" + + + brew "direnv" + + # os keychain + # add_to_keychain + # remove_from_keychain + + + # credential vault - store and retrive secret + brew "doppler" + + # brew 'jorgelbg/tap/pinentry-touchid' if OS.mac? +### }}} diff --git a/homebrew/Brewfile.d/font.Brewfile b/homebrew/Brewfile.d/font.Brewfile new file mode 100644 index 0000000..842439a --- /dev/null +++ b/homebrew/Brewfile.d/font.Brewfile @@ -0,0 +1,15 @@ +### Font Family: Terminal {{{ + + ## takes string and renders each letter using ASCII art fonts. + brew "figlet" + + + ## Monospace Nerd Font + cask 'homebrew/cask-fonts/menlo-font' + cask 'homebrew/cask-fonts/iMWritingQuatNerd-font' + # Monospace + + + + brew "ttx" # ttx: Convert fonts to XML and back +### }}} diff --git a/homebrew/Brewfile.d/lang.brewfile b/homebrew/Brewfile.d/lang.brewfile new file mode 100644 index 0000000..667c0ca --- /dev/null +++ b/homebrew/Brewfile.d/lang.brewfile @@ -0,0 +1,10 @@ +### language runtime and lcp {{{ + + +}}} + + + +### lang compiler or interpreter {{{ + +}}} diff --git a/homebrew/Brewfile.d/messaging.Brewfile b/homebrew/Brewfile.d/messaging.Brewfile new file mode 100644 index 0000000..add0db2 --- /dev/null +++ b/homebrew/Brewfile.d/messaging.Brewfile @@ -0,0 +1,25 @@ + + + + + + + +### Email {{{ + # The best personal email client + # mas 'Spark Desktop', id: 6445813049 +### }}} + + +### Team Communication {{{ + + # mas 'Slack for Desktop', id: 803453959 + # cask 'zoom' +### }}} + +### Instant messaging(IM) {{{ + cask "legcord" + cask "signal" + # cask "matrix" + # cask 'telegram' +}}} diff --git a/homebrew/Brewfile.d/network.Brewfile b/homebrew/Brewfile.d/network.Brewfile new file mode 100644 index 0000000..c9b8ce3 --- /dev/null +++ b/homebrew/Brewfile.d/network.Brewfile @@ -0,0 +1,62 @@ + + +### Tunnel {{{ + cask "ngrok" +}}} + +### Proxy {{{ + # cask "surge" +}}} + +### VPN {{{ + # wireguard, openvpn, l2tp over ipsec, cisco ipsec, ikev2 + # brew "mullvad" + # brew "protonvpn" # swiss based +}}} + + + +### certificate {{{ + brew "mkcert" + brew "openssl" +}}} + +### Remote Access {{{ + + # rsdesk +}}} + + + +### Wi-Fi scanning, analyzer, packet capture, troubleshoting {{{ + + +}}} + + +### Troubleshoting {{{ + brew "doggo" + # GNU network utils + # observe network traffic + brew "iproute2mac" + # port scaning + # -sV: Probe open ports to determine service/version info + # rustscan --ulimit 5000 --addresses 127.0.0.1,0.0.0.0,192.168.95.248 --ports 23803,49222,49803,49804,49805,54798,65005 -- -sV -sC + # brew "nmap" + brew "rustscan" + # sudo arp-scan --interface en0 --localnet + brew "arp-scan" + + # interface config + + + # device discovery on local network + # service discovery + + + brew "httpie" + brew "hurl" + brew "wget" + brew "curl" + brew "bruno" +}}} diff --git a/homebrew/Brewfile.d/project.Brewfile b/homebrew/Brewfile.d/project.Brewfile new file mode 100644 index 0000000..996d623 --- /dev/null +++ b/homebrew/Brewfile.d/project.Brewfile @@ -0,0 +1,52 @@ + +### API client{{{ + # cask 'Bruno' + brew "posting" + brew "hurl" + brew "curl" + brew "wget" + brew "aria2" + brew "jq" + brew "calcure" +}}} + +### GitHub {{{ + brew 'gh' + cask 'gitify' + mas 'Refined GitHub', id: 1519867270 +### }}} + +### project management {{{ + "linear" + "trello" + "jira" + # github git lab project management +}}} + + +### deployment {{{ + brew "netlify-cli" + brew "wangler-cli" + brew "sentry-cli" +}}} + +### Git {{{ + brew "git" + brew "diff-so-fancy" + brew "lazygit" + cask 'gitkraken' +}}} + + +### editor {{{ + # mas 'Xcode', id: 497799835 + cask 'visual-studio-code' + cask 'zed' + # cask "arduino" + cask "neovim" + cask "lazyvim" + + cask "astronvim" + cask "ava + cask "helix" +### }}} diff --git a/homebrew/Brewfile.d/storage.Brewfile b/homebrew/Brewfile.d/storage.Brewfile new file mode 100644 index 0000000..2cc789c --- /dev/null +++ b/homebrew/Brewfile.d/storage.Brewfile @@ -0,0 +1,17 @@ +# cloud storage provider +# amazon s3, alibaba s3, alibaba oss +# mount network drives +# AFP(Apple Filing Protocol), SMB(Server Message Block) +# cloud drive, local drives, webdav +# google cloud drive +### {{{ + cask "transmit" # dual panel file transfer and manager +}}} +# ftps, scp, sftp, +cask "localSend" # local file sharing +cask "blip" +# cask "picList" +brew "rclone" +cask "transmit" + + diff --git a/homebrew/Brewfile.d/stream.Brewfile b/homebrew/Brewfile.d/stream.Brewfile new file mode 100644 index 0000000..7649d90 --- /dev/null +++ b/homebrew/Brewfile.d/stream.Brewfile @@ -0,0 +1,53 @@ +# object storage service +### {{{ + brew "rsync" + brew "rclone" + cask "transmit" # dual panel file transfer and manager + cask "localSend" # sharing files, folder, clipboard between local device + cask "blip" # sharing files, folder between local device, don't support clipboard paste + # cask "picList" + # cask "transmit" +}}} +# ftps, scp, sftp, + +# cloud drive, webdav +# mount as network volume + + +### screen recorder and live stream {{{ + cask "obs" # live streaming and screen recording + # cask "kap" + cask "keycastr" # keystroke visualiser + # all in one studio + # cask "screensage" + # cask "screen-studio" + # cask "ficusee" +}}} + + +### screen annoation {{{ + # brilliant.design + # prenstify +}}} + +### screen capture {{{ + brew "cleanshot" +}}} + + +### video editing {{{ + +}}} + + + +### media player {{{ + cask "iina" # mpv based media player +}}} + + +### home theater, media center, entertainment hub {{{ + cask "kodi" +}}} +# music, movie, tv show, photos, game vault + diff --git a/homebrew/Brewfile.d/terminal.Brewfile b/homebrew/Brewfile.d/terminal.Brewfile new file mode 100644 index 0000000..2b1494d --- /dev/null +++ b/homebrew/Brewfile.d/terminal.Brewfile @@ -0,0 +1,80 @@ +### Terminal Emulator {{{ + cask 'ghostty' + # cask 'kitty' + # cask 'terminus' + # cask 'wezterm' + # cask 'warp' + # cask 'alacritty' + # cask 'iterm2' + # mobile + # cask "secure-shellfish" + # termius +### }}} + + +### Terminal Multiplexer {{{ + # session presistent: detach from session, reattach to session + brew 'zellij' + brew 'tmux' +### }}} + + + +### Shell {{{ + brew 'bash' + brew 'zsh' + brew "fish" + brew 'zsh/vi-mode' + brew 'zsh-user/completions' + brew 'zsh-user/auto-suggestion' +### }}} + + +### Prompt {{{ + brew 'starship' +### }}} + +### system utilities {{{ + + + brew "watch" # execute command periodically, and display the result. + brew 'hyperfine' # benchmark + + # tree view + brew "lsd" + brew "ripgrep" + brew "hexyl" # dump hex to stdout + brew "yt-dlp" + brew "mailsy" # quickly generate a temporary email address + brew "imagemagick" + brew "pastel" # generate, analyze, convert and manipulate colors + + brew "tldr" +}}} + +### monitor, statistic {{{ + brew "duf" # disk usage tmpfs ext4 + brew "dysk" # disk usage tmpfs ext4 + brew "btop" # system monitor: disk, memory, network, process + brew "ctop" + brew "mactop" +}}} + +### file utils {{{ + cask "keka" # extract and archive + # directory jump by path segment direct + frecency(frequency+recency) + brew "zoxide" + brew "broot" + # history search, directory search + # Set up fzf key bindings and fuzzy completion `source <(fzf --zsh)` + # nvim $(fzf -m --preview="bat --color=always {}") + brew "fzf" + + # bat file | xclip + # bat file --plain + brew "bat" + + # GNU coreutils to replace bsd coreutils + # cp and mv with progress and confirm + brew "coreutils" +}}} diff --git a/homebrew/run-brewfile.zsh b/homebrew/run-brewfile.zsh old mode 100644 new mode 100755 index 8f0eea4..b5b9d25 --- a/homebrew/run-brewfile.zsh +++ b/homebrew/run-brewfile.zsh @@ -1,14 +1,86 @@ +# download, verify, install, run(fg,bg), check + export HOMEBREW_BUNDLE_FILE_GLOBAL="$HOME/.config/homebrew/Brewfile" -# brew bundle install --verbose --file $DOTFILES/Brewfile -brew bundle install --global --verbose +export HOMEBREW_NO_AUTO_UPDATE=1 +# dump to current directory by default +# brew bundle dump --file=$DOTFILES/brewfile +# brew bundle dump --global + + +# take instruction from each entry from brewfile and run brew install +# brew bundle install --verbose --file=$DOTFILES/Brewfile +# brew bundle install --global --verbose + + +() { + # `local` sets a variable's scope to this function and its descendendants. + local file= + + # Load all of the files in rc.d that start with - and end in `.Brewfile`. + # (n) sorts the results in numerical order. + # <0-> matches any integer >= 0. + # <-> is the same as <0-> + for file in $XDG_CONFIG_HOME/homebrew/Brewfile.d/*.Brewfile(n); do + brew bundle install --file=$file + + done +} "$@" + + + +# brew bundle cleanup --force --global # brew bundle cleanup --force --file $DOTFILES/Brewfile -# brew leaves -# brew bundle add + +# Homebrew Terminology: + + +# tap 水龙头 +# livecheck for new releases +# [maintain formulas by vendor](https://github.com/orgs/Homebrew/discussions/268) +# main tap - `homebrew/cask`,`homebrew/core` + + + + +# formula 配方 cli +# cask 酒桶 gui +# bottle 装瓶 +# service + +# mas (cli for mac app store) + + + + + +# brew info --cask +# brew info # just like `npm info {executable}` + +# remove installed tools +# for tool in curl wget; do +# sudo rm -f $HOMEBREW_PREFIX/Cellar/$tool +# done + + + +# ls $(brew --prefix)/bin + + + + +# list installed package as entry from Brewfile +# brew bundle list -g +# brew bundle list --cask -g + + + # `brew bundle add name […]`: Add entries to your Brewfile # `brew bundle remove name […]`: Remove entries that match name from your Brewfile -# brew bundle dump --file=$DOTFILES/brewfile + + + diff --git a/k8s/deployment.yml b/k8s/deployment.yml new file mode 100644 index 0000000..e69de29 diff --git a/misc/wiki.md b/misc/wiki.md new file mode 100644 index 0000000..f7be32b --- /dev/null +++ b/misc/wiki.md @@ -0,0 +1,3 @@ +1. detect the runtime versions that are being requested by the current project, +2. activate the requested versions if I already have them installed, and +3. warn me if the project is requesting a runtime version that isn't installed. diff --git a/npm/.npmrc b/npm/.npmrc index f618110..2ac7024 100644 --- a/npm/.npmrc +++ b/npm/.npmrc @@ -1,3 +1,6 @@ proxy=http://127.0.0.1:6152 https-proxy=http://127.0.0.1:6152 registry=https://registry.npmjs.org/ +init-license=MIT +init-author-url=https://orangzz.cloud +init-version=0.0.0 diff --git a/npm/init-config.sh b/npm/init-config.sh new file mode 100644 index 0000000..30d661e --- /dev/null +++ b/npm/init-config.sh @@ -0,0 +1,25 @@ +mkdir ~/.config/npm +npm list -g --depth=0 + +# npm config get prefix +#`npm config ls --depth=0` +# npm config get prefix +# $N_PREFIX/lib/node_modules - installed packages +# $N_PREFIX/bin - installed executables + +# config file +# Per-project config file: `$PROJECT_DIR/.npmrc` +# Per-user config file: `$HOME/.npmrc` +# Global config file: `$(npm config get prefix)/etc/npmrc` +# Built-in npm config file: `$(npm config get prefix)/lib/node_modules/npm/.npmrc` + + + +# environment variables with `npm_config_` prefix + +# flag on the command line `--save-dev` `--save` + +# process.env.npm_package_config_ + + +# npm config set diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..0e28cef --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,676 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + conventional-changelog-cli: + specifier: ^5.0.0 + version: 5.0.0(conventional-commits-filter@5.0.0) + execa: + specifier: ^9.6.0 + version: 9.6.0 + picocolors: + specifier: ^1.1.1 + version: 1.1.1 + prettier: + specifier: ^3.6.2 + version: 3.6.2 + prompts: + specifier: ^2.4.2 + version: 2.4.2 + semver: + specifier: ^7.7.2 + version: 7.7.2 + +packages: + + '@babel/code-frame@7.27.1': + resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.27.1': + resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==} + engines: {node: '>=6.9.0'} + + '@conventional-changelog/git-client@1.0.1': + resolution: {integrity: sha512-PJEqBwAleffCMETaVm/fUgHldzBE35JFk3/9LL6NUA5EXa3qednu+UT6M7E5iBu3zIQZCULYIiZ90fBYHt6xUw==} + engines: {node: '>=18'} + peerDependencies: + conventional-commits-filter: ^5.0.0 + conventional-commits-parser: ^6.0.0 + peerDependenciesMeta: + conventional-commits-filter: + optional: true + conventional-commits-parser: + optional: true + + '@hutson/parse-repository-url@5.0.0': + resolution: {integrity: sha512-e5+YUKENATs1JgYHMzTr2MW/NDcXGfYFAuOQU8gJgF/kEh4EqKgfGrfLI67bMD4tbhZVlkigz/9YYwWcbOFthg==} + engines: {node: '>=10.13.0'} + + '@sec-ant/readable-stream@0.4.1': + resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} + + '@sindresorhus/merge-streams@4.0.0': + resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} + engines: {node: '>=18'} + + '@types/normalize-package-data@2.4.4': + resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + + '@types/semver@7.7.0': + resolution: {integrity: sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA==} + + add-stream@1.0.0: + resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==} + + array-ify@1.0.0: + resolution: {integrity: sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==} + + compare-func@2.0.0: + resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==} + + conventional-changelog-angular@8.0.0: + resolution: {integrity: sha512-CLf+zr6St0wIxos4bmaKHRXWAcsCXrJU6F4VdNDrGRK3B8LDLKoX3zuMV5GhtbGkVR/LohZ6MT6im43vZLSjmA==} + engines: {node: '>=18'} + + conventional-changelog-atom@5.0.0: + resolution: {integrity: sha512-WfzCaAvSCFPkznnLgLnfacRAzjgqjLUjvf3MftfsJzQdDICqkOOpcMtdJF3wTerxSpv2IAAjX8doM3Vozqle3g==} + engines: {node: '>=18'} + + conventional-changelog-cli@5.0.0: + resolution: {integrity: sha512-9Y8fucJe18/6ef6ZlyIlT2YQUbczvoQZZuYmDLaGvcSBP+M6h+LAvf7ON7waRxKJemcCII8Yqu5/8HEfskTxJQ==} + engines: {node: '>=18'} + hasBin: true + + conventional-changelog-codemirror@5.0.0: + resolution: {integrity: sha512-8gsBDI5Y3vrKUCxN6Ue8xr6occZ5nsDEc4C7jO/EovFGozx8uttCAyfhRrvoUAWi2WMm3OmYs+0mPJU7kQdYWQ==} + engines: {node: '>=18'} + + conventional-changelog-conventionalcommits@8.0.0: + resolution: {integrity: sha512-eOvlTO6OcySPyyyk8pKz2dP4jjElYunj9hn9/s0OB+gapTO8zwS9UQWrZ1pmF2hFs3vw1xhonOLGcGjy/zgsuA==} + engines: {node: '>=18'} + + conventional-changelog-core@8.0.0: + resolution: {integrity: sha512-EATUx5y9xewpEe10UEGNpbSHRC6cVZgO+hXQjofMqpy+gFIrcGvH3Fl6yk2VFKh7m+ffenup2N7SZJYpyD9evw==} + engines: {node: '>=18'} + + conventional-changelog-ember@5.0.0: + resolution: {integrity: sha512-RPflVfm5s4cSO33GH/Ey26oxhiC67akcxSKL8CLRT3kQX2W3dbE19sSOM56iFqUJYEwv9mD9r6k79weWe1urfg==} + engines: {node: '>=18'} + + conventional-changelog-eslint@6.0.0: + resolution: {integrity: sha512-eiUyULWjzq+ybPjXwU6NNRflApDWlPEQEHvI8UAItYW/h22RKkMnOAtfCZxMmrcMO1OKUWtcf2MxKYMWe9zJuw==} + engines: {node: '>=18'} + + conventional-changelog-express@5.0.0: + resolution: {integrity: sha512-D8Q6WctPkQpvr2HNCCmwU5GkX22BVHM0r4EW8vN0230TSyS/d6VQJDAxGb84lbg0dFjpO22MwmsikKL++Oo/oQ==} + engines: {node: '>=18'} + + conventional-changelog-jquery@6.0.0: + resolution: {integrity: sha512-2kxmVakyehgyrho2ZHBi90v4AHswkGzHuTaoH40bmeNqUt20yEkDOSpw8HlPBfvEQBwGtbE+5HpRwzj6ac2UfA==} + engines: {node: '>=18'} + + conventional-changelog-jshint@5.0.0: + resolution: {integrity: sha512-gGNphSb/opc76n2eWaO6ma4/Wqu3tpa2w7i9WYqI6Cs2fncDSI2/ihOfMvXveeTTeld0oFvwMVNV+IYQIk3F3g==} + engines: {node: '>=18'} + + conventional-changelog-preset-loader@5.0.0: + resolution: {integrity: sha512-SetDSntXLk8Jh1NOAl1Gu5uLiCNSYenB5tm0YVeZKePRIgDW9lQImromTwLa3c/Gae298tsgOM+/CYT9XAl0NA==} + engines: {node: '>=18'} + + conventional-changelog-writer@8.2.0: + resolution: {integrity: sha512-Y2aW4596l9AEvFJRwFGJGiQjt2sBYTjPD18DdvxX9Vpz0Z7HQ+g1Z+6iYDAm1vR3QOJrDBkRHixHK/+FhkR6Pw==} + engines: {node: '>=18'} + hasBin: true + + conventional-changelog@6.0.0: + resolution: {integrity: sha512-tuUH8H/19VjtD9Ig7l6TQRh+Z0Yt0NZ6w/cCkkyzUbGQTnUEmKfGtkC9gGfVgCfOL1Rzno5NgNF4KY8vR+Jo3w==} + engines: {node: '>=18'} + + conventional-commits-filter@5.0.0: + resolution: {integrity: sha512-tQMagCOC59EVgNZcC5zl7XqO30Wki9i9J3acbUvkaosCT6JX3EeFwJD7Qqp4MCikRnzS18WXV3BLIQ66ytu6+Q==} + engines: {node: '>=18'} + + conventional-commits-parser@6.2.0: + resolution: {integrity: sha512-uLnoLeIW4XaoFtH37qEcg/SXMJmKF4vi7V0H2rnPueg+VEtFGA/asSCNTcq4M/GQ6QmlzchAEtOoDTtKqWeHag==} + engines: {node: '>=18'} + hasBin: true + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + dot-prop@5.3.0: + resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} + engines: {node: '>=8'} + + execa@9.6.0: + resolution: {integrity: sha512-jpWzZ1ZhwUmeWRhS7Qv3mhpOhLfwI+uAX4e5fOcXqwMR7EcJ0pj2kV1CVzHVMX/LphnKWD3LObjZCoJ71lKpHw==} + engines: {node: ^18.19.0 || >=20.5.0} + + figures@6.1.0: + resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} + engines: {node: '>=18'} + + find-up-simple@1.0.1: + resolution: {integrity: sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ==} + engines: {node: '>=18'} + + get-stream@9.0.1: + resolution: {integrity: sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==} + engines: {node: '>=18'} + + git-raw-commits@5.0.0: + resolution: {integrity: sha512-I2ZXrXeOc0KrCvC7swqtIFXFN+rbjnC7b2T943tvemIOVNl+XP8YnA9UVwqFhzzLClnSA60KR/qEjLpXzs73Qg==} + engines: {node: '>=18'} + hasBin: true + + git-semver-tags@8.0.0: + resolution: {integrity: sha512-N7YRIklvPH3wYWAR2vysaqGLPRcpwQ0GKdlqTiVN5w1UmCdaeY3K8s6DMKRCh54DDdzyt/OAB6C8jgVtb7Y2Fg==} + engines: {node: '>=18'} + hasBin: true + + handlebars@4.7.8: + resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} + engines: {node: '>=0.4.7'} + hasBin: true + + hosted-git-info@7.0.2: + resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} + engines: {node: ^16.14.0 || >=18.0.0} + + human-signals@8.0.1: + resolution: {integrity: sha512-eKCa6bwnJhvxj14kZk5NCPc6Hb6BdsU9DZcOnmQKSnO1VKrfV0zCvtttPZUsBvjmNDn8rpcJfpwSYnHBjc95MQ==} + engines: {node: '>=18.18.0'} + + index-to-position@1.1.0: + resolution: {integrity: sha512-XPdx9Dq4t9Qk1mTMbWONJqU7boCoumEH7fRET37HX5+khDUl3J2W6PdALxhILYlIYx2amlwYcRPp28p0tSiojg==} + engines: {node: '>=18'} + + is-obj@2.0.0: + resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==} + engines: {node: '>=8'} + + is-plain-obj@4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} + + is-stream@4.0.1: + resolution: {integrity: sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==} + engines: {node: '>=18'} + + is-unicode-supported@2.1.0: + resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} + engines: {node: '>=18'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + kleur@3.0.3: + resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} + engines: {node: '>=6'} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + meow@13.2.0: + resolution: {integrity: sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==} + engines: {node: '>=18'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + normalize-package-data@6.0.2: + resolution: {integrity: sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==} + engines: {node: ^16.14.0 || >=18.0.0} + + npm-run-path@6.0.0: + resolution: {integrity: sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA==} + engines: {node: '>=18'} + + parse-json@8.3.0: + resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==} + engines: {node: '>=18'} + + parse-ms@4.0.0: + resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==} + engines: {node: '>=18'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + prettier@3.6.2: + resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} + engines: {node: '>=14'} + hasBin: true + + pretty-ms@9.2.0: + resolution: {integrity: sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==} + engines: {node: '>=18'} + + prompts@2.4.2: + resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} + engines: {node: '>= 6'} + + read-package-up@11.0.0: + resolution: {integrity: sha512-MbgfoNPANMdb4oRBNg5eqLbB2t2r+o5Ua1pNt8BqGp4I0FJZhuVSOj3PaBPni4azWuSzEdNn2evevzVmEk1ohQ==} + engines: {node: '>=18'} + + read-pkg@9.0.1: + resolution: {integrity: sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==} + engines: {node: '>=18'} + + semver@7.7.2: + resolution: {integrity: sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==} + engines: {node: '>=10'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + spdx-correct@3.2.0: + resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} + + spdx-exceptions@2.5.0: + resolution: {integrity: sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==} + + spdx-expression-parse@3.0.1: + resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} + + spdx-license-ids@3.0.22: + resolution: {integrity: sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==} + + strip-final-newline@4.0.0: + resolution: {integrity: sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==} + engines: {node: '>=18'} + + temp-dir@3.0.0: + resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==} + engines: {node: '>=14.16'} + + tempfile@5.0.0: + resolution: {integrity: sha512-bX655WZI/F7EoTDw9JvQURqAXiPHi8o8+yFxPF2lWYyz1aHnmMRuXWqL6YB6GmeO0o4DIYWHLgGNi/X64T+X4Q==} + engines: {node: '>=14.18'} + + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + + uglify-js@3.19.3: + resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==} + engines: {node: '>=0.8.0'} + hasBin: true + + unicorn-magic@0.1.0: + resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} + engines: {node: '>=18'} + + unicorn-magic@0.3.0: + resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} + engines: {node: '>=18'} + + validate-npm-package-license@3.0.4: + resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + + yoctocolors@2.1.2: + resolution: {integrity: sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==} + engines: {node: '>=18'} + +snapshots: + + '@babel/code-frame@7.27.1': + dependencies: + '@babel/helper-validator-identifier': 7.27.1 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/helper-validator-identifier@7.27.1': {} + + '@conventional-changelog/git-client@1.0.1(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0)': + dependencies: + '@types/semver': 7.7.0 + semver: 7.7.2 + optionalDependencies: + conventional-commits-filter: 5.0.0 + conventional-commits-parser: 6.2.0 + + '@hutson/parse-repository-url@5.0.0': {} + + '@sec-ant/readable-stream@0.4.1': {} + + '@sindresorhus/merge-streams@4.0.0': {} + + '@types/normalize-package-data@2.4.4': {} + + '@types/semver@7.7.0': {} + + add-stream@1.0.0: {} + + array-ify@1.0.0: {} + + compare-func@2.0.0: + dependencies: + array-ify: 1.0.0 + dot-prop: 5.3.0 + + conventional-changelog-angular@8.0.0: + dependencies: + compare-func: 2.0.0 + + conventional-changelog-atom@5.0.0: {} + + conventional-changelog-cli@5.0.0(conventional-commits-filter@5.0.0): + dependencies: + add-stream: 1.0.0 + conventional-changelog: 6.0.0(conventional-commits-filter@5.0.0) + meow: 13.2.0 + tempfile: 5.0.0 + transitivePeerDependencies: + - conventional-commits-filter + + conventional-changelog-codemirror@5.0.0: {} + + conventional-changelog-conventionalcommits@8.0.0: + dependencies: + compare-func: 2.0.0 + + conventional-changelog-core@8.0.0(conventional-commits-filter@5.0.0): + dependencies: + '@hutson/parse-repository-url': 5.0.0 + add-stream: 1.0.0 + conventional-changelog-writer: 8.2.0 + conventional-commits-parser: 6.2.0 + git-raw-commits: 5.0.0(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0) + git-semver-tags: 8.0.0(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0) + hosted-git-info: 7.0.2 + normalize-package-data: 6.0.2 + read-package-up: 11.0.0 + read-pkg: 9.0.1 + transitivePeerDependencies: + - conventional-commits-filter + + conventional-changelog-ember@5.0.0: {} + + conventional-changelog-eslint@6.0.0: {} + + conventional-changelog-express@5.0.0: {} + + conventional-changelog-jquery@6.0.0: {} + + conventional-changelog-jshint@5.0.0: + dependencies: + compare-func: 2.0.0 + + conventional-changelog-preset-loader@5.0.0: {} + + conventional-changelog-writer@8.2.0: + dependencies: + conventional-commits-filter: 5.0.0 + handlebars: 4.7.8 + meow: 13.2.0 + semver: 7.7.2 + + conventional-changelog@6.0.0(conventional-commits-filter@5.0.0): + dependencies: + conventional-changelog-angular: 8.0.0 + conventional-changelog-atom: 5.0.0 + conventional-changelog-codemirror: 5.0.0 + conventional-changelog-conventionalcommits: 8.0.0 + conventional-changelog-core: 8.0.0(conventional-commits-filter@5.0.0) + conventional-changelog-ember: 5.0.0 + conventional-changelog-eslint: 6.0.0 + conventional-changelog-express: 5.0.0 + conventional-changelog-jquery: 6.0.0 + conventional-changelog-jshint: 5.0.0 + conventional-changelog-preset-loader: 5.0.0 + transitivePeerDependencies: + - conventional-commits-filter + + conventional-commits-filter@5.0.0: {} + + conventional-commits-parser@6.2.0: + dependencies: + meow: 13.2.0 + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + dot-prop@5.3.0: + dependencies: + is-obj: 2.0.0 + + execa@9.6.0: + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + cross-spawn: 7.0.6 + figures: 6.1.0 + get-stream: 9.0.1 + human-signals: 8.0.1 + is-plain-obj: 4.1.0 + is-stream: 4.0.1 + npm-run-path: 6.0.0 + pretty-ms: 9.2.0 + signal-exit: 4.1.0 + strip-final-newline: 4.0.0 + yoctocolors: 2.1.2 + + figures@6.1.0: + dependencies: + is-unicode-supported: 2.1.0 + + find-up-simple@1.0.1: {} + + get-stream@9.0.1: + dependencies: + '@sec-ant/readable-stream': 0.4.1 + is-stream: 4.0.1 + + git-raw-commits@5.0.0(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0): + dependencies: + '@conventional-changelog/git-client': 1.0.1(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0) + meow: 13.2.0 + transitivePeerDependencies: + - conventional-commits-filter + - conventional-commits-parser + + git-semver-tags@8.0.0(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0): + dependencies: + '@conventional-changelog/git-client': 1.0.1(conventional-commits-filter@5.0.0)(conventional-commits-parser@6.2.0) + meow: 13.2.0 + transitivePeerDependencies: + - conventional-commits-filter + - conventional-commits-parser + + handlebars@4.7.8: + dependencies: + minimist: 1.2.8 + neo-async: 2.6.2 + source-map: 0.6.1 + wordwrap: 1.0.0 + optionalDependencies: + uglify-js: 3.19.3 + + hosted-git-info@7.0.2: + dependencies: + lru-cache: 10.4.3 + + human-signals@8.0.1: {} + + index-to-position@1.1.0: {} + + is-obj@2.0.0: {} + + is-plain-obj@4.1.0: {} + + is-stream@4.0.1: {} + + is-unicode-supported@2.1.0: {} + + isexe@2.0.0: {} + + js-tokens@4.0.0: {} + + kleur@3.0.3: {} + + lru-cache@10.4.3: {} + + meow@13.2.0: {} + + minimist@1.2.8: {} + + neo-async@2.6.2: {} + + normalize-package-data@6.0.2: + dependencies: + hosted-git-info: 7.0.2 + semver: 7.7.2 + validate-npm-package-license: 3.0.4 + + npm-run-path@6.0.0: + dependencies: + path-key: 4.0.0 + unicorn-magic: 0.3.0 + + parse-json@8.3.0: + dependencies: + '@babel/code-frame': 7.27.1 + index-to-position: 1.1.0 + type-fest: 4.41.0 + + parse-ms@4.0.0: {} + + path-key@3.1.1: {} + + path-key@4.0.0: {} + + picocolors@1.1.1: {} + + prettier@3.6.2: {} + + pretty-ms@9.2.0: + dependencies: + parse-ms: 4.0.0 + + prompts@2.4.2: + dependencies: + kleur: 3.0.3 + sisteransi: 1.0.5 + + read-package-up@11.0.0: + dependencies: + find-up-simple: 1.0.1 + read-pkg: 9.0.1 + type-fest: 4.41.0 + + read-pkg@9.0.1: + dependencies: + '@types/normalize-package-data': 2.4.4 + normalize-package-data: 6.0.2 + parse-json: 8.3.0 + type-fest: 4.41.0 + unicorn-magic: 0.1.0 + + semver@7.7.2: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + signal-exit@4.1.0: {} + + sisteransi@1.0.5: {} + + source-map@0.6.1: {} + + spdx-correct@3.2.0: + dependencies: + spdx-expression-parse: 3.0.1 + spdx-license-ids: 3.0.22 + + spdx-exceptions@2.5.0: {} + + spdx-expression-parse@3.0.1: + dependencies: + spdx-exceptions: 2.5.0 + spdx-license-ids: 3.0.22 + + spdx-license-ids@3.0.22: {} + + strip-final-newline@4.0.0: {} + + temp-dir@3.0.0: {} + + tempfile@5.0.0: + dependencies: + temp-dir: 3.0.0 + + type-fest@4.41.0: {} + + uglify-js@3.19.3: + optional: true + + unicorn-magic@0.1.0: {} + + unicorn-magic@0.3.0: {} + + validate-npm-package-license@3.0.4: + dependencies: + spdx-correct: 3.2.0 + spdx-expression-parse: 3.0.1 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + wordwrap@1.0.0: {} + + yoctocolors@2.1.2: {} diff --git a/public/folder.svg b/public/folder.svg new file mode 100644 index 0000000..93f1534 --- /dev/null +++ b/public/folder.svg @@ -0,0 +1 @@ + diff --git a/rclone/bisync.service b/rclone/bisync.service new file mode 100644 index 0000000..4ae8ef0 --- /dev/null +++ b/rclone/bisync.service @@ -0,0 +1 @@ +u diff --git a/rclone/bisync.timer b/rclone/bisync.timer new file mode 100644 index 0000000..7983fee --- /dev/null +++ b/rclone/bisync.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Obsidian GSync Timer + +[Timer] +OnBootSec=10min +OnUnitActiveSec=5min + +[Install] +WantedBy=timers.target diff --git a/rclone/rclone.conf b/rclone/rclone.conf new file mode 100644 index 0000000..b082d30 --- /dev/null +++ b/rclone/rclone.conf @@ -0,0 +1,37 @@ +[r2] +type = s3 +provider = Cloudflare +access_key_id = +secret_access_key = +region = auto +endpoint =https://.r2.cloudflarestorage.com +acl = private +no_check_bucket = true + +# cron job is needed to backup to remote every night + +# S3: ListBuckets + +# set the `RCLONE_CONFIG_PASS` environment variable for current session to contain your password +# read -s RCLONE_CONFIG_PASS +# export RCLONE_CONFIG_PASS + + +# disable ask password prompts if you are running rclone inside a script +# --ask-password=false +# This will make rclone fail instead of asking for a password if RCLONE_CONFIG_PASS doesn't contain a valid password + +# list objects inside bucket + +# copy objects between s3 buckets +# bucket -> bucket transfer +# rclone copy :/ :/ --dry-run -vv + + +# mount cloud storage as network volume + +# bucket policy +# control ownership of the objects in your bucket +# objects uploaded to your bucket are owned by the bucket owner rather than the object writer. +# bucket owner own and has full control over every object in the bucket + diff --git a/scripts/release.js b/scripts/release.js old mode 100644 new mode 100755 index d91b08a..8eb6f47 --- a/scripts/release.js +++ b/scripts/release.js @@ -1,47 +1,49 @@ -import { createRequire } from 'node:module' -import semver from 'semver' -import prompts from 'prompts' -import c from 'picocolors' -import { execa } from 'execa' -import { readFileSync, writeFileSync } from 'node:fs' -import { resolve } from 'node:path' +import { createRequire } from 'node:module'; +import semver from 'semver'; +import prompts from 'prompts'; +import c from 'picocolors'; +import { execa } from 'execa'; +import { readFileSync, writeFileSync } from 'node:fs'; +import { resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; -const { inc: _inc, valid } = semver +const { inc: _inc, valid } = semver; -const { version: currentVersion } = createRequire(import.meta.url)('../../package.json') +const { version: currentVersion } = createRequire(import.meta.url)('../package.json'); -const versionIncrements = ['patch', 'minor', 'major'] +const versionIncrements = ['patch', 'minor', 'major']; -const tags = ['latest', 'next'] +const tags = ['latest', 'next']; -const inc = (i) => _inc(currentVersion, i) -const run = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts }) -const step = (msg) => console.log(c.cyan(msg)) +const dir = fileURLToPath(new URL('.', import.meta.url)); +const inc = (i) => _inc(currentVersion, i); +const run = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts }); +const step = (msg) => console.log(c.cyan(msg)); async function main() { - let targetVersion + let targetVersion; - const versions = versionIncrements.map((i) => `${i} (${inc(i)})`).concat(['custom']) + const versions = versionIncrements.map((i) => `${i} (${inc(i)})`).concat(['custom']); const { release } = await prompts({ type: 'select', name: 'release', message: 'Select release type', choices: versions, - }) + }); if (release === 3) { targetVersion = await prompts({ type: 'text', name: 'version', message: 'Input custom version', initial: currentVersion, - }).version + }).version; } else { - targetVersion = versions[release].match(/\((.*)\)/)[1] + targetVersion = versions[release].match(/\((.*)\)/)[1]; } if (!valid(targetVersion)) { - throw new Error(`Invalid target version: ${targetVersion}`) + throw new Error(`Invalid target version: ${targetVersion}`); } const { tag } = await prompts({ @@ -49,58 +51,120 @@ async function main() { name: 'tag', message: 'Select tag type', choices: tags, - }) + }); const { yes: tagOk } = await prompts({ type: 'confirm', name: 'yes', - message: `Releasing v${targetVersion} on ${tag[tag]}. Confirm`, - }) + message: `Releasing v${targetVersion} on ${tags[tag]}. Confirm`, + }); if (!tagOk) { - return + return; } - step('\n Bumping the package version ...') - bumpVersion(targetVersion) + step('\n Bumping the package version ...'); + bumpVersion(targetVersion); - step('\n Building the package...') - await run('pnpm', ['build']) + step('\n Building the package...'); + await run('pnpm', ['build']); - step('\n Generating the changelog...') - await run('pnpm', ['changelog']) - await run('pnpm', ['prettier', '--write', 'CHANGELOG.md']) + step('\nLogging recent commit...'); + const firstRelease = await isFirstRelease(); + const previousRef = await getPreviousReference(); + if (firstRelease) { + // For first release, show all commits + await run('git', ['log', '--pretty=format:%s', '--no-merges']); + } else { + // For subsequent releases, show commits since last tag + await run('git', ['log', '--pretty=format:%s', `${previousRef}..HEAD`, '--no-merges']); + } + + step('\n Generating the changelog...'); + const changelogPath = resolve(dir, '..', 'docs/CHANGELOG.md'); + if (firstRelease) { + // For first release, use the --first-release flag + await run('pnpm', [ + 'conventional-changelog', + '--preset', + 'angular', + '--infile', + 'docs/CHANGELOG.md', + '--outfile', + 'docs/CHANGELOG.md', + '--first-release', + ]); + } else { + // For subsequent releases, append new release to existing changelog + await run('pnpm', [ + 'conventional-changelog', + '--preset', + 'angular', + '--infile', + 'docs/CHANGELOG.md', + '--outfile', + 'docs/CHANGELOG.md', + '--append', + ]); + } + + await run('pnpm', ['prettier', '--write', 'docs/CHANGELOG.md']); const { yes: changelogOk } = await prompts({ type: 'confirm', name: 'yes', message: 'Changelog generated. Does it look good?', - }) + }); if (!changelogOk) { - return + return; + } + const { stdout } = await run('git', ['diff'], { stdio: 'pipe' }); + if (stdout) { + step('\nCommitting changes and tag version...'); + await run('git', ['add', 'docs/CHANGELOG.md', 'package.json']); + await run('git', ['commit', '-m', `release: v${targetVersion}`]); + await run('git', ['tag', `v${targetVersion}`]); + } else { + console.log('No changes to commit'); + return; } - step('\nCommitting changes...') - await run('git', ['add', 'CHANGELOG.md', 'package.json']) - await run('git', ['commit', '-m', `release: v${targetVersion}`]) - await run('git', ['tag', `v${targetVersion}`]) - - step('\nPublishing the package...') - await run('pnpm', ['publish', '--tag', tags[tag], '--ignore-scripts', '--no-git-check']) + // step('\nPublishing the package...'); + // await run('pnpm', ['publish', '--tag', tags[tag], '--ignore-scripts', '--no-git-check']); - step('\nPushing to GitHub...') - await run('git', ['push', 'origin', `refs/tags/v${targetVersion}`]) - await run('git', ['push']) + step('\nPushing to GitHub...'); + await run('git', ['push', 'origin', `refs/tags/v${targetVersion}`]); + const { stdout: currentBranch } = await run('git', ['branch', '--show-current'], { + stdio: 'pipe', + }); + await run('git', ['push', '--set-upstream', 'origin', currentBranch.trim()]); } function bumpVersion(version) { - const pkgPath = resolve(dir, '..', 'package.json') - const pkg = JSON.parse(readFileSync(pkgPath), 'utf-8') + const pkgPath = resolve(dir, '..', 'package.json'); + const pkg = JSON.parse(readFileSync(pkgPath), 'utf-8'); + + pkg.version = version; + writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n'); +} - pkg.version = version - writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') +async function isFirstRelease() { + const { stdout } = await run('git', ['tag', '-l'], { stdio: 'pipe' }); + return !stdout.trim(); +} +async function getPreviousReference() { + try { + const { stdout } = await run('git', ['describe', '--tags', '--abbrev=0'], { stdio: 'pipe' }); + return stdout.trim(); + } catch { + // If no tags exist, get the first commit + const { stdout } = await run('git', ['rev-list', '--max-parents=0', 'HEAD'], { + stdio: 'pipe', + }); + return stdout.trim(); + } } -main().catch((err) => console.error(err)) +main().catch((err) => console.error(err)); // onAbuseLimit // onRateLimit diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..7bad161 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# fail on unset variables and command errors +set -eu -o pipefail # -x: is for debugging + +DEFAULT_BRANCH="main" + +CURRENT_BRANCH="$(git branch --show-current)" +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then + echo "$0: Current branch ${CURRENT_BRANCH} is not ${DEFAULT_BRANCH}, continue? (y/n)" + read -r res + if [ "${res}" = "n" ]; then + echo "$0: Stop script" + exit 0 + fi +fi + +PRERELEASE_TYPE_LIST="prerelease prepatch preminor premajor" +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then + RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST}" +else + RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST} patch minor major" +fi + +if command -v fzf; then + RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse) +else + select sel in ${RELEASE_TYPE_LIST}; do + RELEASE_TYPE="${sel}" + break + done +fi + +echo "$0: Create ${RELEASE_TYPE} release, continue? (y/n)" +read -r res +if [ "${res}" = "n" ]; then + echo "$0: Stop script" + exit 0 +fi + +git fetch origin +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then + git pull origin "${CURRENT_BRANCH}" +else + git pull origin ${DEFAULT_BRANCH} + git pull origin --tags +fi + +npm ci + +mkdir ./release +npm run build +cp -r ./lib/* ./release +git add ./release/index.js +git commit -m "chore(release): Add build assets" + +npm run release -- --release-as "${RELEASE_TYPE}" --preset eslint + +git rm ./release/index.js +rm -rf ./lib ./release +git commit -m "chore(release): Remove build assets [skip ci]" + +if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then + git push origin "${CURRENT_BRANCH}" +else + git push origin ${DEFAULT_BRANCH} +fi + +TAG_NAME="v$(jq -r '.version' ./package.json)" +git push origin "${TAG_NAME}" diff --git a/scripts/y b/scripts/y deleted file mode 100755 index ddcd152..0000000 --- a/scripts/y +++ /dev/null @@ -1,7 +0,0 @@ -function y() { - local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd - yazi "$@" --cwd-file="$tmp" - IFS= read -r -d '' cwd < "$tmp" - [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd" - rm -f -- "$tmp" -} diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..c6085b4 --- /dev/null +++ b/setup.sh @@ -0,0 +1,166 @@ +#!/usr/bin/env zsh + +set -o errexit # exit on fail +set -o pipefail # catch errors in pipelines +set -o nounset # exit on undeclared variable +# set -o xtrace # trace execution + + +# setup wizard +# teardown previous +# hyperland gnome dwm +# .cert +# + +# gnome kde +# os = 'x86_64-linux' +# os = 'arrch64-darwin' + +# home.username = +# home.homeDirectory = + +# standalone installation + +set -e + + + +# to abosolut path of current dir +export DOTFILES=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) +if [[ ! -e /etc/zshenv ]]; then + sudo touch /etc/zshenv +fi +if ! grep -q 'export ZDOTDIR=' /etc/zshenv; then + # tell zsh wherer to look for startup file + echo 'export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"' | sudo tee -a /etc/zshenv +fi + +# COLORS=( +# [RED]='\033[0;31m' +# [GREEN]='\033[0;32m' +# [YELLOW]='\033[1;33m' +# [BLUE]='\033[0;34m' +# ) +# Package configurations + +sync_vscode() { + ln -sf $HOME/dotfiles/editor/vscode/settings.json $HOME/Library/Application\ Support/Code/User/settings.json + ln -sf $HOME/dotfiles/editor/vscode/extensions.json $HOME/Library/Application\ Support/Code/User/extensions.json + ln -sf $HOME/dotfiles/editor/vscode/keybindings.json $HOME/Library/Application\ Support/Code/User/keybindings.json + ln -sF $HOME/dotfiles/editor/vscode/snippets $HOME/Library/Application\ Support/Code/User/snippets +} + + packages=( + ["$DOTFILES/homebrew"]="$HOME/.config/homebrew" + ["$DOTFILES/git"]="$HOME/.config/git" + ["$DOTFILES/xterm/ghostty"]="$HOME/.config/ghostty" + ["$DOTFILES/shell/zsh"]="$ZDOTDIR" + ["$DOTFILES/starship"]="$HOME/.config/starship" + ["$DOTFILES/editor/nvim"]="$HOME/.config/nvim" + ["$DOTFILES/npm/.npmrc"]="$HOME/.npmrc" +) + + +# Link src to dest +# overwrite if target exist +# backup if target exists + +safe_link() { + local origin=$1 + local target=$2 + + # Create parent directory if needed + [[ ! -d $target ]] && mkdir -p "${target:h}" + + [[ -s $target ]] && { + echo "$target already exists in home directory" + echo "(1) Remove $target and create symlink to ~/.dotfiles/$target" + echo "(2) Backup $target to ~/.dotfiles/$target.bak and create symlink to ~/.dotfiles/$target" + read -p "" -r + + mv $target $target.bak + ln -s $origin $target + } + + + + + + +} + +# Link each package to its destination +for src in ${(k)packages}; do + dest=${packages[$src]} + safe_link $src $dest +done + + + +# setup default shell for terminal emulator + +# if [[ $SHELL != 'zsh' ]]; then +# sudo sh -c "echo $(which zsh) >> /etc/shells" && chsh -s $(which zsh) +# fi +# source $ZDOTDIR/.zshrc +# exec zsh +error() { + printf "\033[31merror\033[0m: $*\n" >&2 +} + + +check_tools_requested() { + if ! command -v ansible-playbook &> /dev/null; then + echo "Command ansible-playbook could not be found!" + echo + echo "You can install ansible by below commands:" + echo + echo "pipx install --include-deps ansible" + exit 1 + fi +} + + + +setup_shell() { + local SHELL_NAME + local SHELL_PATH + IFS= read -r -d '' SHELL_NAME || { + error "$SHELL_NAME is not exist in PATH env vars" + return 1 + } + if ! grep -qxF $SHELL_PATH /etc/shells; then + echo $SHELL_PATH | sudo tee -a /etc/shells + fi + chsh -s $SHELL_PATH +} + + + +show_usage() { + cat << EOF +Usage: setup.zsh [OPTIONS] + +Options: + --help print this help and exit + --check check for required dependencies + +Examples: + setup.sh # Install from current directory + $SCRIPT_NAME ~/Downloads/fonts # Install from specific directory +EOF + exit 0 +} +while test $# -gt 0; do + case "$1" in + --check) ANSIBLE_PLAYBOOK_ARGS+=("--check");; + --help) usage;; + --*) echo "bad option $1";; + *) usage;; + esac + shift +done + +cd ./ansible +ansible-galaxy collection install -r requirements.yml --upgrade +ansible-playbook --ask-become-pass setup.yml ${ANSIBLE_PLAYBOOK_ARGS[@]} diff --git a/setup.zsh b/setup.zsh deleted file mode 100755 index f965328..0000000 --- a/setup.zsh +++ /dev/null @@ -1,73 +0,0 @@ -############################################################################### -# setup wizard -# cleanup - - - -# to abosolut path of current dir -export DOTFILES=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) -if [[ ! -e /etc/zshenv ]]; then - sudo touch /etc/zshenv -fi -if ! grep -q 'export ZDOTDIR=' /etc/zshenv; then - # tell zsh wherer to look for startup file - echo 'export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh"' | sudo tee -a /etc/zshenv -fi -export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" -# COLORS=( -# [RED]='\033[0;31m' -# [GREEN]='\033[0;32m' -# [YELLOW]='\033[1;33m' -# [BLUE]='\033[0;34m' -# ) -# Package configurations -declare -A packages=( - ["$DOTFILES/shell/zsh"]="$ZDOTDIR" - ["$DOTFILES/homebrew"]="$HOME/.config/homebrew" - ["$DOTFILES/editor/nvim"]="$HOME/.config/nvim" - ["$DOTFILES/xterm/ghostty"]="$HOME/.config/ghostty" - ["$DOTFILES/starship"]="$HOME/.config/starship" -) -safe_link() { - local source="$1" - local target="$2" - # Create parent directory if needed - [[ ! -d $target ]]; mkdir -p "${target:h}" - # Remove existing one and create a new one - [[ -L $target ]] && rm -rf $target - ln -sv "$source" "$target" -} - -# Link each package to its destination -for src in ${(k)packages}; do - dest=${packages[$src]} - safe_link $src $dest -done - - - - -# split=("${(@s#/#)SHELL}")ju -# shell=$split[-1] -# if [[ $shell != 'zsh' ]]; then -# sudo sh -c "echo $(which zsh) >> /etc/shells" && chsh -s $(which zsh) -# fi -# # source $ZDOTDIR/.zshrc -# exec zsh - - -# # setup terminal emualator default shell -# case "$shell" in -# zsh) -# sudo sh -c "echo $(which zsh) >> /etc/shells" && chsh -s $(which zsh) -# ;; -# fish) -# echo /usr/local/bin/fish | sudo tee -a /etc/shells -# chsh -s /usr/local/bin/fish -# ;; -# bash) -# echo "win sublinux" -# ;; -# *) -# ;; -# esac diff --git a/shell/bash/.bashrc b/shell/bash/.bashrc new file mode 100644 index 0000000..8219979 --- /dev/null +++ b/shell/bash/.bashrc @@ -0,0 +1,4 @@ +if [[ -n $PS1 ]]; then + : # only for interactive shells + +else diff --git a/shell/fish/conf.d/lang.conf b/shell/fish/conf.d/lang.conf new file mode 100644 index 0000000..d3cd665 --- /dev/null +++ b/shell/fish/conf.d/lang.conf @@ -0,0 +1,11 @@ + + +set -x PATH /opt/anaconda3/bin $PATH + + +/bin/kafka-topics --bootstrap-server localhost:9092 --create --topic +/bin/kafka-topics --bootstrap-server localhost:9092 --describe +/bin/kafka-topics --bootstrap-server localhost:9092 --delete --topic +/bin/kafka-topics --bootstrap-server localhost:9092 --list +/bin/kafka-console-producer --bootstrap-server localhost:9092 --topic +/bin/kafka-console-consumer --bootstrap-server localhost:9092 --from-beginning --topic diff --git a/shell/zsh/.pre-commit-config.yml b/shell/zsh/.pre-commit-config.yml new file mode 100644 index 0000000..32e71c9 --- /dev/null +++ b/shell/zsh/.pre-commit-config.yml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/lovesegfault/beautysh + rev: v6.2.1 + hooks: + - id: beautysh diff --git a/shell/zsh/.zplugin/.github/pre-commit.yml b/shell/zsh/.zplugin/.github/pre-commit.yml new file mode 100644 index 0000000..d14f608 --- /dev/null +++ b/shell/zsh/.zplugin/.github/pre-commit.yml @@ -0,0 +1,18 @@ +name: pre-commit + + +on: + pull_request: + push: + branches: [$default-branch] +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: '3.10.11 + - uses: pre-commit/action@v3.0.0.0' diff --git a/shell/zsh/.zplugin/Makefile b/shell/zsh/.zplugin/Makefile new file mode 100644 index 0000000..ba300ac --- /dev/null +++ b/shell/zsh/.zplugin/Makefile @@ -0,0 +1,17 @@ +clean: + @rm -f functions/*.zwc + @rm -f lib/*.zwc + +all: clean + @for file in functions/* ; do \ + beautysh --indent-size 2 --force-function-style fnpar $$file ; \ + done + + @for file in lib/* ; do \ + beautysh --indent-size 2 --force-function-style fnpar $$file ; \ + done + + @beautysh --indent-size 2 --force-function-style fnpar zpm.zsh + @beautysh --indent-size 2 --force-function-style fnpar bin/@zpm-plugin-helper + +.PHONY: all clean test diff --git a/shell/zsh/.zplugin/README.md b/shell/zsh/.zplugin/README.md new file mode 100644 index 0000000..b73114d --- /dev/null +++ b/shell/zsh/.zplugin/README.md @@ -0,0 +1 @@ +use a `bin/` subdirectory inside its main diff --git a/shell/zsh/.zplugin/functions/__zplugin b/shell/zsh/.zplugin/functions/__zplugin new file mode 100644 index 0000000..27b1f2b --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin @@ -0,0 +1,35 @@ +#!/usr/bin/env zsh + +#compdef zap + +local -a subcmds=( + "clean:Remove unused plugins" + "help:Show help informations" + "list:List plugins" + "upgrade:Update plugins" + "version:Show version information" +) +_describe 'zap' subcmds + +# Set all options +source "$ZGEN_SOURCE/options.zsh" + + +# dispatch flight control +function __zplugin() { + local cmd="$1" + if [[ -z "$cmd" || $cmd = '--help' ]]; then + zplugin-help + return 1 + fi + if functions zplugin-$cmd &> /dev/null ; then + shift + zplugin-$cmd $@ + else + __zplugin_err "Command not found: $cmd" + zplugin-help + return 1 + fi +} + +__zplugin $@ diff --git a/shell/zsh/.zplugin/functions/__zplugin_autoupdate b/shell/zsh/.zplugin/functions/__zplugin_autoupdate new file mode 100644 index 0000000..0775fec --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin_autoupdate @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh + +# Bail out when zsh/system is not available +# Bail out when zsh/system is not available +zmodload zsh/system || { + __zplugin_err 'Could not load `zsh/system` which is needed for autoupdate. Please create an issue.' + return 1 +} + +##? zsh-plugin-load - load plugins without a fancy plugin manager +##? diff --git a/shell/zsh/.zplugin/functions/__zplugin_clean b/shell/zsh/.zplugin/functions/__zplugin_clean new file mode 100644 index 0000000..0775fec --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin_clean @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh + +# Bail out when zsh/system is not available +# Bail out when zsh/system is not available +zmodload zsh/system || { + __zplugin_err 'Could not load `zsh/system` which is needed for autoupdate. Please create an issue.' + return 1 +} + +##? zsh-plugin-load - load plugins without a fancy plugin manager +##? diff --git a/shell/zsh/.zplugin/functions/__zplugin_compile b/shell/zsh/.zplugin/functions/__zplugin_compile new file mode 100644 index 0000000..d3c0c37 --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin_compile @@ -0,0 +1,7 @@ +zsh_zcompile() { + local ffile=$1 + if [[ $ffile -nt $ffile.zwc && -r $ffile && -w ${ffile:h} ]]; then + zcompile $ffile + fi + zcompile $ffile +} diff --git a/shell/zsh/.zplugin/functions/__zplugin_error b/shell/zsh/.zplugin/functions/__zplugin_error new file mode 100644 index 0000000..d1b9773 --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin_error @@ -0,0 +1,7 @@ +#!/usr/bin/env zsh + +function __zplugin_error() { + printf '%s\n' $* >&2 +} + +__zplugin_error $@ diff --git a/shell/zsh/.zplugin/functions/__zplugin_load b/shell/zsh/.zplugin/functions/__zplugin_load new file mode 100644 index 0000000..a36063c --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin_load @@ -0,0 +1,64 @@ +#!/usr/bin/env zsh + +##? zplugin load - load plugins without a fancy plugin manager +##? +##? usage: zplugin load [-h|--help] +##? zplugin load [-n|--no-source] [-d|--defer] [-f|--fpath] [-p|--path] [-u|--use-dir ] [] + + + +function __zplugin_load(){ + setopt localoptions extendedglob + opterr() { echo >&2 "Unknown option '$1'" } + while (( $# )); do + case $1 in + --) shift; repos+=("$@"); break ;; + -h|--help) zplugin-help && return ;; + -d|--defer) flag_defer=1; ;; + -u|--use-dir) shift; use_dir=$1 ;; + -u=*|--use-dir=*) use_dir="${1#*=}" ;; + -*) opterr $1 && return 2 ;; + *) repos+=("$@"); break ;; + esac + shift + done + for repo in $repos; do + + done +} + + +_zplugin_load() { + local repo=$1 git_ref=$2 + local plugin_name plugin_dir initfile initfiles + plugin_name=${repo:t} + plugin_dir=${use_dir:-$ZPLUGIN_DIR}/$plugin_name + initfile=$plugin_dir/$plugin_name.plugin.zsh + if [[ ! -d $plugin_dir ]] && [[ "$repo" = */* ]]; then + __zplugin_out "Cloning $repo..." + git clone --quiet --depth 1 --recursive --shallow-submodules https://github.com/$repo $plugin_dir + if [[ ! -e $initfile ]]; then + initfiles=( + $plugin_dir/*.{plugin.,}{z,}sh{-theme,}(N) + ) + (( ${#initfiles} )) || { __zplugin_out "Plugin load error: \"${repo}\" is not a valid plugin" && return 1 } + ln -sf ${initfiles[1]} $initfile + fi + fi + if [[ -d ${plugin_dir}/functions ]]; then + fpath=(${plugin_dir}/functions $fpath) + else + fpath=(${plugin_dir} $fpath) + fi + if [[ -d ${plugin_dir}/bin ]]; then + path=(${plugin_dir}/bin $path[@]) + fi + if (( ${1} && $+functions[zsh-defer] )); then + zsh-defer -dmpr -c "ZERO=${initfile} . ${initfile}" + else + ZERO=${initfile} . ${initfile} + fi +} + + +__zplugin_load $@ diff --git a/shell/zsh/.zplugin/functions/__zplugin_out b/shell/zsh/.zplugin/functions/__zplugin_out new file mode 100644 index 0000000..f0160d2 --- /dev/null +++ b/shell/zsh/.zplugin/functions/__zplugin_out @@ -0,0 +1,7 @@ +#!/usr/bin/env zsh + +function __zplugin_out() { + printf '-- zplugin: %s\n' $* >&2 +} + +__zplugin_out $@ diff --git a/shell/zsh/.zplugin/functions/zplugin-upgrade b/shell/zsh/.zplugin/functions/zplugin-upgrade new file mode 100644 index 0000000..1f4181f --- /dev/null +++ b/shell/zsh/.zplugin/functions/zplugin-upgrade @@ -0,0 +1,7 @@ +#!/usr/bin/env zsh + +DEFAULT_BRANCH="main" + +function zplugin-update() { + CURRENT_BRANCH=$(git branch --show-current) +} diff --git a/shell/zsh/.zplugin/install.sh b/shell/zsh/.zplugin/install.sh new file mode 100644 index 0000000..50a7ef5 --- /dev/null +++ b/shell/zsh/.zplugin/install.sh @@ -0,0 +1,22 @@ + +main() { + + +local ZPLUGIN_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/zplugin +local BACKUP_SUFFIX=$(date +%Y-%m-%d)_$(date_+%s) +local ZSHRC=${ZDOTDIR:-$HOME}/.zshrc + +[[ -f $ZPLUGIN_DIR/zplugin.zsh ]] && { + read "ans?Zplugin is already installed in '$ZPLUGIN_DIR'" + read -q "ans?Do you want to reinstall it (y/N)? " + [[ $ans =~ ^[Nn]$ ]] && { + echo " skipped installation" + return + } + echo " Reinstalling Zplugin" + rm -rf $ZPLUGIN_DIR +} + + git clone --depth 1 https://github.com/orangzz/zplugin.git + +} diff --git a/shell/zsh/.zplugin/lib/init.zsh b/shell/zsh/.zplugin/lib/init.zsh new file mode 100644 index 0000000..95bcb59 --- /dev/null +++ b/shell/zsh/.zplugin/lib/init.zsh @@ -0,0 +1,83 @@ + +# Autoload all functions +(){ + setopt localoptions extendedglob + for func in $ZGEN_SOURCE/functions/(__|)zplugin(-|_)*~*.zwc; do + autoload -Uz ${func:t} + done +} + + + + + + + + + +zsh_cleanup_plugin() { + fpath=(${fpath[@]:#ZPLUGIN_DIR/$1}) + fpath=(${fpath[@]:#ZPLUGIN_DIR/$1/functions}) + path=(${fpath[@]:#ZPLUGIN_DIR/$1/bin}) + +} + +zsh_unload_plugin() { + [ -z $1 ] && print "plugin unload error: none specified" && return 1 + local plugin_name=${1:t} + local plugin_dir=$Z_PLUGIN_DIR/$plugin_name + if [[ ! -d $plugin_dir]]; then + print "plugin unload error: plugin $plugin_name not found" + return 1 + fi + + if [[ -d $plugin_dir/.git ]]; then + zsh_cleanup_plugin $plugin_name + rm -rf $plugin_dir + print "plugin $plugin_name removed" + else + read "ans?$plugin_name is a local plugin. Do you want to unload it (y/N)? " + if [[ $ans =~ ^[Yy]$ ]]; then + zsh_cleanup_plugin $plugin_name + rm -rf $plugin_dir + print "plugin $plugin_name removed" + fi + fi +} + +zsh_update_plugin() { + print "Checking updates for ${1:t}..." + git -C $1 fetch origin $branch --quiet + local local=$(git -C ${1} rev-parse HEAD) + local remote=$(git -C ${1} rev-parse '@{u}') + if [ "${local}" != "${remote}" ]; then + git -C ${1} reset --hard origin/"${branch}" + git -C ${1} pull origin "${branch}" --quiet + print "${1:t} updated" + fi +} + +zsh_update_plugins() { + zsh_update_plugin $ZPLUGIN_DIR + for plugin +} + +zsh_autoupdate_plugin() { + [[ -z $ZPLUGIN_AUTOUPDATE ]] && return + +} + + + +function zautoload() { + local fdir ffile + local -i ffound + ffile=$1 + (( ffound = 0)) + for fdir in $fpath ; do + [[ -e $fdir/$ffile ]] && (( ffound = 1)) + done + (( ffound == 0)) || return 1 + autoload -U $ffile || return 1 + return 0 +} diff --git a/shell/zsh/.zplugin/plugins/.gitkeep b/shell/zsh/.zplugin/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/shell/zsh/.zplugin/templates/template.plugin.zsh b/shell/zsh/.zplugin/templates/template.plugin.zsh new file mode 100644 index 0000000..13d0dd5 --- /dev/null +++ b/shell/zsh/.zplugin/templates/template.plugin.zsh @@ -0,0 +1,27 @@ + + + +# https://wiki.zshell.dev/community/zsh_plugin_standard#functions-directory +if [[ $PMSPEC != *f* ]] { + fpath+=( ${0:h}/functions) +} + +# https://wiki.zshell.dev/community/zsh_plugin_standard#activity-indicator +# will set the `$zsh_loaded_plugins`` array to contain all previously loaded plugins and the plugin currently being loaded +# avoid duplication, only add directory to `fpath` if not already present +if [[ ${zsh_loaded_plugins[-1]} != */kaclc && -z ${fpath[(r)${0:h}]} ]] } + fpath+=( ${0:h}) +} + +# Global Parameter With PREFIX For Make, Configure, Etc +# https://wiki.zshell.dev/community/zsh_plugin_standard#global-parameter-with-prefix + +# PMSPEC +# https://wiki.zshell.dev/community/zsh_plugin_standard#global-parameter-with-capabilities + + +progress_frames=( + '0.1 ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏' + '0.1 ⣾ ⣽ ⣻ ⢿ ⡿ ⣟ ⣯ ⣷' + '0.1 ⢹ ⢺ ⢼ ⣸ ⣇ ⡧ ⡗ ⡏' +) diff --git a/shell/zsh/.zplugin/templates/zshrc b/shell/zsh/.zplugin/templates/zshrc new file mode 100644 index 0000000..7b90edc --- /dev/null +++ b/shell/zsh/.zplugin/templates/zshrc @@ -0,0 +1,30 @@ + +typeset -A ZPLUGIN +ZPLUGIN_HOME=$HOME/.zplugin +ZPLUGIN[HOME_DIR]=$ZPLUGIN_HOME +ZPLUGIN[BIN_DIR]=$ZPLUGIN_HOME/bin + + +# compaudit +# files owned by root not by the current user +# group or world writable directory +# -w +compaudit | xargs chown -R "$(whoami)" "$ZI[HOME_DIR]" +compaudit | xargs chmod -R go-w "$ZI[HOME_DIR]" + +# if initfile not found +[ ! -f $ZPLUGIN_HOME/.zplugin.zsh ] || { + # git -C ${ZPLUGIN_HOME:h} clone --depth 1 https://github.com/orangzz/zplugin.git + command git clone --depth 1 https://github.com/orangzz/zplugin.git $ZPLUGIN_HOME[bin] +} +source $ZPLUGIN_HOME/zplugin.zsh + +zplugin load zsh-users/zsh-autosuggestions \ + zsh-users/zsh-syntax-highlighting \ + zsh-users/zsh-history-substring-search \ + +# Load completion function +autoload -Uz _zplugin +# bind completion functions to commands +(( ${+_comps} )) && _comps[zi]=_zplugin +# compdef _zplugin zplugin diff --git a/shell/zsh/.zplugin/tests/startup.zsh b/shell/zsh/.zplugin/tests/startup.zsh new file mode 100644 index 0000000..a5ba424 --- /dev/null +++ b/shell/zsh/.zplugin/tests/startup.zsh @@ -0,0 +1,2 @@ +#!/usr/bin/env zsh +for i in $(seq 1 10); do time zsh -i -c exit; done diff --git a/shell/zsh/.zplugin/zplugin.zsh b/shell/zsh/.zplugin/zplugin.zsh new file mode 100644 index 0000000..b8daed2 --- /dev/null +++ b/shell/zsh/.zplugin/zplugin.zsh @@ -0,0 +1,37 @@ +#!/usr/bin/env zsh +# Zsh Plugin Standard compatibility +# 0 – the plugin manager provides the ZERO parameter, +# f - … supports the functions subdirectory, +# b - … supports the bin subdirectory, +# u - … the unload function, +# U - … the @zsh-plugin-run-on-unload call, +# p – … the @zsh-plugin-run-on-update call, +# i – … the zsh_loaded_plugins activity indicator, +# P – … the ZPFX global parameter, +# s – … the PMSPEC global parameter itself (i.e.: should be always present). +export PMSPEC="0fbs" + + + +# %N indicates "The name of the script, sourced file, or shell function that zsh is currently executing," +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" + +## namespace prefix + +ZPLUGIN[HOME_DIR]=$HOME/.zplugin + +if [[ -z $ZPLUGIN_DIR ]]; then + if [[ -e ${ZDOTDIR:-$HOME}/.zplugin]]; then + ZPLUGIN_DIR=$HOME/.zplugin + else + # ZPLUGIN_DIR=$ZPLUGIN_SOURCE/.zplugin + ZPLUGIN_DIR=$ZPLUGIN_SOURCE/sources + fi +fi + +path=(${0:h}/bin $path[@]) +fpath=(${0:h}/functions $fpath[@]) +typeset -gaU path fpath + + +source "${0:h}/init.zsh" diff --git a/shell/zsh/.zprofile b/shell/zsh/.zprofile index 8e5dba4..9fc39d0 100644 --- a/shell/zsh/.zprofile +++ b/shell/zsh/.zprofile @@ -1,32 +1,79 @@ -################################################################################## -# [direnv]() -# project environment variable manager -# [dotenvx](https://dotenvx.com/docs/env-file) -# project secert manager - -# zsh shell starup file loading order (If ZDOTDIR is unset, HOME is used instead) -# Startup: -# 1. /etc/zshenv -> $ZDOTDIR/.zshenv - Always loaded -# 2. /etc/zprofile -> $ZDOTDIR/.zprofile. - If the shell is a login shell +# terminfo database +# act as if the terminal behaves like xterm-256color + + + + + + + + +# [[ -d $HISTFILE:h ]] || mkdir -p $HISTFILE:h + + + + +#-- shell invocation mode +# reading commands from a script or standard input +# -c Take the first argument as a command to execute + +# -- shell process mode +# invoke as login shell +# invoke as interactive shell - shell process input and output connect to terminal emulator +# invoked as script interperter + +# logged in from a tty +# logged into system via ssh +# executing a command remotely +# open GNOME or KDE terminal window/tab: +# login, interactive on macos +# non‑login, interactive on linux + + + + +#-- zsh shell startup/shutdown file loading order + +# (If ZDOTDIR is unset, HOME is used instead) +# 1. /etc/zshenv -> $ZDOTDIR/.zshenv - Always loaded +# 2. /etc/zprofile -> $ZDOTDIR/.zprofile - If the shell is a login shell # 3. /etc/zshrc -> $ZDOTDIR/.zshrc - if the shell is interactive -# 4. /etc/zlogin -> $ZDOTDIR/.zlogin - if the shell is a login shell, +# 4. /etc/zlogin -> $ZDOTDIR/.zlogin - if the shell is a login shell # Shutdown: # 5. $ZDOTDIR/.zlogout ->/etc/zlogout - When a login shell exits +#-- Bash shell statup fie loading order -# x11/xinitrc -# x11/xprofile -# x1ll/xresources +# invoke as interactive or login shell +# /etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile -> ~/.bash_logout - if the shell is a login shell + +# invoke as interactive non-login shell +# /etc/bashrc -> ~/.bashrc + +# BASH_ENV - if invoke as script interpreter, +# it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. as if: +# if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi + + +#-- fish shell startup file loading order + +# /config.fish +# /etc/fish/config.fish +# ~/.config/fish/config.fish ################################################################################## -# `path` : entry in its directory in it wil used as search path to find executable scripts or native binary +# `path` : entry in its directory in it wil used as search path to discover executable scripts or native binary # `fpath`: entry in its directory in it wil be used as search path to find the completin function # `manpath`: # Where are `$paths` come from ? +# cat /etc/profile +# if [ -x /usr/libexec/path_helper ]; then +# eval `/usr/libexec/path_helper -s` +# fi # macos use utility `/usr/libexec/path_helper` prepend the system path to the `$path` environment variable # content of `/etc/paths` and all the entry in `/etc/paths.d` directory, @@ -69,8 +116,7 @@ # segementFault # codeRefactor - -[[ $ZDOTDIR/.zfunc.zsh ]] && . $ZDOTDIR/.zfunc.zsh +[[ $ZDOTDIR/rc.d/01-func.zsh ]] && . $ZDOTDIR/rc.d/01-func.zsh # remove duplicate and not-existed entry @@ -83,14 +129,47 @@ export -UT INFOPATH infopath # -T creates a "tied" pair; # where to find manpages installed by Homebrew path=( - $DOTFILES/scripts - $HOME/.local/bin - # /home/linuxbrew/.linuxbrew/bin(N) # (N): null if file doesn't exist + $DOTFILES/scripts(N) + $HOME/.local/bin(N) + # /home/linuxbrew/.linuxbrew/bin(N) # (N): null if pattern match doesn't exist $path[@] ) -################################################################################## -# language runtime and dependency manager installed +################################################################################## lang runtime version manager and dependency manager setup process +# setup install prefix - the base directory the lang runtime will install to +# setup fpath for shell to discover the completion function +# setup path for shell to discover the executable scripts or native binaries +# install latest lts version of lang runtime + + + +#-- Ruby + + + +RBENV_ROOT=$HOME/.rbenv +if [[ -z $commands[rbenv] && $commands[brew] ]]; then + brew install rbenv +fi + +# rbenv root +# $HOME/.rbenv/versions//bin + + +# list installed version aware by rbenv +# rbenv versions + +# currently active Ruby version +# rbenv version +# reports the currently configured global version. +# rbenv global + +# setup the global ruby version shell will invoke +# echo $INSTALL_VERSION > ~/.rbenv/version +# rbenv global + +# setup the local ruby version for the current directory +# version string read from a `.ruby-version` file #-- Java @@ -98,9 +177,9 @@ export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home" CLASS_PATH="$JAVA_HOME/lib" PATH="$PATH:$JAVA_HOME/bin" -# Rust -zsh_add_path "$HOME/.cargo/bin" +#-- Rust +zsh_add_path "$HOME/.cargo/bin" # python runtime version management # [pyenv](https://github.com/pyenv/pyenv) @@ -110,22 +189,27 @@ zsh_add_path "$HOME/.cargo/bin" -#-- node runtime version pacmage manager +#-- node runtime version manager # nvm # export NVM_INSTALL="$HOME/.nvm" # set install dir # [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm # nvm end -# n -#`npm cofig ls` -# npm config get prefix +#`npm config ls --depth=0` +# npm config get prefix - $HOME/.n # $N_PREFIX/lib/node_modules - installed packages # $N_PREFIX/bin - installed executables +# $HOME/.n/etc/npmrc - globalconfig file export N_PREFIX=$HOME/.n +if [[ -z $commands[n] ]]; then + curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s install lts +fi zsh_add_path "$N_PREFIX/bin" +# export N_NODE_MIRROR=https://npmmirror.com/mirrors/node -#-- node package and dependency manager + +#-- alternative node dependency manager # pnpm @@ -150,12 +234,22 @@ zsh_add_path "$GOBIN" # # GPG -# workaround if not w32 systems +# workaround to invoke gpg agent +# require tty to show pinentry prompt +# pop up a window asking for passphrase # added to init/startup file is used on shell invocations -# GPG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}/gnupg" + + GPG_TTY="$(tty)" export GPG_TTY -unset SSH_AGENT_PID -if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + + +if [ -z "$SSH_AUTH_SOCK" ]; then + eval "$(ssh-agent -s)" > /dev/null + ssh-add ~/.ssh/id.account@github 2>/dev/null fi +# unset SSH_AGENT_PID +# if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then +# export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +# gpgconf --launch gpg-agent +# fi diff --git a/shell/zsh/.zshenv b/shell/zsh/.zshenv index ba2e11f..13b9100 100644 --- a/shell/zsh/.zshenv +++ b/shell/zsh/.zshenv @@ -1,36 +1,24 @@ - - - -################################################################################## -# default program -################################################################################## -export EDITOR="nvim" -export VISUAL="zed" -export PAGER=less - - export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 - - - - - - - - -# xdg base dir spec compliance if not using install base dir -export XDG_CONFIG_HOME=$HOME/.config -export XDG_DATA_HOME="$HOME/.local/share" -export XDG_CACHE_HOME="$HOME/.cache" - +# := if it's unset or null and then substitutes +# xdg base dir spec compliance +: XDG_CONFIG_HOME=${XDG_CONFIG_HOME:=$HOME/.config} +: XDG_CACHE_HOME=${XDG_CACHE_HOME:=$HOME/.cache} +: XDG_DATA_HOME=${XDG_DATA_HOME:=$HOME/.local/share} +: XDG_STATE_HOME=${XDG_STATE_HOME:=$HOME/.local/state} +#=== ZSH PREFIX === +ZDOTDIR=$XDG_CONFIG_HOME/zsh + +export EDITOR=nvim VISUAL=nvim PAGER=less + +# gtk #export TERM='rxvt-256color' #export TERM='xterm-256color' -export DOTFILES="$HOME/dotfiles" +DOTFILES=$HOME/dotfiles -export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" -export XPROFILE="$XDG_CONFIG_HOME/x11/xprofile" +XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" +XPROFILE="$XDG_CONFIG_HOME/x11/xprofile" diff --git a/shell/zsh/.zshrc b/shell/zsh/.zshrc index 0788105..5d27caf 100644 --- a/shell/zsh/.zshrc +++ b/shell/zsh/.zshrc @@ -1,42 +1,27 @@ -############################################################################### -# The Order and Condition are sourced -# organzied shell config, consider performance +# measures user-visible latency of interactive zsh: +# create_tty_ms= +# prompt_first_display_ms= +# command_lag_ms= +# input_lag_ms= +# just execute 'ZSH_PROFILE_RC=1 zsh' and run 'zprof' to get the details +[[ ${ZSH_PROFILE_RC:-0} -eq 0 ]] || zmodload zsh/zprof +alias zprofrc="ZSH_PROFILE_RC=1 zsh" +# alias zbench='for i in $(seq 1 10); do; /usr/bin/time zsh -i -c exit; done' -# restart shell: -# - Open a new tab or window in your terminal. -# - Replace the current shell with a new one: `exec zsh` -# reload config `source $ZDOTDIR/.zshrc` -# `man zshexpn` - zsh expansion and substitution -# alias expansion -# paramater expansion -# file="report"; echo "${file}_2024.pdf" # report_2024.pdf -# ${name:+word} # Use word if name is set AND non-empty -# ${name:-word} # Use word if name is unset OR empty -# ${name:=word} # Set name to word if unset OR empty, then use it -# command substitution `$(command)` -# parameter subtituion `${parameter}` `man zshparam` -# processs subtitution `<(process)` -# `man zshall` -# `man zshbuiltins` autoload emulate -# eval: Execute arguments as a shell command. -# `man param` -# `man zshoptions` -# `man zshzle` -############################################################################### +# found in `/etc/zsh/zshrc` +# Useful support for interacting with Terminal.app or other terminal programs +# [ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM" +# found in `/etc/zshrc_$TERM_PROGRAM`( `/etc/zshrc_Apple_Terminal`) +# ghostty will create this file if turn on shell-integration + # Set up the session directory/file. + # SHELL_SESSION_DIR="${ZDOTDIR:-$HOME}/.zsh_sessions" + # SHELL_SESSION_FILE="$SHELL_SESSION_DIR/$TERM_SESSION_ID.session" + # mkdir -m 700 -p "$SHELL_SESSION_DIR" -# startup time profiling and benchmark - -zmodload zsh/zprof - - - - - - -# zsh syntax hightlighting -# shell fonts +SHELL_SESSION_DIR=$XDG_STATE_HOME/zsh/.zsh_sessions +SHELL_SESSION_FILE=$SHELL_SESSION_DIR/$TERM_SESSION_ID.session @@ -49,87 +34,61 @@ export http2_proxy=http://127.0.0.1:6152; export no_proxy=localhost,127.0.0.1; -# feedback for config reload -# neofetch --backend off -# figlet -f standard "Bump!" +# ZFUNCTION= +# fpath=($ZDOTDIR/completions $fpath) -################################################################################# -# subcommands options suggestion -################################################################################# +# autoload -U $ZFUNCTION/*(:t) -zsh_add_file "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" -#################################################################################### -# Completion -#################################################################################### - -[[ -s $ZDOTDIR/.zcomp.zsh ]] && source $ZDOTDIR/.zcomp.zsh - - -#################################################################################### -# Syntax Hightlight # # see https://github.com/zsh-users/zsh-syntax-highlighting/tree/feature/redrawhook # -#################################################################################### - -############################################################################### -# Options -# set -o | less -############################################################################### - -setopt autocd -setopt appendhistory -setopt sharehistory -setopt HIST_SAVE_NO_DUPS - -############################################################################### -# Line EDITOR -# zle -al -############################################################################### -[[ -e ./zlerc.zsh ]] && source './zlerc.zsh' - - -############################################################################### -# Plugins & Integrations -# Terminal status bar -############################################################################### +# Plugin Integrations +# zsh_add_file "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" # directory jump eval "$(zoxide init --cmd cd zsh)" +FZF_DEFAULT_OPTS=" +--border +--height 80% +--extended +--ansi +--reverse +--cycle +--bind ctrl-s:toggle-sort +--bind 'alt-e:execute($EDITOR {} >/dev/tty /dev/null | head -200\" +--preview-window right:60% +" +FZF_DEFAULT_COMMAND="fd --type f --hidden --follow --exclude .git 2>/dev/null" + source <(fzf --zsh) +# autoload -Uz add-zsh-hook -############################################################################### -# Scripts -############################################################################### +# function add_execute_permission { +# # Loop through all files in the $DOTFILES/scripts directory that are newly created +# find $DOTFILES/scripts -type f -exec chmod +x {} \; +# } -autoload -Uz add-zsh-hook -function add_execute_permission { - # Loop through all files in the $DOTFILES/scripts directory that are newly created - find $DOTFILES/scripts -type f -exec chmod +x {} \; -} -add-zsh-hook chpwd add_execute_permission -# add-zsh-hook precmd vcs_info -# Local config -if [[ -e "$HOME/.localrc" ]]; then - source "$HOME/.localrc" +if [[ -e "$HOME/.zshrc.local" ]]; then + source "$HOME/.zshrc.local" fi -zprof + () { @@ -147,3 +106,29 @@ zprof . $file # `.` is like `source`, but doesn't search your $path. done } "$@" + + +##? plugin-load - load plugins without a fancy plugin manager +##? +##? usage: plugin-load [-h|--help] +##? plugin-load [-n|--no-source] [-d|--defer] [-f|--fpath] [-p|--path] +##? [-u|--use-dir ] [] + +ZPLUGIN_DIR=$HOME/.zplugin +[ -f $ZPLUGIN_DIR/zplugin.zsh ] || git -C ${ZPLUGIN_DIR:h} clone https://github.com/orangzz/zplugin.git $ZPLUGIN_DIR +source $ZPLUGIN_DIR/zplugin.zsh + +zplugin load zsh-users/zsh-autosuggestions \ + zsh-users/zsh-syntax-highlighting \ + zsh-users/zsh-history-substring-search \ + zsh-users/zsh-history-substring-search \ + zsh-users/zsh-surround + +[[ "$PWD" != "/" ]] || cd + +# done profiling +[[ ${ZSH_PROFILE_RC:-0} -eq 0 ]] || { unset ZSH_PROFILE_RC && zprof } + + + + diff --git a/shell/zsh/completions/_kubectl b/shell/zsh/completions/_kubectl deleted file mode 100644 index f944199..0000000 --- a/shell/zsh/completions/_kubectl +++ /dev/null @@ -1,228 +0,0 @@ -#compdef kubectl -compdef _kubectl kubectl - -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#compdef kubectl -compdef _kubectl kubectl - -# zsh completion for kubectl -*- shell-script -*- - -__kubectl_debug() -{ - local file="$BASH_COMP_DEBUG_FILE" - if [[ -n ${file} ]]; then - echo "$*" >> "${file}" - fi -} - -_kubectl() -{ - local shellCompDirectiveError=1 - local shellCompDirectiveNoSpace=2 - local shellCompDirectiveNoFileComp=4 - local shellCompDirectiveFilterFileExt=8 - local shellCompDirectiveFilterDirs=16 - local shellCompDirectiveKeepOrder=32 - - local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder - local -a completions - - __kubectl_debug "\n========= starting completion logic ==========" - __kubectl_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]}") - __kubectl_debug "Truncated words[*]: ${words[*]}," - - lastParam=${words[-1]} - lastChar=${lastParam[-1]} - __kubectl_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" - - # For zsh, when completing a flag with an = (e.g., kubectl -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. - __kubectl_debug "Adding extra empty parameter" - requestComp="${requestComp} \"\"" - fi - - __kubectl_debug "About to call: eval ${requestComp}" - - # Use eval to handle any environment variables and such - out=$(eval ${requestComp} 2>/dev/null) - __kubectl_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[@]}") - __kubectl_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. - __kubectl_debug "No directive found. Setting do default" - directive=0 - fi - - __kubectl_debug "directive: ${directive}" - __kubectl_debug "completions: ${out}" - __kubectl_debug "flagPrefix: ${flagPrefix}" - - if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then - __kubectl_debug "Completion received error. Ignoring completions." - return - fi - - local activeHelpMarker="_activeHelp_ " - local endIndex=${#activeHelpMarker} - local startIndex=$((${#activeHelpMarker}+1)) - local hasActiveHelp=0 - while IFS='\n' read -r comp; do - # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) - if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then - __kubectl_debug "ActiveHelp found: $comp" - comp="${comp[$startIndex,-1]}" - if [ -n "$comp" ]; then - compadd -x "${comp}" - __kubectl_debug "ActiveHelp will need delimiter" - hasActiveHelp=1 - fi - - continue - fi - - 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/:} - - __kubectl_debug "Adding completion: ${comp}" - completions+=${comp} - lastComp=$comp - fi - done < <(printf "%s\n" "${out[@]}") - - # Add a delimiter after the activeHelp statements, but only if: - # - there are completions following the activeHelp statements, or - # - file completion will be performed (so there will be choices after the activeHelp) - if [ $hasActiveHelp -eq 1 ]; then - if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then - __kubectl_debug "Adding activeHelp delimiter" - compadd -x "--" - hasActiveHelp=0 - fi - fi - - if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then - __kubectl_debug "Activating nospace." - noSpace="-S ''" - fi - - if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then - __kubectl_debug "Activating keep order." - keepOrder="-V" - 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}" - - __kubectl_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 - __kubectl_debug "Listing directories in $subdir" - pushd "${subdir}" >/dev/null 2>&1 - else - __kubectl_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 - __kubectl_debug "Calling _describe" - if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then - __kubectl_debug "_describe found some completions" - - # Return the success of having called _describe - return 0 - else - __kubectl_debug "_describe did not find completions." - __kubectl_debug "Checking if we should do file completion." - if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then - __kubectl_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 - __kubectl_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]" = "_kubectl" ]; then - _kubectl -fi diff --git a/shell/zsh/functions/cdpr b/shell/zsh/functions/cdpr new file mode 100644 index 0000000..019653d --- /dev/null +++ b/shell/zsh/functions/cdpr @@ -0,0 +1,5 @@ +if ! git rev-parse --is-inside-work-tree &>/dev/null; then + echo "cdpr: Cannot cd to project root. \$PWD not in a git project." + return 1 +fi +cd "$(git rev-parse --show-toplevel)" diff --git a/shell/zsh/functions/md b/shell/zsh/functions/md new file mode 100644 index 0000000..1e0c001 --- /dev/null +++ b/shell/zsh/functions/md @@ -0,0 +1,8 @@ +function md() { + [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" +} +(( ${+functions[compdef]} )) && compdef _directories md + +command function "${@}" +unset -f + diff --git a/shell/zsh/functions/zcompinit b/shell/zsh/functions/zcompinit new file mode 100644 index 0000000..56513b6 --- /dev/null +++ b/shell/zsh/functions/zcompinit @@ -0,0 +1,26 @@ +local ZCOMPDUMP_PATH=${ZI[ZCOMPDUMP_PATH]:-${XDG_CACHE_HOME:-$HOME/.cache}/zsh/.zcompdump} + +# full compinit per day +if [[ -e $ZCOMPDUMP_PATH && -f $ZCOMPDUMP_PATH(#qNmh+24) ]]; then + # compinit will create the dump file if there isn't one already + # use option `-u` to make all files found used without asking + compinit -i -d "$ZCOMPDUMP_PATH" +else + # ignore all insecure files and directories use the option `-i` + # compaudit not owned by root or current user + # group or world writable directory + # skips the compaudit + compinit -C -d "$ZCOMPDUMP_PATH" +fi + # rm -f "$ZCOMPDUMP_PATH*" + +# Compile the completion dump to boost startup speed. Run in background. +{ + # if zcompdump file exists, and we don't have a compiled version + # or if dump file is newer than the compiled file + if [[ -s $ZCOMPDUMP_PATH && (! -s ${ZCOMPDUMP_PATH}.zwc || $ZCOMPDUMP_PATH -nt ${ZCOMPDUMP_PATH}.zwc) ]]; then + [[ -e $ZCOMPDUMP_PATH.zwc ]] && mv -f "$ZCOMPDUMP_PATH.zwc" "$ZCOMPDUMP_PATH.zwc.old" + zcompile -M $ZCOMPDUMP_PATH && command rm -f $ZCOMPDUMP_PATH.zwc.old + fi +} &! + diff --git a/shell/zsh/lang/install-rust.sh b/shell/zsh/lang/install-rust.sh new file mode 100644 index 0000000..c7aca1f --- /dev/null +++ b/shell/zsh/lang/install-rust.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh +rustup update +MDBOOK_VERSION=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') +cargo install --version ${MDBOOK_VERSION} mdbook + + +# url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" +# url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-aarch64-apple-darwin.tar.gz" +# curl -sSL $url | tar -xz --directory=$HOME/.local/bin + diff --git a/shell/zsh/plugins/fzf.zsh b/shell/zsh/plugins/fzf.zsh deleted file mode 100644 index c062a7a..0000000 --- a/shell/zsh/plugins/fzf.zsh +++ /dev/null @@ -1,23 +0,0 @@ -# subcommands completion - -#+───────────┬───────────────────────┬ -#│ Keystroke │ Bash Function │ Zsh Function -#├───────────┼───────────────────────┼ -#│ CTRL-t │ __fzf_select__ │ __fsel -#├───────────┼───────────────────────┼ -#│ CTRL-r │ __fzf_history__ │ fzf-history-widget -#├───────────┼───────────────────────┼ -#│ ALT-c │ __fzf_cd__ │ fzf-cd-widget -#+───────────┴───────────────────────┴ - - -# _fzf_compgen_path -# _fzf_compgen_dir - -# _fzf_compgen_path() { - # rg --files --glob "!.git" . "$1" -# } - -# _fzf_compgen_dir() { - # fd --type d --hidden --follow --exclude ".git" . "$1" -# } diff --git a/shell/zsh/.zfunc.zsh b/shell/zsh/rc.d/0-func.zsh similarity index 83% rename from shell/zsh/.zfunc.zsh rename to shell/zsh/rc.d/0-func.zsh index 74e471f..ea5d60c 100644 --- a/shell/zsh/.zfunc.zsh +++ b/shell/zsh/rc.d/0-func.zsh @@ -1,18 +1,22 @@ function zsh_add_file(){ # -r file True if file exists and is readable # -s file True if file exists and has a size greater than zero. - [[ -r $ZDOTDIR/$1 ]] && source $ZDOTDIR/$1 + [[ -r $ZDOTDIR/$1 ]] && . $ZDOTDIR/$1 } + +# discover executable # prepend a path to the $PATH environment variable. -# path separaotr - ':' for posix or ';' for win -# only append if existed and not duplicated +# path separator - ':' for posix or ';' for win +# only prepend path if it existed and not duplicated function zsh_add_path() { + # IFS=":" if [[ -d $1 && ":$path:" != *":$1:"* ]]; then path=($1 ${path[@]}) fi } +# discover completion function zsh_add_fpath() { # include boundary to avoid substring issue [[ -d $1 && " ${fpath[*]} " != *" $1 "* ]] && fpath=($1 ${fpath[@]}) @@ -39,3 +43,8 @@ function zsh_add_completion() { compinit fi } + + + + + diff --git a/shell/zsh/rc.d/01-hist.zsh b/shell/zsh/rc.d/01-hist.zsh deleted file mode 100644 index f4064b0..0000000 --- a/shell/zsh/rc.d/01-hist.zsh +++ /dev/null @@ -1,31 +0,0 @@ -# zhs-history-sbustring-search -# terminfo -# share history between local and remote - -setopt EXTENDED_GLOB - - -# := if it's unset or null and then substitutes -HISTFILE=${XDG_DATA_HOME:=~/.local/share}/zsh/history - -# Just in case: If the parent directory doesn't exist, create it. -[[ -d $HISTFILE:h ]] || mkdir -p $HISTFILE:h - - - -# Max number of entries to keep in history file. -SAVEHIST=$(( 100 * 1000 )) # Use multiplication for readability. - -# Max number of history entries to keep in memory. -HISTSIZE=$(( 1.2 * SAVEHIST )) # Zsh recommended value - - -# Use modern file-locking mechanisms, for better safety & performance. -setopt HIST_FCNTL_LOCK - - -# Keep only the most recent copy of each duplicate entry in history. -setopt HIST_IGNORE_ALL_DUPS - -# Auto-sync history between concurrent sessions. -setopt SHARE_HISTORY diff --git a/shell/zsh/rc.d/01-prompt.zsh b/shell/zsh/rc.d/01-prompt.zsh new file mode 100644 index 0000000..76bb15d --- /dev/null +++ b/shell/zsh/rc.d/01-prompt.zsh @@ -0,0 +1,29 @@ +# Prompts +# https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html +# On the left prompt: +# show only current dir and its parent +# show vi mode indicator and the last command exit status +# On the right prompt: +# vcs_info(branch name, count commits ahead or behind of remote, working tree dirty action: rebase or merge, revert, cherry-pick, bisect) + +# autoload -Uz vcs_info +# precmd() vcs_info + +# autoload -U promptinit; promptinit +# prompt pure +# starship +# powerlevel10k + +# `%F{} %f` - Change the foreground color with . +# `%K{} %k` - Change the background color with . +# `%B %b` - Bold. +# `%U %u` - Underline. + +# [[ -r ~/.p10k.zsh ]] || . ~/.p10k.zsh + +# autoload -U colors && colors + +export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml" +[[ $widgets[starship_zle-keymap-select] ]] || { + eval "$(starship init zsh)" +} diff --git a/shell/zsh/rc.d/02-hist.zsh b/shell/zsh/rc.d/02-hist.zsh new file mode 100644 index 0000000..107bdf1 --- /dev/null +++ b/shell/zsh/rc.d/02-hist.zsh @@ -0,0 +1,24 @@ +# History +# http://zsh.sourceforge.net/Doc/Release/Options.html#History + +# should after `/etc/zshrc` startup file loaded +# otherwise will be overwrite by config in `/etc/zshrc` `cat /etc/zshrc | grep HISTFILE` +HISTFILE=$XDG_STATE_HOME/zsh/.zsh_history +[[ -d $HISTFILE:h ]] || mkdir -p $HISTFILE:h + +setopt append_history # append to history file +setopt hist_reduce_blanks # remove blanks from each command line being added to the history list +setopt hist_ignore_space # trim leading and trailing whitespace +setopt inc_append_history # write to the history file immediately, not when the shell exits +setopt hist_find_no_dups # don't display previous found history entry +setopt hist_ignore_all_dups # Keep only the most recent copy of each duplicate entry in history. +setopt share_history # share history between sessions +setopt extended_history # save command with beginning timestamp(in seconds since the epoch) and the duration (in seconds) to history file in the format of '::;command' +setopt hist_no_store # don't store history commands +setopt hist_fcntl_lock # Use modern file-locking mechanisms, for better safety & performance +setopt hist_verify # don't execute immediately upon history expansion +unsetopt hist_beep # don't beep when attempting to access a missing history entry + +# zsh-history-substring-search +# terminfo +# share history between local and remote diff --git a/shell/zsh/rc.d/02-prompt.zsh b/shell/zsh/rc.d/02-prompt.zsh deleted file mode 100644 index a2f22d8..0000000 --- a/shell/zsh/rc.d/02-prompt.zsh +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################### -# Plugins -# check alias apply `alias` -# [[ -e $ZDOTDIR/alias.zsh ]] && . $ZDOTDIR/alias.zsh -############################################################################### - - - - -############################################################################### -# [See the details of these options](https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html) -# On the left prompt: -# PS1='[\u@\h%-1d] $F{%(?.green.red)}✗ ' -# show only current dir and its parent -# show vins mode or vicmd mode and the last command exit status -# On the right prmpots: -# vcs_info(branch name, count commits ahead or behind of remote, wokring tree dirty action: rebase or merge, revert, cherry-pick,bisect) , viins or vicmd mode - - -# `%F{} %f` - Change the foreground color with . -# `%K{} %k` - Change the background color with . -# `%B %b` - Bold. -# `%U %u` - Underline. - -############################################################################### - -# [[ -r ~/.p10k.zsh ]] || . ~/.p10k.zsh - -# autoload -U colors && colors - -export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml" -[[ $widgets[starship_zle-keymap-select] ]] || { eval "$(starship init zsh)" } # this load starship diff --git a/shell/zsh/rc.d/04-opts.zsh b/shell/zsh/rc.d/04-opts.zsh index a84d5da..747712d 100644 --- a/shell/zsh/rc.d/04-opts.zsh +++ b/shell/zsh/rc.d/04-opts.zsh @@ -1,13 +1,35 @@ -# View the list the existing shell options `setopt` +# === ZSH Options === +# http://zsh.sourceforge.net/Doc/Release/Options.html + # View a list of all default zsh options `emulate -lLR zsg` -# Don't let > silently overwrite files. To overwrite, use >! instead. -setopt NO_CLOBBER +# View list the shell options `setopt` state (on or off) set -o | less -# Treat comments pasted into the command line as comments, not code. -setopt INTERACTIVE_COMMENTS +# Changing Directories +# http://zsh.sourceforge.net/Doc/Release/Options.html#Changing-Directories +alias dh='dirs -v' +setopt auto_cd # if a command isn't valid, but is a directory, cd to that dir +setopt auto_pushd # make cd push the old directory onto the directory stack +setopt pushd_ignore_dups # don’t push multiple copies of the same directory onto the directory stack +setopt pushd_minus # swapped the meaning of cd +1 and cd -1 +setopt pushdsilent # keeps the shell from printing the directory stack each time we do a cd +setopt pushd_to_home # if no arguments are given, will push home directory to stack -# test casee -# ~/d* is expanded into /Users/armin/Desktop /Users/armin/Documents /Users/armin/Downloads -setopt NO_CASE_GLOB +# Expansion and Globbing +# http://zsh.sourceforge.net/Doc/Release/Options.html#Expansion-and-Globbing +# Grouping, range of integers, exclude certain files from the patterns, file type qualifiers +# *~(*.gz|*.bz2|*.xz|*.zip) -> searches for word not in compressed files +setopt extendedglob -setopt HASH_EXECUTABLES_ONLY +# Job Control +# http://zsh.sourceforge.net/Doc/Release/Options.html#Job-Control +unsetopt hup # don't kill jobs on shell exit +setopt longlistjobs # long listing format for jobs +# Input/Output +# http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput +setopt automenu # Automatically use menu completion after the second consecutive request for +# completion +setopt interactive_comments # enable comments in interactive shell +setopt always_to_end # completion is inserted with cursor within a word, the cursor is moved to the end of the word +setopt complete_in_word # completion is inserted within a word, not just at the end +setopt no_case_glob # ~/d* is expanded into /Users/armin/Desktop /Users/armin/Documents /Users/armin/Downloads +setopt hash_executables_only # only hash the executables diff --git a/shell/zsh/rc.d/05-zle.zsh b/shell/zsh/rc.d/05-zle.zsh deleted file mode 100644 index b171d6f..0000000 --- a/shell/zsh/rc.d/05-zle.zsh +++ /dev/null @@ -1,207 +0,0 @@ -# bindkey -l - Output the list of all available keymaps. -# bindkey -M - Output all the keybindings for the keymap . For example: bindkey -M viins. -# bindkey -M - Output the widget bound to the keystroke for the keymap . For example: bindkey -M vicmd u. -# bindkey -M -r - Delete the binding mapped to the keystroke for the keymap . For example: bindkey -M vicmd -r '^l' -# bindkey -# `\e` stands for -# `^` stands for . - - -# keymap(as a collection of keyboard shortcuts ) -# emacs: emacs emulation -# viins: vi emulation (insert mode) -# vicmd: vi emulation (command mode) -# isearch: incremental search mode -# command: command reading mode -# .safe: fallback keymap (cannot be deleted) - -# terminfo - -# view the list of shortcut for a keymaps -# bindkey -M vicmd -# bindkey -M emacs - -# bindkey -A viins main - - -# bindkey '^l' clear-screen -# bindkey "^u" kill-whole-line -# bindkey "^k" kill-line -# # bindkey "^w" backward-kill-line -# bindkey "^w" backward-kill-word -# bindkey "^a" beginning-of-line -# bindkey "^e" end-of-line -# bindkey "^f" forward-char -# bindkey "^b" backward-char -# bindkey "\eb" backward-word -# bindkey "\ef" forward-word - -# bindkey "^[[1;3C" forward-word -# bindkey "^[[1;3D" backward-word - -# bindkey '^p' histroy-search-backward -# bindkey '^n' histroy-search-forward - -# # zoxide -# bindkey "^[" prev # Previous window -# bindkey -M ecmas "\e\ " next # Next window - -## -# Alt-H: Get help on your current command. -# -unalias run-help 2> /dev/null # Remove the simple default. -autoload -RUz run-help # -R resolves the function immediately, so we can access the source dir. - - -# Load $functions_source, an associative array (a.k.a. dictionary, hash table -# or map) that maps each function to its source file. - - - -# Alt-Shift-S: Prefix the current or previous command line with `sudo`. -() { - bindkey '^[S' $1 # Bind Alt-Shift-S to the widget below. - zle -N $1 # Create a widget that calls the function below. - $1() { # Create the function. - # If the command line is empty or just whitespace, then first load the - # previous line. - [[ $BUFFER == [[:space:]]# ]] && - zle .up-history - - # $LBUFFER is the part of the command line that's left of the cursor. This - # way, we preserve the cursor's position. - LBUFFER="sudo $LBUFFER" - } -} .sudo - -# remap caps to esc - - -bindkey -v -typeset -A key - key=( - BackSpace "${terminfo[kbs]}" - Home "${terminfo[khome]}" - End "${terminfo[kend]}" - Insert "${terminfo[kich1]}" - Delete "${terminfo[kdch1]}" - Up "${terminfo[kcuu1]}" - Down "${terminfo[kcud1]}" - Left "${terminfo[kcub1]}" - Right "${terminfo[kcuf1]}" - PageUp "${terminfo[kpp]}" - PageDown "${terminfo[knp]}" - ) - - function bind2maps () { - local i sequence widget - local -a maps - # collect keymap until hit '--' - while [[ "$1" != "--" ]]; do - maps+=( "$1" ) - shift - done - shift - - sequence="${key[$1]}" - widget="$2" - - [[ -z "$sequence" ]] && return 1 - - for i in "${maps[@]}"; do - bindkey -M "$i" "$sequence" "$widget" - done - } - bind2maps emacs -- Delete delete-char - bind2maps viins vicmd -- Delete vi-delete-char - bind2maps emacs viins vicmd -- Up up-line-or-history - bind2maps emacs viins vicmd -- Down down-line-or-history - bind2maps emacs -- Left backward-char - bind2maps viins vicmd -- Left vi-backward-char - bind2maps emacs -- Right forward-char - bind2maps viins vicmd -- Right vi-forward-char - -#-- Reassign keys -# Make `` and `` cycle completions -bindkey '^I' menu-complete -bindkey "$terminfo[kcbt]" reverse-menu-complete -# Make `` submit the command line, even when you are in the menu -# bindkey -M menuselect '^M' .accept-line - - -# ctrl+v for inspect escape sequence -# zle -la -# man zshzle - -# open editor -autoload -z edit-commnad-line -zle -N edit-command-line -bindkey -M vicmd vv edit-command-line - - - - - -bindkey -M vicmd cs change-surround -bindkey -M vicmd ds delete-surround - -bindkey -M viins '^[[7~' beginning-of-line - - -# Search history with arrow keys -autoload -Uz up-line-or-beginning-search -autoload -Uz down-line-or-beginning-search -zle -N up-line-or-beginning-search # Register up-line-or-beginning-search as a zle widget -zle -N down-line-or-beginning-search # Register down-line-or-beginning-search as a zle widget - - - -# bindkey '^[[A' up-line-or-beginning-search # Up arrow for history search -# bindkey '^[[B' down-line-or-beginning-search # Down arrow for history search - -bindkey -M viins '^[[A' history-beginning-search-backward -bindkey -M viins '^[[B' history-beginning-search-forward -# bindkey -M viins '^[[A' history-substring-search-up # Up arrow for history search -# bindkey -M viins '^[[B' history-substring-search-down # Down arrow for history search -bindkey -M vicmd 'k' history-substring-search-up -bindkey -M vicmd 'j' history-substring-search-down -bindkey '^R' history-incremental-search-backward -# End of search history with arrow keys - - - -# surround -bindkey -M vicmd add add-surround -bindkey -M vicmd cs change-surround -bindkey -M vicmd ds delete-surround -# around -# inside - - -local cursor_block='\e[2 q' -local cursor_beam='\e[5 q' - - function zle-keymap-select { - case $KEYMAP in - vicmd) echo -ne $cusor_block;; - vins|main) echo -ne $cursor_beam;; - esac - } - - zle-line-init() { - zle -K viins - echo -ne $cursor_beam - } - -zle -N zle-keymap-select -zle -N zle-line-init -echo -ne $cursor_beam -preexec() { echo -ne $cursor_beam } - - - - -# window management -# resize -# new -# back/for diff --git a/shell/zsh/rc.d/06-alias.zsh b/shell/zsh/rc.d/06-alias.zsh index b8bff46..b994a61 100644 --- a/shell/zsh/rc.d/06-alias.zsh +++ b/shell/zsh/rc.d/06-alias.zsh @@ -12,7 +12,6 @@ alias path="print -l $path" alias manpath="print -l $manpath" # modern aleternative - if command -v bat &> /dev/null; then alias cat="bat --plain --theme zenburn" alias bcat="bat --theme zenburn" @@ -26,9 +25,14 @@ alias grep="rg" # `--RAW-CONTROL-CHARS` allows ANSI "color" escape sequences to be output in their raw form. This means that if the input contains color codes (like from `ls --color`), they will be interpreted by the terminal and the output will be colored. # `--no-init` prevent the clear the output on the screen after you exit `less`. # alias ls='lsd -la | less -FRX' -alias ls="lsd -la" -alias tree="lsd -la --tree --color=always --icon=always | less -FRX" - +if [[ -n $SSH_CONNECTION ]]; then + export DISPLAY=:0 + alias ls="lsd --group-dirs=first" + else + alias ls="lsd --group-dirs=first" +fi +alias tree="lsd -la --tree" +# copy and move with progress bar and confirm alias cp='cp -i' alias mv='mv -i' alias rm='rm -i' @@ -66,7 +70,7 @@ alias pscpus='ps auxf | sort -nr -k 3 | head -5' # power off, halt alias shutdown="sudo shutdown -p now" alias reboot="sudo shutdown -r now" -alias flushdns="dscacheutil -flushcache && sudo killall -HUP mDNSResponder" +alias flusdns="dscacheutil -flushcache && sudo killall -HUP mDNSResponder" @@ -96,22 +100,33 @@ case "$(uname -s)" in esac -############################################################################### +######################################################################### # Git -############################################################################### +######################################################################### alias lg="lazygit" alias gs="git status" -# alias glpretty="git log --graph --oneline --all" -alias gl="git log --graph --format='%C(yellow)%h%Creset - %s %Cgreen(%cr) %C(blue)%an %Creset'" -alias gls="git log --show-signature --graph --format='%C(yellow)%h%Creset - %s %Cgreen(%cr) %C(blue)%an %C(magenta)%G? %Creset'" -alias gdr="git commit --allow-empty --all" +#%h -- abbreviated commit hash +#%D -- ref names +#%cr -- relative commit date +#%an -- author name +alias gl="git log --graph --format='%C(yellow)%h%Creset - %s %Cgreen(%cr) %C(blue)%an %Creset'" +alias glp="git log --graph --all \ +--format='%C(yellow)%h %C(magenta)%an%Creset - %C(white)%cr %C(auto)%d %C(reset)%n%s%n'" +alias gce="git commit --allow-empty --all" alias gc="git commit --signoff --message" -alias gd="git diff --stat --patch" -alias gane="git commit --amend --no-edit" +alias gcl="git clone" +alias gcm="git commit --amend --signoff --no-edit" +alias gd="git diff --stat --patch " +# Get previous release tags +alias gtr="git ls-remote --tags --ref --sort='v:refname'" + + + + ############################################################################### # Navigating the Direcotry tree # broot @@ -127,3 +142,8 @@ setopt AUTO_CD alias ..="cd .." alias ...="cd .. && cd .." alias ....="cd .. && cd .. && cd .." + + + +alias heic="magick mogrify -monitor -format jpg *.heic" + diff --git a/shell/zsh/rc.d/07-exports.zsh b/shell/zsh/rc.d/07-exports.zsh new file mode 100644 index 0000000..e69de29 diff --git a/shell/zsh/.zcomp.zsh b/shell/zsh/rc.d/08-compsys.zsh similarity index 77% rename from shell/zsh/.zcomp.zsh rename to shell/zsh/rc.d/08-compsys.zsh index 662f936..b3f328b 100644 --- a/shell/zsh/.zcomp.zsh +++ b/shell/zsh/rc.d/08-compsys.zsh @@ -1,14 +1,9 @@ -################################################################################# -# Completion +# === Completion === # man zshcompsys # add as submodule or cherry-pick the specific completions - - # feat(completion): print completion code to stdout instead modify shell config -# register completion function -# $_comps[_pnpm] -# $_comps[_bun] + @@ -20,21 +15,18 @@ -# compdef _ngrok ngrok: registers _ngrok as the completion function for ngrok. # case "$SHELL" in # *zsh) generate_zsh_completion ;; # *bash) generate_bash_completion ;; # esac -# Keybindings -# menu select -# menu scroll -# + + # Make `tab` and `shift+tab` display the completion menu, cycle completions on the command line # - `$(brew --prefix)/share/zsh/site-functions # - `/usr/local/share/zsh/site-functions` (for system-wide installations) # - `~/.config/zsh/completions` (for user-specific completions) -# register completion function + # compinit and compaudit use entry in `fpath` directory as search path for completion function discovery # # starship completions fish | source @@ -45,48 +37,54 @@ # optimzing startup time to less than 100ms # defer initialization # complie completion functions into a cached bytecode dump. -# -############################################################################### +# use `$fpath` as search path to register completion functions +typeset -U fpath fpath=( ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions $HOMEBREW_PREFIX/share/zsh/site-functions $fpath[@] ) - -# zsh_add_fpath ${HOMEBREW_PREFIX:+$HOMEBREW_PREFIX/share/zsh/site-functions} - -# zsh_add_fpath "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions" - +# zsh_add_fpath $HOMEBREW_PREFIX/share/zsh/site-functions +# zsh_add_fpath "$XDG_CONFIG_HOME/zsh/completions" # zmodload zsh/complist # go,python,node,bun,rust,kubctl,helm, docker, function kubectl() { - prviate setup=__start_kubectl + # local setup=__start_kubectl # if there isn't completion loaded and executable found in search path - if [[ -z $functions[$setup] && -n $commands[kubectl] ]]; then + if [[ -z $_comps[kubectl] && -n $commands[kubectl] ]]; then source <(command kubectl completion zsh) - # autoload +X -Uz $setup + + # (( ${+_comps} )) && _comps[kubectl]=$setup # autoload -Uz _asdf # compdef _asdf asdf fi - command kubectl "$@" } -[[ -z $functions[__start_kubectl] && ! -s $ZDOTDIR/completions/__start_kubectl && $commands[kubectl] ]] && { - kubectl completion zsh 2> /dev/null >| "$ZDOTDIR/completions/_kubectl" -} &! + +# [[ -z $functions[__start_kubectl] && ! -s $ZDOTDIR/completions/__start_kubectl && $commands[kubectl] ]] && { +# kubectl completion zsh 2> /dev/null >| "$ZDOTDIR/completions/_kubectl" +# } &! # helm completion +# register completion function + +# registers `_ngrok` as the completion function for `ngrok` +# $_comps[ngrok]=_ngrok +# compdef _ngrok ngrok, $_comps[ngrok], $_functions[_ngrok] + + # function ngrok() { # if [[ -z $_comps[ngrok] ]]; then # source <(ngrok completion) + # # ngrok completion 2> /dev/null >| "$ZDOTDIR/completions/_ngrok" &| # fi # command ngrok "$@" @@ -194,6 +192,18 @@ function pipenv() { ngrok completion >| "$ZDOTDIR/completions/_ngrok" } &! +# android +export ANDROID_HOME=/usr/local/share/android-sdk +export ANDROID_SDK_ROOT=/usr/local/share/android-sdk +export ANDROID_NDK_HOME=/usr/local/share/android-ndk + + + + + +# `man zshmodules` -> `zsh/zutil` + + # zstyle ':vsc_info:*' enable git @@ -206,37 +216,33 @@ function pipenv() { # rm -f ${ZDOTDIR:-$HOME}/.zcompdump -# consider completion cache stale, rm -f $zcompdump; autoload -Uz compinit -export _comp_dumpfile="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/.zcompdump" +ZSH_COMPDUMP=${XDG_CACHE_HOME:-$HOME/.cache}/zsh/.zcompdump # ensure compinit directory -[[ ! -d $_comp_dumpfile ]] && mkdir -p "$_comp_dumpfile:h" # $(dirname $zcompdump) +[[ ! -d $ZSH_COMPDUMP ]] && mkdir -p $ZSH_COMPDUMP:h # $(dirname $ZSH_COMPDUMP) -# use `$fpath` as search path to register completion functions -# full compinit per day -if [[ $_comp_dumpfile(#qNmh+24) ]]; then - - # rm -f "$_comp_dumpfile*" +if [[ $ZSH_COMPDUMP(#qNmh+24) ]]; then # full compinit per day + # rm -f "$ZSH_COMPDUMP*" # compinit will create the dump file if there isn't one already - # compaudit not owned by root or current user # use option `-u` to make all files found used without asking - # ignore all insecure files and directories use the option -i. - compinit -i -d "$_comp_dumpfile" + compinit -i -d "$ZSH_COMPDUMP" else - # change the configuration will applied delete the old one + # ignore all insecure files and directories use the option `-i` + # compaudit not owned by root or current user + # group or world writable directory # skips the compaudit - compinit -C -d "$_comp_dumpfile" + compinit -C -d "$ZSH_COMPDUMP" fi # Compile the completion dump to boost startup speed. Run in background. { # if zcompdump file exists, and we don't have a compiled version or the - # dump file is newer than the compiled file - if [[ -s "$_comp_dumpfile" && (! -s "${_comp_dumpfile}.zwc" || "$zcompdump" -nt "${_comp_dumpfile}.zwc") ]]; then - zcompile "$_comp_dumpfile" + # if dump file is newer than the compiled file + if [[ -s $ZSH_COMPDUMP && (! -s ${ZSH_COMPDUMP}.zwc || $ZSH_COMPDUMP -nt ${ZSH_COMPDUMP}.zwc) ]]; then + zcompile $ZSH_COMPDUMP fi } &! @@ -246,6 +252,8 @@ fi zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/.zcompcache" + +# menu select, menu scroll zstyle ':completion:*' menu select zstyle ':completion:*' file-sort modification zstyle ':completion:*' group-name '' diff --git a/shell/zsh/rc.d/09-zle.zsh b/shell/zsh/rc.d/09-zle.zsh new file mode 100644 index 0000000..d3443a4 --- /dev/null +++ b/shell/zsh/rc.d/09-zle.zsh @@ -0,0 +1,213 @@ +# ================================ +# ZSH KEY BINDINGS CONFIGURATION +# ================================ + +# Enable vi mode +bindkey -v + +# ================================ +# Set cursor mode based on vi mode +# ================================ + + +# Insert mode could be +# `i` (insert) +# `a` (append) +# `I` (insert at the non-blank beginning of current line) +# `A` (append at the end of current line) +# ZVM_INSERT_MODE='i' + +# The mode could be the below value: +# `n` (normal) +# `i` (insert) +# `v` (visual) +# `vl` (visual-line) +# ZVM_MODE='' + +# Define cursor styles +local CURSOR_BLOCK='\e[2 q' +local CURSOR_BEAM='\e[5 q' +local CURSOR_BLINKING_BLOCK='\e[1 q' +local CURSOR_UNDERLINE='\e[4 q' + +# Register ZLE widgets + +zle-keymap-select() { + case $KEYMAP in + vicmd) echo -ne $CURSOR_BLOCKk;; # Command mode: block cursor + viins|main) echo -ne $CURSOR_BLINKING_BLOCK;; # Insert mode: blinking block cursor + esac +} +zle -N zle-keymap-select + +# Initialize with BLOCK cursor +function zle-line-init { + echo -ne $CURSOR_BLINKING_BLOCK +} +zle -N zle-line-init + +function zle-line-finish { + echo -ne $CURSOR_BEAM +} +zle -N zle-line-finish + + + + +# Ensure beam cursor on new prompt +# preexec precmd() { +# echo -ne $cursor_beam +# } + + + + + +# ================================ +# TERMINAL KEY MAPPINGS +# ================================ + +# Define terminal-specific keys using terminfo +typeset -A key +key=( + BackSpace "${terminfo[kbs]}" + Home "${terminfo[khome]}" + End "${terminfo[kend]}" + Insert "${terminfo[kich1]}" + Delete "${terminfo[kdch1]}" + Up "${terminfo[kcuu1]}" + Down "${terminfo[kcud1]}" + Left "${terminfo[kcub1]}" + Right "${terminfo[kcuf1]}" + PageUp "${terminfo[kpp]}" + PageDown "${terminfo[knp]}" +) + +# Helper function to bind keys across multiple keymaps +bind2maps() { + local i sequence widget + local -a maps + + # Collect keymaps until '--' + while [[ "$1" != "--" ]]; do + maps+=( "$1" ) + shift + done + shift + + sequence="${key[$1]}" + widget="$2" + + [[ -z "$sequence" ]] && return 1 + + for i in "${maps[@]}"; do + bindkey -M "$i" "$sequence" "$widget" + done +} + +# Bind terminal keys across keymaps +bind2maps emacs -- Delete delete-char +bind2maps viins vicmd -- Delete vi-delete-char +bind2maps emacs viins vicmd -- Up up-line-or-history +bind2maps emacs viins vicmd -- Down down-line-or-history +bind2maps emacs -- Left backward-char +bind2maps viins vicmd -- Left vi-backward-char +bind2maps emacs -- Right forward-char +bind2maps viins vicmd -- Right vi-forward-char + +bindkey undo Ctrl+/ Shift+Tab # undo the last command line change +bindkey redo Option+/ # redo the last undone command line change + +bindkey cd-back # cd into the previous directory +bindkey cd-forward # cd into the next directory +bindkey cd-up # cd into the parent directory +bindkey cd-down # cd into a child directory + +# ================================ +# surround +# ================================ + +bindkey -M vicmd 'cs' change-surround +bindkey -M vicmd 'ds' delete-surround +bindkey -M vicmd 'as' add-surround +bindkey -M vicmd 'cis' change-inside-surround + + + +# ================================ +# COMPLETION BINDINGS +# ================================ + +# Tab completion navigation +bindkey '^I' menu-complete # Tab: forward through completions +bindkey "$terminfo[kcbt]" reverse-menu-complete # Shift-Tab: backward through completions + +# ================================ +# HISTORY SEARCH +# ================================ + +# Load history search functions +autoload -Uz up-line-or-beginning-search +autoload -Uz down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +# History search bindings +bindkey -M viins '^[[A' history-beginning-search-backward # Up arrow +bindkey -M viins '^[[B' history-beginning-search-forward # Down arrow +bindkey -M vicmd 'k' history-substring-search-up # k in command mode +bindkey -M vicmd 'j' history-substring-search-down # j in command mode +bindkey '^R' history-incremental-search-backward # Ctrl-R + + +# ================================ +# COMMAND LINE EDITING +# ================================ + +# Edit command line in editor +autoload -z edit-command-line +zle -N edit-command-line +bindkey -M vicmd 'vv' edit-command-line + +# Command Line navigation +bindkey -M viins '^[[7~' beginning-of-line # Home key alternative + +# ================================ +# UTILITY FUNCTIONS +# ================================ + +# Alt-H: Get help on current command +unalias run-help 2>/dev/null +autoload -RUz run-help + +# Alt-Shift-S: Prefix command with sudo +() { + bindkey '^[S' $1 + zle -N $1 + $1() { + # Load previous command if current line is empty + [[ $BUFFER == [[:space:]]# ]] && zle .up-history + # Add sudo while preserving cursor position + LBUFFER="sudo $LBUFFER" + } +} .sudo + +# ================================ +# NOTES & REFERENCE +# ================================ + +# Key binding commands: +# bindkey -l - List all keymaps +# bindkey -M - Show bindings for keymap +# bindkey -M - Show widget for specific key +# bindkey -M -r - Remove binding + +# Special characters: +# \e = Alt/Meta key +# ^ = Ctrl key + +# Common keymaps: +# emacs - Emacs emulation +# viins - Vi insert mode +# vicmd - Vi command mode +# isearch - Incremental search diff --git a/shell/zsh/rc.d/10-styles.zsh b/shell/zsh/rc.d/10-styles.zsh new file mode 100644 index 0000000..e69de29 diff --git a/shell/zsh/themes/p10k.zsh b/shell/zsh/themes/p10k.zsh new file mode 100644 index 0000000..c4d24c0 --- /dev/null +++ b/shell/zsh/themes/p10k.zsh @@ -0,0 +1,32 @@ + + + +(){ + + # Default prompt symbol. + typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$mag enta + # Red prompt symbol if the last command failed. + typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='' + # Prompt symbol in command vi mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='' + # Prompt symbol in visual vi mode is the same as in command mode. + typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='' + + + ' + # ahead/behind arrow + # Don't show remote branch, current tag or stashes. + typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind) + # Show '⇣' if local branch is behind remote. + typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣' + # Show '⇡' if local branch is ahead of remote. + typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡' + # Don't show the number of commits next to the ahead/behind arrows. + typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1 + # Show '*' when there are staged, unstaged or untracked files. + typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*' + +} + + diff --git a/ssh/config.example b/ssh/config.example index 2bcd555..1206d75 100644 --- a/ssh/config.example +++ b/ssh/config.example @@ -1,23 +1,16 @@ -############################################################################### -# See `man ssh_config` for the details of these options -# # roam # across Wi-Fi network -# from Wi-Fi to cell ir vuce versa -# -# Added by OrbStack: 'orb' SSH host for Linux machines -# This only works if it's at the top of ssh_config (before any Host blocks). -# This won't be added again if you remove it. -# Include ~/.orbstack/ssh/config -# +# from Wi-Fi to cell ir vice versa # chmod 600 ~/.ssh/config -############################################################################### - Host * - ServerAliveInterval 60 ConnectTimeout 10 - AddKeysToAgent yes + ServerAliveInterval 120 + ServerAliveCountMax 2 + SetEnv TERM=xterm-256color + addKeysToAgent yes + UseKeychain yes + # sshHost = 'github.com' or 'ssh.github.com' @@ -25,9 +18,10 @@ Host * Host github.com Port 22 User git - IdentityFile ~/.ssh/id.account@latop-m1.home.device + IdentityFile ~/.ssh/id.account@github AddKeysToAgent yes IdentitiesOnly yes + ProxyCommand nc -X 5 -x 127.0.0.1:6153 %h %p Host droplet diff --git a/systemd/cron.service b/systemd/cron.service new file mode 100644 index 0000000..885cd79 --- /dev/null +++ b/systemd/cron.service @@ -0,0 +1,16 @@ +# scheduling one-off task can be accomplished via `at` +# scheduling repetitive tasks run periodically at a fixed time, date, or interval. +# cron experssion +# * * * * * +# | | | | | +# | | | | day of the week (0–6) +# | | | month (1–12) +# | | day of the month (1–31) +# | hour (0–23) +# minute (0–59) + + +# `/etc/cron.allow` – If this file exists, it must contain the user's name for that user to be allowed to use cron jobs. +# `/etc/cron.deny` - If the cron.allow file does not exist but the /etc/cron.deny file does exist then, to use cron jobs, users must not be listed in the /etc/cron.deny file. + +1 0 * * * printf "" > /var/log/apache/error_log diff --git a/xterm/ghostty/config b/xterm/ghostty/config index dd883e9..c1bdd5e 100644 --- a/xterm/ghostty/config +++ b/xterm/ghostty/config @@ -6,19 +6,11 @@ # TERMINFO=/Applications/Ghostty.app/Contents/Resources/terminfo # Change the Prefers login shell of the current user -# `sudo sh -c 'echo /usr/local/bin/fish >> /etc/shells'` or `echo /usr/local/bin/zsh | sudo tee -a /etc/shells > /dev/null` +# `sudo sh -c 'echo /usr/local/bin/fish >> /etc/shells'` +# `echo /usr/local/bin/zsh | sudo tee -a /etc/shells > /dev/null` # `chsh -s /usr/local/bin/fish` - - -# echo SHELL=$(dscl . -read /Users/"$(whoami)" | grep -E '^UserShell:' | awk '{ print $2 }') - - - -# load shell init/rc config file when launched -# /bin/sh -c - -# run prepend as shell argument # open -a /Applications/Ghostty.app ./start.command # if [[ $TERM_PROGRAM == "ghostty" ]]; then # if [[ $SHELL =~ "/zsh" ]]; then @@ -35,44 +27,40 @@ # should be beam/bar in viins mode # should be block in vicmd mode +# shell-integration-features = no-cursor + ############################################################################### # command = /usr/local/bin/fish --login --interactive -# command = /bin/zsh # shell-integration-features = no-title # shell-inegration = fish ############################################################################### # Themes -# `ghostty +list-themes` +# list available themes - `ghostty +list-themes` +# `themes` subdirectory of your Ghostty configuration directory +# search directory `${XDG_CONFIG_DIR;-$HOME}/ghostty/themes` to discover themes +# Ghostty resources directory +# `Ghostty.app/Contents/Resources/ghostty/themes` on macos +# `share/ghostty/themes` on linux ############################################################################### -theme = catppuccin-mocha -background-opacity = 0.8 - - - - - - - +# theme = catppuccin-mocha +# theme = aura +theme = tokyonight-storm +# background-opacity = 0.95 ############################################################################### # Keybindings -# Tabs + Panels +# Tabs, Panels and windows # ghostty +list-keybinds ############################################################################### - - - - - - - - - keybind = super+shift+,=reload_config keybind = shift+alt+up=adjust_selection:up - +# navigating window +# go to next +# go to previous +# go to first `` +# go to last keybind = alt+h=goto_split:left @@ -80,9 +68,9 @@ keybind = alt+l=goto_split:right keybind = alt+j=goto_split:up keybind = alt+k=goto_split:down +# split window side by side keybind = alt+v=new_split:right keybind = alt+s=new_split:down - keybind = f11=toggle_fullscreen keybind = ctrl+w=close_window @@ -103,21 +91,40 @@ keybind = shift+up=adjust_selection:up ############################################################################### -# Fonts +## Fonts # `ghostty +list-fonts` +# defaults font is `JetBrainsMono Nerd Font` +# +# check which font a symbol comes from +# `ghostty +show-face --string="X"` +# +# The struggle was never installing the font it was finding the name that a terminal would accept +# `fc-list | grep` +# +# candidate fonts should +# support nerd font: echo -e "\uf015 \uf07c \uf121 \uf126" +# has obvious distincation between `o0 1lI` +# support opentype feature ############################################################################### +font-family = Recursive Mono Casual Static +# font-family = DankMono Nerd Font +font-style = semibold +font-size = 18 - -############################################################################### -# Title Bar -############################################################################### +#################################################### +# User Interface +################################################### title = 👻 -# macos-titlebar-style = transparent -macos-non-native-fullscreen = true macos-titlebar-style = tabs -window-save-state = never +macos-non-native-fullscreen = visible-menu +adjust-cell-height = 35% +window-padding-x = 8 +window-padding-y = 8 +# macos-titlebar-style = transparent +# macos-non-native-fullscreen = true +# window-save-state = never # macos-titlebar-proxy-icon = hidden mouse-hide-while-typing = true confirm-close-surface = false diff --git a/xterm/ghostty/themes/orangzz b/xterm/ghostty/themes/orangzz new file mode 100644 index 0000000..da2c270 --- /dev/null +++ b/xterm/ghostty/themes/orangzz @@ -0,0 +1,22 @@ +palette = 0=#000000 +palette = 1=#b90000 +palette = 2=#00b900 +palette = 3=#b9b900 +palette = 4=#0000b9 +palette = 5=#b900b9 +palette = 6=#00b9b9 +palette = 7=#cecece +palette = 8=#454545 +palette = 9=#e60000 +palette = 10=#00e600 +palette = 11=#e6e600 +palette = 12=#0000e6 +palette = 13=#e600e6 +palette = 14=#00e6e6 +palette = 15=#e6e6e6 +background = #000000 +foreground = #ffffff +cursor-color = #bbbbbb +cursor-text = #ffffff +selection-background = #b5d5ff +selection-foreground = #000000
+ + + +