Merge pull request #1 from jonnybarnes/sheldon
Use sheldon to load plugins and source extra commands
This commit is contained in:
commit
8f5db3ada2
22 changed files with 231 additions and 446 deletions
|
|
@ -14,8 +14,8 @@ test -L $HOME/.hushlogin || ln -f -s $BASEDIR/hushlogin $HOME/.hushlogin
|
|||
test -L $HOME/.tmux.conf || ln -f -s $BASEDIR/tmux $HOME/.tmux.conf
|
||||
test -L $HOME/.config/starship.toml || ln -f -s $BASEDIR/starship.toml $HOME/.config/starship.toml
|
||||
test -L $HOME/.config/jmb.omp.toml || ln -f -s $BASEDIR/jmb.omp.toml $HOME/.config/jmb.omp.toml
|
||||
test -d $HOME/.sheldon || mkdir $HOME/.sheldon
|
||||
test -L $HOME/.sheldon/plugins.toml || ln -f -s $BASEDIR/sheldon.toml $HOME/.sheldon/plugins.toml
|
||||
test -d $HOME/.config/sheldon || mkdir $HOME/.config/sheldon
|
||||
test -L $HOME/.config/sheldon/plugins.toml || ln -f -s $BASEDIR/sheldon.toml $HOME/.config/sheldon/plugins.toml
|
||||
test -L $HOME/.zsh || ln -f -s $BASEDIR/zsh $HOME/.zsh
|
||||
test -L $HOME/.zshrc || ln -f -s $BASEDIR/zshrc.zsh $HOME/.zshrc
|
||||
|
||||
|
|
|
|||
11
jmb.omp.toml
11
jmb.omp.toml
|
|
@ -56,8 +56,15 @@ console_title_template = '{{ .Folder }}'
|
|||
always_enabled = true
|
||||
|
||||
[[blocks]]
|
||||
type = 'prompt'
|
||||
alignment = 'right'
|
||||
type = 'rprompt'
|
||||
alignment = 'left'
|
||||
|
||||
[[blocks.segments]]
|
||||
type = "text"
|
||||
style = "plain"
|
||||
foreground = "black"
|
||||
background = "transparent"
|
||||
template = "{{ if .Env.SHELL_LOADING }} loading {{ end }}"
|
||||
|
||||
[[blocks.segments]]
|
||||
type = "executiontime"
|
||||
|
|
|
|||
102
sheldon.toml
102
sheldon.toml
|
|
@ -1,25 +1,57 @@
|
|||
# `sheldon` configuration file
|
||||
# ----------------------------
|
||||
# Sheldon configuration file
|
||||
#
|
||||
# You can modify this file directly or you can use one of the following
|
||||
# `sheldon` commands which are provided to assist in editing the config file:
|
||||
# See https://sheldon.cli.rs
|
||||
#
|
||||
# - `sheldon add` to add a new plugin to the config file
|
||||
# - `sheldon edit` to open up the config file in the default editor
|
||||
# - `sheldon remove` to remove a plugin from the config file
|
||||
#
|
||||
# See the documentation for more https://github.com/rossmacarthur/sheldon#readme
|
||||
# Also heavily inspired by https://github.com/rossmacarthur/dotfiles/tree/trunk
|
||||
|
||||
shell = "zsh"
|
||||
|
||||
[templates]
|
||||
defer = { value = 'zsh-defer source "{{ file }}"', each = true }
|
||||
defer = """{{ hooks?.pre | nl }}{% for file in files %}zsh-defer source "{{ file }}"\n{% endfor %}{{ hooks?.post | nl }}"""
|
||||
defer-more = """{{ hooks?.pre | nl }}{% for file in files %}zsh-defer -t 0.5 source "{{ file }}"\n{% endfor %}{{ hooks?.post | nl }}"""
|
||||
|
||||
[plugins]
|
||||
# Loading indicator
|
||||
# -----------------
|
||||
|
||||
[plugins.show]
|
||||
local = "~/.zsh/plugins/loading"
|
||||
|
||||
# Completions
|
||||
# -----------
|
||||
|
||||
[plugins.zsh-completions]
|
||||
github = "zsh-users/zsh-completions"
|
||||
|
||||
# Sourced
|
||||
# -------
|
||||
|
||||
[plugins.zsh-defer]
|
||||
github = "romkatv/zsh-defer"
|
||||
|
||||
[plugins.iterm2-shell-integration]
|
||||
remote = "https://iterm2.com/shell_integration/zsh"
|
||||
|
||||
# Some of the functions may get used elsewhere
|
||||
# so we do not defer loading
|
||||
[plugins.functions]
|
||||
local = "~/.zsh/plugins"
|
||||
|
||||
# Deferred plugins
|
||||
# ----------------
|
||||
|
||||
[plugins.aliases]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.fzf]
|
||||
github = "junegunn/fzf"
|
||||
use = ["shell/completion.zsh", "shell/key-bindings.zsh"]
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.fzf-completions]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.zsh-syntax-highlighting]
|
||||
github = "zsh-users/zsh-syntax-highlighting"
|
||||
apply = ["defer"]
|
||||
|
|
@ -32,3 +64,51 @@ apply = ["defer"]
|
|||
github = "zsh-users/zsh-autosuggestions"
|
||||
apply = ["defer"]
|
||||
use = ["{{ name }}.zsh"]
|
||||
|
||||
[plugins.zsh-you-should-use]
|
||||
github = "MichaelAquilina/zsh-you-should-use"
|
||||
apply = ["defer"]
|
||||
hooks.pre = "export YSU_MODE=ALL"
|
||||
|
||||
[plugins.forgit]
|
||||
github = "wfxr/forgit"
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.fnm]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.zoxide]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.mcfly]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
[plugins.thefuck]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
# This works best if it is placed last.
|
||||
[plugins.compinit]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer"]
|
||||
|
||||
# Plugins that are even more deferred
|
||||
# -----------------------------------
|
||||
|
||||
[plugins.github-copilot]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer-more"]
|
||||
|
||||
[plugins.ngrok]
|
||||
local = "~/.zsh/plugins"
|
||||
apply = ["defer-more"]
|
||||
|
||||
# Loading indicator
|
||||
# -----------------
|
||||
|
||||
[plugins.hide]
|
||||
local = "~/.zsh/plugins/loading"
|
||||
apply = ["defer-more"]
|
||||
|
|
|
|||
212
starship.toml
212
starship.toml
|
|
@ -1,212 +0,0 @@
|
|||
command_timeout = 1000
|
||||
|
||||
# Copied from https://github.com/wintermi/zsh-starship/blob/main/theme/starship.toml
|
||||
|
||||
format = """
|
||||
$os\
|
||||
[\uE0B0](fg:bar_one bg:bar_two)\
|
||||
$custom$directory\
|
||||
[\uE0B0](fg:bar_two bg:bar_three)\
|
||||
$git_branch\
|
||||
$git_status\
|
||||
[\uE0B0](fg:bar_three bg:bar_four)\
|
||||
$c\
|
||||
$dart\
|
||||
$elixir\
|
||||
$elm\
|
||||
$golang\
|
||||
$haskell\
|
||||
$java\
|
||||
$julia\
|
||||
$lua\
|
||||
$nodejs\
|
||||
$nim\
|
||||
$php\
|
||||
$python\
|
||||
$rlang\
|
||||
$ruby\
|
||||
$rust\
|
||||
$scala\
|
||||
[\uE0B0](fg:bar_four)\
|
||||
"""
|
||||
|
||||
right_format = """
|
||||
$cmd_duration\
|
||||
"""
|
||||
|
||||
palette = 'theme'
|
||||
|
||||
# Defines the colour palette for the theme
|
||||
[palettes.theme]
|
||||
bar_one = '#C0CAF5'
|
||||
bar_two = '#6992D7'
|
||||
bar_three = '#394260'
|
||||
bar_four = '#212736'
|
||||
bar_five = '#1D2230'
|
||||
text_one = '#090C0C'
|
||||
text_two = '#EEEEEE'
|
||||
text_three = '#A3AED2'
|
||||
|
||||
[os]
|
||||
style = 'bg:bar_one fg:text_one'
|
||||
format = '[ $symbol ]($style)'
|
||||
disabled = false
|
||||
|
||||
[os.symbols]
|
||||
Alpine = ''
|
||||
Amazon = ''
|
||||
Android = ''
|
||||
Arch = ''
|
||||
CentOS = ''
|
||||
Debian = ''
|
||||
DragonFly = ''
|
||||
Emscripten = ''
|
||||
EndeavourOS = ''
|
||||
Fedora = ''
|
||||
FreeBSD = ''
|
||||
Garuda = ''
|
||||
Gentoo = ''
|
||||
HardenedBSD = ''
|
||||
Illumos = ''
|
||||
Linux = ''
|
||||
Macos = ''
|
||||
Manjaro = ''
|
||||
Mariner = ''
|
||||
MidnightBSD = ''
|
||||
Mint = ''
|
||||
NetBSD = ''
|
||||
NixOS = ''
|
||||
OpenBSD = ''
|
||||
SUSE = ''
|
||||
OracleLinux = ''
|
||||
Pop = ''
|
||||
Raspbian = ''
|
||||
Redhat = ''
|
||||
RedHatEnterprise = ''
|
||||
Redox = ''
|
||||
Solus = ''
|
||||
openSUSE = ''
|
||||
Ubuntu = ''
|
||||
Unknown = ''
|
||||
Windows = ''
|
||||
|
||||
[directory]
|
||||
truncation_length = 0
|
||||
truncation_symbol = '…/'
|
||||
truncate_to_repo = false
|
||||
fish_style_pwd_dir_length = 1
|
||||
style = 'bold fg:text_two bg:bar_two'
|
||||
format = '[ $path ]($style)'
|
||||
|
||||
[custom.home]
|
||||
when = ' test "$HOME" = "$PWD" '
|
||||
style = 'bold fg:text_two bg:bar_two'
|
||||
symbol = ' '
|
||||
|
||||
[custom.folder]
|
||||
when = ' test "$HOME" != "$PWD" '
|
||||
style = 'bold fg:text_two bg:bar_two'
|
||||
symbol = ' '
|
||||
|
||||
[directory.substitutions]
|
||||
'Documents' = ' '
|
||||
'Downloads' = ' '
|
||||
'Music' = ' '
|
||||
'Pictures' = ' '
|
||||
|
||||
[git_branch]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_three'
|
||||
format = '[ $symbol $branch ]($style)'
|
||||
|
||||
[git_status]
|
||||
style = 'fg:text_three bg:bar_three'
|
||||
format = '[$all_status$ahead_behind ]($style)'
|
||||
|
||||
[c]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[dart]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[elixir]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[elm]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[golang]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[haskell]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[java]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[julia]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[lua]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[nodejs]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[nim]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[php]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[python]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[rlang]
|
||||
symbol = 'ﳒ '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[ruby]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[rust]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[scala]
|
||||
symbol = ' '
|
||||
style = 'fg:text_three bg:bar_four'
|
||||
format = '[ $symbol ($version) ]($style)'
|
||||
|
||||
[cmd_duration]
|
||||
style = 'bold red'
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# aliases.zsh
|
||||
|
||||
alias auao="sudo apt update && apt list --upgradable"
|
||||
alias aupg="sudo apt upgrade"
|
||||
alias aurup="sudo aura -Akua"
|
||||
alias bubc="brew upgrade && brew cleanup"
|
||||
alias bubo="brew update && brew outdated"
|
||||
test $PLATFORM = 'osx' && alias brewcurl="/usr/local/opt/curl/bin/curl --cacert /usr/local/etc/openssl@1.1/cert.pem"
|
||||
test $PLATFORM = 'osx-m1' && alias brewcurl="/opt/homebrew/opt/curl/bin/curl"
|
||||
test $PLATFORM = 'osx' && alias brewssl="/usr/local/opt/openssl@1.1/bin/openssl"
|
||||
alias ga="git add"
|
||||
alias gf="git fetch --all; git fetch --tags"
|
||||
alias gs="git status"
|
||||
alias gb="git rev-parse --abbrev-ref HEAD"
|
||||
alias irc="ssh jmb -t '. ~/.zshrc; tmux attach -t irc'"
|
||||
test $PLATFORM = 'linux' && alias ls="ls -F --color=always"
|
||||
test $PLATFORM = 'osx' && alias ls="ls -FG"
|
||||
test $PLATFORM = 'osx-m1' && alias ls="ls -FG"
|
||||
test $PLATFORM = 'linux' && alias pipup="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo pip install -U"
|
||||
test $PLATFORM = 'osx' && alias pipup="pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U"
|
||||
test $PLATFORM = 'osx-m1' && alias pipup="pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U"
|
||||
alias rtor="tmux attach -t rtor"
|
||||
alias startace="acestreamengine --client-console --upload-limit 0 --download-limit 0"
|
||||
alias up="sudo pacman -Syu"
|
||||
alias aws-whoami="aws sts get-caller-identity"
|
||||
alias als="eza --oneline --long --classify --icons --header"
|
||||
alias sail="[ -f sail ] && bash sail || bash vendor/bin/sail"
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
export PLATFORM="unkown"
|
||||
|
||||
osname=$(uname -s)
|
||||
cputype=$(uname -m)
|
||||
|
||||
if [[ "$osname" == 'Linux' ]]; then
|
||||
export PLATFORM="linux"
|
||||
elif [[ "$osname" == 'Darwin' ]]; then
|
||||
if [[ "$cputpye" == 'x86_64' ]]; then
|
||||
export PLATFORM="osx"
|
||||
elif [[ "$cputype" == 'arm64' ]]; then
|
||||
export PLATFORM="osx-m1"
|
||||
fi
|
||||
fi
|
||||
17
zsh/plugins/aliases.plugin.zsh
Normal file
17
zsh/plugins/aliases.plugin.zsh
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Homebrew commands
|
||||
alias bubc="brew upgrade && brew cleanup"
|
||||
alias bubo="brew update && brew outdated"
|
||||
|
||||
# See which user or profile we are authneticated as in aws-cli
|
||||
alias aws-whoami="aws sts get-caller-identity"
|
||||
|
||||
# Use eza instead of ls
|
||||
alias als="eza --oneline --long --classify --icons --header"
|
||||
|
||||
# Laravel Sail
|
||||
alias sail="[ -f sail ] && bash sail || bash vendor/bin/sail"
|
||||
|
||||
# Add git aliases
|
||||
alias gs="git status"
|
||||
37
zsh/plugins/compinit.plugin.zsh
Normal file
37
zsh/plugins/compinit.plugin.zsh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Load all stock functions (from $fpath files) called below.
|
||||
autoload -U compaudit compinit
|
||||
|
||||
# Figure out the SHORT hostname
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
||||
else
|
||||
SHORT_HOST=${HOST/.*/}
|
||||
fi
|
||||
|
||||
# Save the location of the current completion dump file.
|
||||
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||
|
||||
# Construct zcompdump metadata, we will rebuild the Zsh compdump if either
|
||||
# this file changes or the fpath changes.
|
||||
zcompdump_revision="#revision: $(sha1sum $0:A)"
|
||||
zcompdump_fpath="#fpath: $fpath"
|
||||
|
||||
# Delete the zcompdump file if zcompdump metadata changed
|
||||
if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \
|
||||
|| ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
|
||||
command rm -f "$ZSH_COMPDUMP"
|
||||
zcompdump_refresh=1
|
||||
fi
|
||||
|
||||
# If the user wants it, load from all found directories
|
||||
compinit -u -C -d "${ZSH_COMPDUMP}"
|
||||
|
||||
# Append zcompdump metadata if missing
|
||||
if (( $zcompdump_refresh )); then
|
||||
echo "\n$zcompdump_revision\n$zcompdump_fpath" >>! "$ZSH_COMPDUMP"
|
||||
fi
|
||||
|
||||
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
|
||||
6
zsh/plugins/fnm.plugin.zsh
Normal file
6
zsh/plugins/fnm.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Setup Fast Node Manager
|
||||
if (( ${+commands[fnm]} )); then
|
||||
eval "$(fnm env --use-on-cd)"
|
||||
fi
|
||||
120
zsh/plugins/functions.plugin.zsh
Normal file
120
zsh/plugins/functions.plugin.zsh
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Functions
|
||||
|
||||
# Delete branches selected via fzf
|
||||
function delete-branches() {
|
||||
git branch |
|
||||
grep --invert-match '\*' | # Remove current branch
|
||||
fzf --multi --preview="git log {..}" |
|
||||
gxargs --no-run-if-empty git branch --delete
|
||||
}
|
||||
|
||||
# Delete branches selected via fzf (force the deletion)
|
||||
function delete-branches-force() {
|
||||
git branch |
|
||||
grep --invert-match '\*' | # Remove current branch
|
||||
fzf --multi --preview="git log {..}" |
|
||||
gxargs --no-run-if-empty git branch --delete --force
|
||||
}
|
||||
|
||||
# Open a PR
|
||||
function pr-checkout() {
|
||||
local pr_number
|
||||
|
||||
pr_number=$(
|
||||
gh api 'repos/:owner/:repo/pulls' --jq '.[] | "#\(.number) \(.title)"' |
|
||||
fzf |
|
||||
sd '^\#(\d+)\s.*' '$1'
|
||||
)
|
||||
|
||||
if [ -n "$pr_number" ]; then
|
||||
gh pr checkout "$pr_number"
|
||||
fi
|
||||
}
|
||||
|
||||
# tail, but better
|
||||
function watch-file() {
|
||||
tail -f $1 | bat --paging=never -l log
|
||||
}
|
||||
|
||||
# Get a temporary directory in a cross-platform manner
|
||||
# See https://unix.stackexchange.com/a/685873
|
||||
function get-temporary-directory() {
|
||||
local temporary_directory=${XDG_RUNTIME_DIR:-${TMPDIR:-${TMP:-${TEMP:-/tmp}}}}
|
||||
|
||||
echo $temporary_directory
|
||||
}
|
||||
|
||||
# Start an SSH SOCKS tunnel
|
||||
function start-proxy() {
|
||||
if [ -z "$SSH_PROXY_HOST" ]; then
|
||||
echo "SSH_PROXY_HOST is not set or empty"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
local socket_dir=$(get-temporary-directory)
|
||||
|
||||
# Check if the last character of socket_dir is a directory separator character
|
||||
if [[ $socket_dir[-1] == / ]]; then
|
||||
# If yes, remove the directory separator character
|
||||
socket_dir="${socket_dir%?}"
|
||||
fi
|
||||
|
||||
echo "Opening proxy connection"
|
||||
|
||||
# Below we use -S and -M to help make closing the connection more reliable
|
||||
# See this Stack Overflow answer for more info
|
||||
# https://unix.stackexchange.com/a/525388
|
||||
|
||||
# -D 1337 opens up the SOXKS tunnel on localhost:1337
|
||||
# -f Tells `ssh` to fork the ssh process in to the background
|
||||
# -C Enables compression of data on the connections
|
||||
# -q Uses quiet mode
|
||||
# -N Do not execute a remote command on this connection
|
||||
# -S Set the ControlPath for this connection
|
||||
# -M Place the client into `master` mode
|
||||
ssh -D 1337 -f -C -q -N -S $socket_dir/ssh-proxy-control -M $SSH_PROXY_HOST
|
||||
}
|
||||
|
||||
# Stop an open proxy connection
|
||||
function stop-proxy() {
|
||||
if [ -z "$SSH_PROXY_HOST" ]; then
|
||||
echo "SSH_PROXY_HOST is not set or empty"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
local socket_dir=$(get-temporary-directory)
|
||||
|
||||
# Check if the last character of socket_dir is a directory separator character
|
||||
if [[ $socket_dir[-1] == / ]]; then
|
||||
# If yes, remove the directory separator character
|
||||
socket_dir="${socket_dir%?}"
|
||||
fi
|
||||
|
||||
echo "Closing proxy connection"
|
||||
|
||||
# See the comments in `start-proxy()` for more info
|
||||
ssh -S $socket_dir/ssh-proxy-control -O exit $SSH_PROXY_HOST
|
||||
}
|
||||
|
||||
# Get the system appearance
|
||||
function get-system-appearance() {
|
||||
if ! type defaults &>/dev/null; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
local darkMode=true;
|
||||
|
||||
if [[ $(defaults read -g AppleInterfaceStyle 2> /dev/null) != 'Dark' ]]; then
|
||||
darkMode=false
|
||||
fi
|
||||
|
||||
if [[ $darkMode == true ]]; then
|
||||
echo "dark"
|
||||
else
|
||||
echo "light"
|
||||
fi
|
||||
}
|
||||
12
zsh/plugins/fzf-completions.plugin.zsh
Normal file
12
zsh/plugins/fzf-completions.plugin.zsh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# cURL completions copied from https://blog.revathskumar.com/2024/02/curl-fuzzy-search-options-using-fzf.html
|
||||
_fzf_complete_curl() {
|
||||
_fzf_complete --header-lines=1 --prompt="curl> " -- "$@" < <(
|
||||
curl -h all
|
||||
)
|
||||
}
|
||||
|
||||
_fzf_complete_curl_post() {
|
||||
awk '{print $1}' | cut -d ',' -f -1
|
||||
}
|
||||
10
zsh/plugins/github-copilot.plugin.zsh
Normal file
10
zsh/plugins/github-copilot.plugin.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Setup GitHub Copilot
|
||||
# first check we even have the genereic `gh` command
|
||||
if (( ${+commands[gh]} )); then
|
||||
# Now check we have the copilot plugin installed with `gh`
|
||||
if gh extension list | rg copilot -c > /dev/null; then
|
||||
eval "$(gh copilot alias -- zsh)"
|
||||
fi
|
||||
fi
|
||||
4
zsh/plugins/loading/hide.plugin.zsh
Normal file
4
zsh/plugins/loading/hide.plugin.zsh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Hide the loading indicator
|
||||
unset SHELL_LOADING
|
||||
4
zsh/plugins/loading/show.plugin.zsh
Normal file
4
zsh/plugins/loading/show.plugin.zsh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Show the loading indicator
|
||||
export SHELL_LOADING=true
|
||||
6
zsh/plugins/mcfly.plugin.zsh
Normal file
6
zsh/plugins/mcfly.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# McFly
|
||||
if (( ${+commands[mcfly]} )); then
|
||||
eval "$(mcfly init zsh)"
|
||||
fi
|
||||
6
zsh/plugins/ngrok.plugin.zsh
Normal file
6
zsh/plugins/ngrok.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# ngrok completions
|
||||
if (( ${+commands[ngrok]} )); then
|
||||
eval "$(ngrok completion)"
|
||||
fi
|
||||
6
zsh/plugins/thefuck.plugin.zsh
Normal file
6
zsh/plugins/thefuck.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Init the fuck
|
||||
if (( ${+commands[thefuck]} )); then
|
||||
eval "$(thefuck --alias)"
|
||||
fi
|
||||
6
zsh/plugins/zoxide.plugin.zsh
Normal file
6
zsh/plugins/zoxide.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# zoxide - a better `cd` command
|
||||
if (( ${+commands[zoxide]} )); then
|
||||
eval "$(zoxide init zsh)"
|
||||
fi
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# ZSH autosuggestions
|
||||
test -e /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh \
|
||||
&& source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
test -e /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh \
|
||||
&& source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
test -e /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh \
|
||||
&& source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
# ZSH substring search
|
||||
bindKeysZshHistoryMacOS() {
|
||||
zmodload zsh/terminfo
|
||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
}
|
||||
bindKeysZshHistoryLinux() {
|
||||
zmodload zsh/terminfo
|
||||
bindkey "$terminfo[cuu1]" history-substring-search-up
|
||||
bindkey "$terminfo[cud1]" history-substring-search-down
|
||||
}
|
||||
test -e /usr/local/opt/zsh-history-substring-search/zsh-history-substring-search.zsh \
|
||||
&& source /usr/local/opt/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
test -e /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh \
|
||||
&& source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
test -e /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh \
|
||||
&& source /opt/homebrew/share/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
test $PLATFORM = 'osx' && bindKeysZshHistoryMacOS
|
||||
test $PLATFORM = 'osx-m1' && bindKeysZshHistoryMacOS
|
||||
test $PLATFORM = 'linux' && bindKeysZshHistoryLinux
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue