update
This commit is contained in:
parent
e1c96bc1d2
commit
317c7d208d
16 changed files with 699 additions and 255 deletions
|
|
@ -1,15 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Icon=/home/user/.local/share/JetBrains/Toolbox/toolbox.svg
|
||||
Exec=/home/user/.local/share/JetBrains/Toolbox/bin/jetbrains-toolbox --minimize
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Categories=Development
|
||||
Name=JetBrains Toolbox
|
||||
StartupWMClass=jetbrains-toolbox
|
||||
Terminal=false
|
||||
MimeType=x-scheme-handler/jetbrains;
|
||||
X-GNOME-Autostart-enabled=true
|
||||
StartupNotify=false
|
||||
X-GNOME-Autostart-Delay=10
|
||||
X-MATE-Autostart-Delay=10
|
||||
X-KDE-autostart-after=panel
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
"io.gitlab.librewolf-community",
|
||||
"com.system76.CosmicTerm",
|
||||
"zen",
|
||||
"jetbrains-goland",
|
||||
"com.mitchellh.ghostty",
|
||||
"com.system76.CosmicFiles",
|
||||
]
|
||||
|
|
@ -1 +1 @@
|
|||
"window-management"
|
||||
"display"
|
||||
|
|
@ -1 +1 @@
|
|||
"GoMono Nerd Font"
|
||||
"DejaVu Sans Mono"
|
||||
|
|
@ -1,45 +1,42 @@
|
|||
{
|
||||
"LazyVim": { "branch": "main", "commit": "2bea40c447b72e54ffb2d5cddc98d7798990796f" },
|
||||
"blink.cmp": { "branch": "main", "commit": "1cc3b1a908fbcfd15451c4772759549724f38524" },
|
||||
"LazyVim": { "branch": "main", "commit": "3f034d0a7f58031123300309f2efd3bb0356ee21" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "56bdccd4ec7071b413d7526399f99568db6ebf4b" },
|
||||
"conform.nvim": { "branch": "master", "commit": "363243c03102a531a8203311d4f2ae704c620d9b" },
|
||||
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"fzf-lua": { "branch": "main", "commit": "e8e46265edc5d40694df83c3ace035bbc67a3ff2" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "d8918f06624dd53b9a82bd0e29c31bcfd541b40d" },
|
||||
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "6a37fdbdf3c0fbe9c297e2b37a5598c9c08cfe9f" },
|
||||
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
|
||||
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
|
||||
"gopher.nvim": { "branch": "main", "commit": "0ed14a40d9799ac8d92aaf9eb1cd9be22ffd6b14" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "635e69adf3a714621bd0a289314bc23c5848babb" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" },
|
||||
"mini.icons": { "branch": "main", "commit": "910db5df9724d65371182948f921fce23c2c881e" },
|
||||
"mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "e752d224f914f1ffa18260fecfbfac233d3ca461" },
|
||||
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "309ecac6e6240d37c0be3c567d9f7cc95f63d255" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"mini.ai": { "branch": "main", "commit": "6e01c0e5a15554852546fac9853960780ac52ed4" },
|
||||
"mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" },
|
||||
"mini.pairs": { "branch": "main", "commit": "1a3e73649c0eaef2f6c48ce1e761c6f0a7c11918" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "1655119b2057838691467f8a640070462c9b7048" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
||||
"nvim-dap": { "branch": "master", "commit": "1c96e487dd4180edc5a3c075ea1f03b6b751ef4f" },
|
||||
"nvim-dap": { "branch": "master", "commit": "379cf26e9c457b66a0152cd5d018418c03720d47" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "605911fa0899882b05a8e4369ab12739620494af" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
|
||||
"nvim-lint": { "branch": "master", "commit": "789b7ada1b4f00e08d026dffde410dcfa6a0ba87" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "b4d65bce97795438ab6e1974b3672c17a4865e3c" },
|
||||
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a3f8422b752e03334dbaf4a46940d8aee0acdebf" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f3d7c0dafcbc86c4d63f765649c884a03bc1360a" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
|
||||
"powershell.nvim": { "branch": "main", "commit": "06110ac2e13e495a70a9f9a5781ef7ca091c9d3d" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "b96bd540f785c725289f9f15f0147b1b2dac5a35" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "99487eb34a397befce8182ff63347a21c5f4b881" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ab0950c53d1ae04da8e488aa762b450d5241dca2" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"powershell.nvim": { "branch": "main", "commit": "332ae073aa5db1ae825475ed1a0a2aa42c2212d5" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "07f4b9adff7af45a7e0eb22d85a422e32ed4b1ca" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "c3ab53c3f544e4a04f2a05d43451fd9bedff51b4" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "50481f414bd3c1a40122c1d759d7e424d5fafe84" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "872dcfa0418f4a33b7437fb4d9f4e89f2f000d74" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "d847ea942a5bb4d4fab6efebc9f30d787fd96e65" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "6cebd86917df559a88de0f806b2989799c6e6423" }
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "791dacfcfc8ccb7f6eb1c853050883b03e5a22fe" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
"extras": [
|
||||
|
||||
],
|
||||
"install_version": 7,
|
||||
"news": {
|
||||
"NEWS.md": "10960"
|
||||
},
|
||||
"version": 7
|
||||
"version": 8
|
||||
}
|
||||
22
.config/shell/alias.zsh
Normal file
22
.config/shell/alias.zsh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
alias tf=tofu
|
||||
alias terraform=tofu
|
||||
alias k=kubectl
|
||||
alias ls='ls --color'
|
||||
alias vim='nvim'
|
||||
alias c='clear'
|
||||
alias pwsh='pwsh -NoLogo'
|
||||
alias pbpaste='xclip -selection clipboard -o'
|
||||
alias ls='eza'
|
||||
alias ll='eza -l'
|
||||
alias lg='lazygit'
|
||||
alias tree='eza -T'
|
||||
alias cat='bat -P'
|
||||
alias network='nmtui'
|
||||
#alias docker='podman'
|
||||
alias sudo='sudo '
|
||||
alias grep='rg'
|
||||
alias connectvpn='sudo openvpn ~/Documents/openvpn/openvpn.ovpn'
|
||||
alias gc='git commit -a'
|
||||
alias gd='git diff'
|
||||
alias gp='git push'
|
||||
alias bw='NODE_OPTIONS="--no-deprecation" bw'
|
||||
440
.config/shell/bw.completions.zsh
Normal file
440
.config/shell/bw.completions.zsh
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
#compdef _bw bw
|
||||
|
||||
function _bw {
|
||||
local -a commands
|
||||
|
||||
_arguments -C \
|
||||
'--pretty[Format output. JSON is tabbed with two spaces.]' \
|
||||
'--raw[Return raw output instead of a descriptive message.]' \
|
||||
'--response[Return a JSON formatted version of response output.]' \
|
||||
'--cleanexit[Exit with a success exit code (0) unless an error is thrown.]' \
|
||||
'--quiet[Don'"'"'t return anything to stdout.]' \
|
||||
'--nointeraction[Do not prompt for interactive user input.]' \
|
||||
'--session[Pass session key instead of reading from env.]' \
|
||||
'(-v --version)'{-v,--version}'[output the version number]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"1: :->cmnds" \
|
||||
"*::arg:->args"
|
||||
|
||||
case $state in
|
||||
cmnds)
|
||||
commands=(
|
||||
"sdk-version:Print the SDK version."
|
||||
"login:Log into a user account."
|
||||
"logout:Log out of the current user account."
|
||||
"lock:Lock the vault and destroy active session keys."
|
||||
"unlock:Unlock the vault and return a new session key."
|
||||
"sync:Pull the latest vault data from server."
|
||||
"generate:Generate a password/passphrase."
|
||||
"encode:Base 64 encode stdin."
|
||||
"config:Configure CLI settings."
|
||||
"update:Check for updates."
|
||||
"completion:Generate shell completions."
|
||||
"status:Show server, last sync, user information, and vault status."
|
||||
"list:List an array of objects from the vault."
|
||||
"get:Get an object from the vault."
|
||||
"create:Create an object in the vault."
|
||||
"edit:Edit an object from the vault."
|
||||
"delete:Delete an object from the vault."
|
||||
"restore:Restores an object from the trash."
|
||||
"move:Move an item to an organization."
|
||||
"confirm:Confirm an object to the organization."
|
||||
"import:Import vault data from a file."
|
||||
"export:Export vault data to a CSV or JSON file."
|
||||
"share:--DEPRECATED-- Move an item to an organization."
|
||||
"send:Work with Bitwarden sends. A Send can be quickly created using this command or subcommands can be used to fine-tune the Send"
|
||||
"receive:Access a Bitwarden Send from a url"
|
||||
"serve:Start a RESTful API webserver."
|
||||
)
|
||||
_describe "command" commands
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$words[1]" in
|
||||
sdk-version)
|
||||
_bw_sdk-version
|
||||
;;
|
||||
login)
|
||||
_bw_login
|
||||
;;
|
||||
logout)
|
||||
_bw_logout
|
||||
;;
|
||||
lock)
|
||||
_bw_lock
|
||||
;;
|
||||
unlock)
|
||||
_bw_unlock
|
||||
;;
|
||||
sync)
|
||||
_bw_sync
|
||||
;;
|
||||
generate)
|
||||
_bw_generate
|
||||
;;
|
||||
encode)
|
||||
_bw_encode
|
||||
;;
|
||||
config)
|
||||
_bw_config
|
||||
;;
|
||||
update)
|
||||
_bw_update
|
||||
;;
|
||||
completion)
|
||||
_bw_completion
|
||||
;;
|
||||
status)
|
||||
_bw_status
|
||||
;;
|
||||
list)
|
||||
_bw_list
|
||||
;;
|
||||
get)
|
||||
_bw_get
|
||||
;;
|
||||
create)
|
||||
_bw_create
|
||||
;;
|
||||
edit)
|
||||
_bw_edit
|
||||
;;
|
||||
delete)
|
||||
_bw_delete
|
||||
;;
|
||||
restore)
|
||||
_bw_restore
|
||||
;;
|
||||
move)
|
||||
_bw_move
|
||||
;;
|
||||
confirm)
|
||||
_bw_confirm
|
||||
;;
|
||||
import)
|
||||
_bw_import
|
||||
;;
|
||||
export)
|
||||
_bw_export
|
||||
;;
|
||||
share)
|
||||
_bw_share
|
||||
;;
|
||||
send)
|
||||
_bw_send
|
||||
;;
|
||||
receive)
|
||||
_bw_receive
|
||||
;;
|
||||
serve)
|
||||
_bw_serve
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _bw_sdk-version {
|
||||
|
||||
}
|
||||
|
||||
function _bw_login {
|
||||
_arguments -C \
|
||||
'--method[Two-step login method.]' \
|
||||
'--code[Two-step login code.]' \
|
||||
'--sso[Log in with Single-Sign On.]' \
|
||||
'--apikey[Log in with an Api Key.]' \
|
||||
'--passwordenv[Environment variable storing your password]' \
|
||||
'--passwordfile[Path to a file containing your password as its first line]' \
|
||||
'--check[Check login status.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_logout {
|
||||
|
||||
}
|
||||
|
||||
function _bw_lock {
|
||||
|
||||
}
|
||||
|
||||
function _bw_unlock {
|
||||
_arguments -C \
|
||||
'--check[Check lock status.]' \
|
||||
'--passwordenv[Environment variable storing your password]' \
|
||||
'--passwordfile[Path to a file containing your password as its first line]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_sync {
|
||||
_arguments -C \
|
||||
'(-f --force)'{-f,--force}'[Force a full sync.]' \
|
||||
'--last[Get the last sync date.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_generate {
|
||||
_arguments -C \
|
||||
'(-u --uppercase)'{-u,--uppercase}'[Include uppercase characters.]' \
|
||||
'(-l --lowercase)'{-l,--lowercase}'[Include lowercase characters.]' \
|
||||
'(-n --number)'{-n,--number}'[Include numeric characters.]' \
|
||||
'(-s --special)'{-s,--special}'[Include special characters.]' \
|
||||
'(-p --passphrase)'{-p,--passphrase}'[Generate a passphrase.]' \
|
||||
'--length[Length of the password.]' \
|
||||
'--words[Number of words.]' \
|
||||
'--minNumber[Minimum number of numeric characters.]' \
|
||||
'--minSpecial[Minimum number of special characters.]' \
|
||||
'--separator[Word separator.]' \
|
||||
'(-c --capitalize)'{-c,--capitalize}'[Title case passphrase.]' \
|
||||
'--includeNumber[Passphrase includes number.]' \
|
||||
'--ambiguous[Avoid ambiguous characters.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_encode {
|
||||
|
||||
}
|
||||
|
||||
function _bw_config {
|
||||
_arguments -C \
|
||||
'--web-vault[Provides a custom web vault URL that differs from the base URL.]' \
|
||||
'--api[Provides a custom API URL that differs from the base URL.]' \
|
||||
'--identity[Provides a custom identity URL that differs from the base URL.]' \
|
||||
'--icons[Provides a custom icons service URL that differs from the base URL.]' \
|
||||
'--notifications[Provides a custom notifications URL that differs from the base URL.]' \
|
||||
'--events[Provides a custom events URL that differs from the base URL.]' \
|
||||
'--key-connector[Provides the URL for your Key Connector server.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_update {
|
||||
|
||||
}
|
||||
|
||||
function _bw_completion {
|
||||
_arguments -C \
|
||||
'--shell[Shell to generate completions for.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_status {
|
||||
|
||||
}
|
||||
|
||||
function _bw_list {
|
||||
_arguments -C \
|
||||
'--search[Perform a search on the listed objects.]' \
|
||||
'--url[Filter items of type login with a url-match search.]' \
|
||||
'--folderid[Filter items by folder id.]' \
|
||||
'--collectionid[Filter items by collection id.]' \
|
||||
'--organizationid[Filter items or collections by organization id.]' \
|
||||
'--trash[Filter items that are deleted and in the trash.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_get {
|
||||
_arguments -C \
|
||||
'--itemid[Attachment'"'"'s item id.]' \
|
||||
'--output[Output directory or filename for attachment.]' \
|
||||
'--organizationid[Organization id for an organization object.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_create {
|
||||
_arguments -C \
|
||||
'--file[Path to file for attachment.]' \
|
||||
'--itemid[Attachment'"'"'s item id.]' \
|
||||
'--organizationid[Organization id for an organization object.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_edit {
|
||||
_arguments -C \
|
||||
'--organizationid[Organization id for an organization object.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_delete {
|
||||
_arguments -C \
|
||||
'--itemid[Attachment'"'"'s item id.]' \
|
||||
'--organizationid[Organization id for an organization object.]' \
|
||||
'(-p --permanent)'{-p,--permanent}'[Permanently deletes the item instead of soft-deleting it (item only).]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_restore {
|
||||
|
||||
}
|
||||
|
||||
function _bw_move {
|
||||
|
||||
}
|
||||
|
||||
function _bw_confirm {
|
||||
_arguments -C \
|
||||
'--organizationid[Organization id for an organization object.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_import {
|
||||
_arguments -C \
|
||||
'--formats[List formats]' \
|
||||
'--organizationid[ID of the organization to import to.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_export {
|
||||
_arguments -C \
|
||||
'--output[Output directory or filename.]' \
|
||||
'--format[Export file format.]' \
|
||||
'--password[Use password to encrypt instead of your Bitwarden account encryption key. Only applies to the encrypted_json format.]' \
|
||||
'--organizationid[Organization id for an organization.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_share {
|
||||
|
||||
}
|
||||
|
||||
function _bw_send {
|
||||
local -a commands
|
||||
|
||||
_arguments -C \
|
||||
'(-f --file)'{-f,--file}'[Specifies that <data> is a filepath]' \
|
||||
'(-d --deleteInDays)'{-d,--deleteInDays}'[The number of days in the future to set deletion date, defaults to 7]' \
|
||||
'(-a --maxAccessCount)'{-a,--maxAccessCount}'[The amount of max possible accesses.]' \
|
||||
'--hidden[Hide <data> in web by default. Valid only if --file is not set.]' \
|
||||
'(-n --name)'{-n,--name}'[The name of the Send. Defaults to a guid for text Sends and the filename for files.]' \
|
||||
'--notes[Notes to add to the Send.]' \
|
||||
'--fullObject[Specifies that the full Send object should be returned rather than just the access url.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"1: :->cmnds" \
|
||||
"*::arg:->args"
|
||||
|
||||
case $state in
|
||||
cmnds)
|
||||
commands=(
|
||||
"list:List all the Sends owned by you"
|
||||
"template:Get json templates for send objects"
|
||||
"get:Get Sends owned by you."
|
||||
"receive:Access a Bitwarden Send from a url"
|
||||
"create:create a Send"
|
||||
"edit:edit a Send"
|
||||
"remove-password:removes the saved password from a Send."
|
||||
"delete:delete a Send"
|
||||
)
|
||||
_describe "command" commands
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$words[1]" in
|
||||
list)
|
||||
_bw_send_list
|
||||
;;
|
||||
template)
|
||||
_bw_send_template
|
||||
;;
|
||||
get)
|
||||
_bw_send_get
|
||||
;;
|
||||
receive)
|
||||
_bw_send_receive
|
||||
;;
|
||||
create)
|
||||
_bw_send_create
|
||||
;;
|
||||
edit)
|
||||
_bw_send_edit
|
||||
;;
|
||||
remove-password)
|
||||
_bw_send_remove-password
|
||||
;;
|
||||
delete)
|
||||
_bw_send_delete
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _bw_send_list {
|
||||
|
||||
}
|
||||
|
||||
function _bw_send_template {
|
||||
|
||||
}
|
||||
|
||||
function _bw_send_get {
|
||||
_arguments -C \
|
||||
'--output[Output directory or filename for attachment.]' \
|
||||
'--text[Specifies to return the text content of a Send]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_send_receive {
|
||||
_arguments -C \
|
||||
'--password[Password needed to access the Send.]' \
|
||||
'--passwordenv[Environment variable storing the Send'"'"'s password]' \
|
||||
'--passwordfile[Path to a file containing the Sends password as its first line]' \
|
||||
'--obj[Return the Send'"'"'s json object rather than the Send's content]' \
|
||||
'--output[Specify a file path to save a File-type Send to]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_send_create {
|
||||
_arguments -C \
|
||||
'--file[file to Send. Can also be specified in parent'"'"'s JSON.]' \
|
||||
'--text[text to Send. Can also be specified in parent'"'"'s JSON.]' \
|
||||
'--hidden[text hidden flag. Valid only with the --text option.]' \
|
||||
'--password[optional password to access this Send. Can also be specified in JSON]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_send_edit {
|
||||
_arguments -C \
|
||||
'--itemid[Overrides the itemId provided in [encodedJson]]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_send_remove-password {
|
||||
|
||||
}
|
||||
|
||||
function _bw_send_delete {
|
||||
|
||||
}
|
||||
|
||||
function _bw_receive {
|
||||
_arguments -C \
|
||||
'--password[Password needed to access the Send.]' \
|
||||
'--passwordenv[Environment variable storing the Send'"'"'s password]' \
|
||||
'--passwordfile[Path to a file containing the Sends password as its first line]' \
|
||||
'--obj[Return the Send'"'"'s json object rather than the Send's content]' \
|
||||
'--output[Specify a file path to save a File-type Send to]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
|
||||
function _bw_serve {
|
||||
_arguments -C \
|
||||
'--hostname[The hostname to bind your API webserver to.]' \
|
||||
'--port[The port to run your API webserver on.]' \
|
||||
'--disable-origin-protection[If set, allows requests with origin header. Warning, this option exists for backwards compatibility reasons and exposes your environment to known CSRF attacks.]' \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
"*::arg:->args"
|
||||
}
|
||||
17
.config/shell/export.zsh
Normal file
17
.config/shell/export.zsh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
export ZSH="$HOME/.oh-my-zsh"
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export POWERSHELL_TELEMETRY_OPTOUT=1
|
||||
export PROMPT_EOL_MARK=''
|
||||
export FZF_DEFAULT_OPTS="--preview 'bat --color=always {}'"
|
||||
export EDITOR='nvim'
|
||||
export GEM_HOME="$HOME/gems"
|
||||
export GOBIN=~/go/bin
|
||||
export BAT_THEME="Catppuccin Mocha"
|
||||
export LS_COLORS="$(vivid generate catppuccin-mocha)"
|
||||
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=none,fg=white,bold"
|
||||
#eval $(thefuck --alias)
|
||||
export GEM_HOME="$HOME/gems"
|
||||
|
||||
export PATH="$HOME/.local/bin:$HOME/gems/bin:/usr/local/go/bin:$HOME/go/bin:/home/linuxbrew/.linuxbrew/bin:$PATH"
|
||||
|
||||
source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
23
.config/shell/functions.zsh
Normal file
23
.config/shell/functions.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
unlockbw ()
|
||||
{
|
||||
export BW_SESSION="$(bw unlock $(secret-tool lookup drive bitwarden) --raw)"
|
||||
export GITLAB_TOKEN="$(bw get password cli-gitlab)"
|
||||
export OLLAMA_TOKEN="$(bw get password cli-ollama-token)"
|
||||
}
|
||||
lockbw ()
|
||||
{
|
||||
unset BW_SESSION
|
||||
unset GITLAB_TOKEN
|
||||
unset OLLAMA_TOKEN
|
||||
}
|
||||
|
||||
tmux-new () {
|
||||
local -r name=${(U)1-"$(basename $(pwd))"}
|
||||
tmux new-session -d -s $name
|
||||
tmux switch-client -t $name
|
||||
}
|
||||
|
||||
load-profile () {
|
||||
ansible-playbook /home/user/.dotfiles/ansible/.config/ansible/local.yml -K
|
||||
}
|
||||
|
||||
128
.config/shell/zoxide.completions.zsh
Normal file
128
.config/shell/zoxide.completions.zsh
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Utility functions for zoxide.
|
||||
#
|
||||
|
||||
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
||||
function __zoxide_pwd() {
|
||||
\builtin pwd -L
|
||||
}
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd() {
|
||||
# shellcheck disable=SC2164
|
||||
\builtin cd -- "$@"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Hook configuration for zoxide.
|
||||
#
|
||||
|
||||
# Hook to add new entries to the database.
|
||||
function __zoxide_hook() {
|
||||
# shellcheck disable=SC2312
|
||||
\command zoxide add -- "$(__zoxide_pwd)"
|
||||
}
|
||||
|
||||
# Initialize hook.
|
||||
# shellcheck disable=SC2154
|
||||
if [[ ${precmd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]] && [[ ${chpwd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]]; then
|
||||
chpwd_functions+=(__zoxide_hook)
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||
#
|
||||
|
||||
# Jump to a directory using only keywords.
|
||||
function __zoxide_z() {
|
||||
# shellcheck disable=SC2199
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
__zoxide_cd ~
|
||||
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then
|
||||
__zoxide_cd "$2"
|
||||
else
|
||||
\builtin local result
|
||||
# shellcheck disable=SC2312
|
||||
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" && __zoxide_cd "${result}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
function __zoxide_zi() {
|
||||
\builtin local result
|
||||
result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${result}"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Commands for zoxide. Disable these using --no-cmd.
|
||||
#
|
||||
|
||||
function cd() {
|
||||
__zoxide_z "$@"
|
||||
}
|
||||
|
||||
function cdi() {
|
||||
__zoxide_zi "$@"
|
||||
}
|
||||
|
||||
# Completions.
|
||||
if [[ -o zle ]]; then
|
||||
__zoxide_result=''
|
||||
|
||||
function __zoxide_z_complete() {
|
||||
# Only show completions when the cursor is at the end of the line.
|
||||
# shellcheck disable=SC2154
|
||||
[[ "${#words[@]}" -eq "${CURRENT}" ]] || return 0
|
||||
|
||||
if [[ "${#words[@]}" -eq 2 ]]; then
|
||||
# Show completions for local directories.
|
||||
_cd -/
|
||||
|
||||
elif [[ "${words[-1]}" == '' ]]; then
|
||||
# Show completions for Space-Tab.
|
||||
# shellcheck disable=SC2086
|
||||
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" --interactive -- ${words[2,-1]})" || __zoxide_result=''
|
||||
|
||||
# Set a result to ensure completion doesn't re-run
|
||||
compadd -Q ""
|
||||
|
||||
# Bind '\e[0n' to helper function.
|
||||
\builtin bindkey '\e[0n' '__zoxide_z_complete_helper'
|
||||
# Sends query device status code, which results in a '\e[0n' being sent to console input.
|
||||
\builtin printf '\e[5n'
|
||||
|
||||
# Report that the completion was successful, so that we don't fall back
|
||||
# to another completion function.
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function __zoxide_z_complete_helper() {
|
||||
if [[ -n "${__zoxide_result}" ]]; then
|
||||
# shellcheck disable=SC2034,SC2296
|
||||
BUFFER="cd ${(q-)__zoxide_result}"
|
||||
__zoxide_result=''
|
||||
\builtin zle reset-prompt
|
||||
\builtin zle accept-line
|
||||
else
|
||||
\builtin zle reset-prompt
|
||||
fi
|
||||
}
|
||||
\builtin zle -N __zoxide_z_complete_helper
|
||||
|
||||
[[ "${+functions[compdef]}" -ne 0 ]] && \compdef __zoxide_z_complete cd
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# To initialize zoxide, add this to your configuration (usually ~/.zshrc):
|
||||
#
|
||||
# eval "$(zoxide init zsh)"
|
||||
|
|
@ -11,6 +11,7 @@ set -g allow-passthrough on
|
|||
|
||||
set -ga update-environment TERM
|
||||
set -ga update-environment TERM_PROGRAM
|
||||
|
||||
# Vim style pane selection
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
|
|
@ -28,18 +29,18 @@ set-option -g @ssh-split-keep-cwd "true"
|
|||
set-option -g @ssh-split-keep-remote-cwd "true"
|
||||
|
||||
# Use Alt-arrow keys without prefix key to switch panes
|
||||
bind -n M-Left resize-pane -L 5
|
||||
bind -n M-Right resize-pane -R 5
|
||||
bind -n M-Up resize-pane -U 5
|
||||
bind -n M-Down resize-pane -D 5
|
||||
bind -n M-H resize-pane -L 5
|
||||
bind -n M-L resize-pane -R 5
|
||||
bind -n M-K resize-pane -U 5
|
||||
bind -n M-J resize-pane -D 5
|
||||
|
||||
# Shift arrow to switch windows
|
||||
bind -n S-Left previous-window
|
||||
bind -n S-Right next-window
|
||||
|
||||
# Shift Alt vim keys to switch windows
|
||||
bind -n M-H previous-window
|
||||
bind -n M-L next-window
|
||||
#bind -n M-H previous-window
|
||||
#bind -n M-L next-window
|
||||
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
|
|
|
|||
|
|
@ -71,10 +71,13 @@ map <leader>fl <action>(RecentLocations)
|
|||
let g:WhichKeyDesc_WindowManagement = "<leader>% Window management"
|
||||
let g:WhichKeyDesc_SplitVertically = "<leader>% Split vertically"
|
||||
let g:WhichKeyDesc_SplitHorizontally = "<leader>\" Split horizontally"
|
||||
let g:WhichKeyDesc_CloseContent = "<leader>x Close content"
|
||||
map <leader>% <action>(SplitVertically)
|
||||
map <leader>" <action>(SplitHorizontally)
|
||||
map <leader>x <action>(CloseContent)
|
||||
|
||||
" Buffers
|
||||
let g:WhichKeyDesc_Buffer = "<leader>b Buffers"
|
||||
let g:WhichKeyDesc_BufferDelete = "<leader>x Buffer Delete"
|
||||
map <leader>bx <action>(CloseContent)
|
||||
|
||||
" Popup Navigation
|
||||
inoremap <C-j> <Action>(PopupMenu-selectNext)
|
||||
|
|
|
|||
209
.zshrc
209
.zshrc
|
|
@ -1,40 +1,21 @@
|
|||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export POWERSHELL_TELEMETRY_OPTOUT=1
|
||||
export PROMPT_EOL_MARK=''
|
||||
export FZF_DEFAULT_OPTS="--preview 'bat --color=always {}'"
|
||||
export EDITOR='nvim'
|
||||
export GEM_HOME="$HOME/gems"
|
||||
export PATH="$HOME/.local/bin:$HOME/gems/bin:/usr/local/go/bin:$HOME/go/bin:/home/linuxbrew/.linuxbrew/bin:$PATH"
|
||||
export GOBIN=~/go/bin
|
||||
export BAT_THEME="Catppuccin Mocha"
|
||||
export LS_COLORS="$(vivid generate catppuccin-mocha)"
|
||||
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=none,fg=white,bold"
|
||||
#eval $(thefuck --alias)
|
||||
# Generate Completions if not found
|
||||
if [ ! -f $HOME/.config/shell/fzf.completion.zsh ]; then
|
||||
fzf --zsh > $HOME/.config/shell/fzf.completion.zsh
|
||||
fi
|
||||
|
||||
alias tf=tofu
|
||||
alias terraform=tofu
|
||||
alias k=kubectl
|
||||
alias ls='ls --color'
|
||||
alias vim='nvim'
|
||||
alias c='clear'
|
||||
alias pwsh='pwsh -NoLogo'
|
||||
alias pbpaste='xclip -selection clipboard -o'
|
||||
alias ls='eza'
|
||||
alias ll='eza -l'
|
||||
alias lg='lazygit'
|
||||
alias tree='eza -T'
|
||||
alias cat='bat -P'
|
||||
alias network='nmtui'
|
||||
#alias docker='podman'
|
||||
alias sudo='sudo '
|
||||
alias grep='rg'
|
||||
alias connectvpn='sudo openvpn ~/Documents/openvpn/openvpn.ovpn'
|
||||
alias gc='git commit -a'
|
||||
alias gd='git diff'
|
||||
alias gp='git push'
|
||||
alias bw='NODE_OPTIONS="--no-deprecation" bw'
|
||||
if [ ! -f $HOME/.config/shell/zoxide.completions.zsh ]; then
|
||||
zoxide init --cmd cd zsh > $HOME/.config/shell/zoxide.completions.zsh
|
||||
fi
|
||||
|
||||
if [ ! -f $HOME/.config/shell/bw.completions.zsh ]; then
|
||||
bw completion --shell zsh > $HOME/.config/shell/bw.completions.zsh
|
||||
fi
|
||||
|
||||
# Load seperated config files
|
||||
for conf in "$HOME/.config/shell/"*.zsh; do
|
||||
source "${conf}"
|
||||
done
|
||||
unset conf
|
||||
|
||||
if command -v tmux &> /dev/null && [[ "$TERMINAL_EMULATOR" == "JetBrains-JediTerm" ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||
cwd=$(pwd)
|
||||
|
|
@ -82,7 +63,7 @@ zinit light zsh-users/zsh-completions
|
|||
zinit light zsh-users/zsh-autosuggestions
|
||||
zinit light Aloxaf/fzf-tab
|
||||
|
||||
zinit wait lucid for OMZP::{'git','sudo','archlinux','aws','kubectl','kubectx','command-not-found','web-search','jsontools','copypath','copyfile','copybuffer','dirhistory'}
|
||||
#zinit wait lucid for OMZP::{'git','sudo','archlinux','aws','kubectl','kubectx','command-not-found','web-search','jsontools','copypath','copyfile','copybuffer','dirhistory'}
|
||||
# Add in snippets
|
||||
#zinit snippet OMZP::git
|
||||
#zinit snippet OMZP::sudo
|
||||
|
|
@ -132,157 +113,3 @@ zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
|||
zstyle ':completion:*' menu no
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
||||
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
|
||||
|
||||
# Generate Completions if not found
|
||||
if [ ! -f ~/.fzf.completion.zsh ]; then
|
||||
fzf --zsh > ~/.fzf.completion.zsh
|
||||
fi
|
||||
|
||||
if [ ! -f ~/.zoxide.completions.zsh ]; then
|
||||
zoxide init --cmd cd zsh > ~/.zoxide.completions.zsh
|
||||
fi
|
||||
|
||||
if [ ! -f ~/.bw.completions.zsh ]; then
|
||||
bw completion --shell zsh > ~/.bw.completions.zsh
|
||||
fi
|
||||
|
||||
source ~/.fzf.completion.zsh
|
||||
source ~/.fzf.key-bindings.zsh
|
||||
source ~/.zoxide.completions.zsh
|
||||
source ~/.bw.completions.zsh
|
||||
|
||||
unlockbw ()
|
||||
{
|
||||
export BW_SESSION="$(bw unlock $(secret-tool lookup drive bitwarden) --raw)"
|
||||
export GITLAB_TOKEN="$(bw get password cli-gitlab)"
|
||||
export OLLAMA_TOKEN="$(bw get password cli-ollama-token)"
|
||||
}
|
||||
lockbw ()
|
||||
{
|
||||
unset BW_SESSION
|
||||
unset GITLAB_TOKEN
|
||||
unset OLLAMA_TOKEN
|
||||
}
|
||||
|
||||
unlockvault() {
|
||||
local POD_NAME="vault-0"
|
||||
local NAMESPACE="vault"
|
||||
local UNSEAL_KEY=$VAULT_UNSEAL
|
||||
local PASSWORD=$VAULT_TOKEN
|
||||
local K8S_API_SERVER=$(kubectl exec -it $POD_NAME -n $NAMESPACE -- printenv | grep KUBERNETES_SERVICE_HOST | cut -d "=" -f2)
|
||||
local JWT=$(kubectl exec -it $POD_NAME -n $NAMESPACE -- cat /var/run/secrets/kubernetes.io/serviceaccount/token)
|
||||
|
||||
kubectl exec -it $POD_NAME -n $NAMESPACE -- /bin/sh << EOF
|
||||
vault operator unseal $UNSEAL_KEY
|
||||
vault login $PASSWORD
|
||||
vault write auth/kubernetes/config \
|
||||
token_reviewer_jwt="${JWT}" \
|
||||
kubernetes_host="https://${K8S_API_SERVER}:443" \
|
||||
kubernetes_ca_cert=@/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||
EOF
|
||||
}
|
||||
|
||||
tmux-new () {
|
||||
local -r name=${(U)1-"$(basename $(pwd))"}
|
||||
tmux new-session -d -s $name
|
||||
tmux switch-client -t $name
|
||||
}
|
||||
|
||||
load-profile () {
|
||||
ansible-playbook /home/user/.dotfiles/ansible/.config/ansible/local.yml -K
|
||||
}
|
||||
|
||||
function omz_urlencode() {
|
||||
emulate -L zsh
|
||||
local -a opts
|
||||
zparseopts -D -E -a opts r m P
|
||||
|
||||
local in_str="$@"
|
||||
local url_str=""
|
||||
local spaces_as_plus
|
||||
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||
local str="$in_str"
|
||||
|
||||
# URLs must use UTF-8 encoding; convert str to UTF-8 if required
|
||||
local encoding=$langinfo[CODESET]
|
||||
local safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
|
||||
str=$(echo -E "$str" | iconv )
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error converting string from $encoding to UTF-8" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use LC_CTYPE=C to process text byte-by-byte
|
||||
# Note that this doesn't work in Termux, as it only has UTF-8 locale.
|
||||
# Characters will be processed as UTF-8, which is fine for URLs.
|
||||
local i byte ord LC_ALL=C
|
||||
export LC_ALL
|
||||
local reserved=';/?:@&=+$,'
|
||||
local mark='_.!~*''()-'
|
||||
local dont_escape="[A-Za-z0-9"
|
||||
if [[ -z $opts[(r)-r] ]]; then
|
||||
dont_escape+=$reserved
|
||||
fi
|
||||
# $mark must be last because of the "-"
|
||||
if [[ -z $opts[(r)-m] ]]; then
|
||||
dont_escape+=$mark
|
||||
fi
|
||||
dont_escape+="]"
|
||||
|
||||
# Implemented to use a single printf call and avoid subshells in the loop,
|
||||
# for performance (primarily on Windows).
|
||||
local url_str=""
|
||||
for (( i = 1; i <= ${#str}; ++i )); do
|
||||
byte="$str[i]"
|
||||
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||
url_str+="$byte"
|
||||
else
|
||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||
url_str+="+"
|
||||
elif [[ "$PREFIX" = *com.termux* ]]; then
|
||||
# Termux does not have non-UTF8 locales, so just send the UTF-8 character directly
|
||||
url_str+="$byte"
|
||||
else
|
||||
ord=$(( [##16] #byte ))
|
||||
url_str+="%$ord"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo -E "$url_str"
|
||||
}
|
||||
|
||||
function open_command() {
|
||||
local open_cmd
|
||||
|
||||
# define the open command
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd='open' ;;
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
|
||||
open_cmd='cmd.exe /c start ""'
|
||||
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||
} ;;
|
||||
msys*) open_cmd='start ""' ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# If a URL is passed, $BROWSER might be set to a local browser within SSH.
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/issues/11098
|
||||
if [[ -n "$BROWSER" && "$1" = (http|https)://* ]]; then
|
||||
"$BROWSER" "$@"
|
||||
return
|
||||
fi
|
||||
|
||||
${=open_cmd} "$@" &>/dev/null
|
||||
}
|
||||
|
||||
if [ -e /home/user/.nix-profile/etc/profile.d/nix.sh ]; then . /home/user/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
|
||||
# Install Ruby Gems to ~/gems
|
||||
export GEM_HOME="$HOME/gems"
|
||||
export PATH="$HOME/gems/bin:$PATH"
|
||||
source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue