stuff
This commit is contained in:
parent
393936517a
commit
1cb1a750de
11 changed files with 43 additions and 628 deletions
|
@ -23,6 +23,6 @@ dotupdate () {
|
|||
popd &>/dev/null
|
||||
}
|
||||
|
||||
themeupdate () { curl -fsSL https://starship.rs/install.sh | bash }
|
||||
themeupdate () { curl -fsSL https://starship.rs/install.sh | bash -s -- --force }
|
||||
|
||||
sheldonup () { curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh | sudo bash -s -- --force --repo rossmacarthur/sheldon --to /usr/local/bin }
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# Find where asdf should be installed
|
||||
ASDF_DIR="${ASDF_DIR:-$ZDOTDIR/plugins/asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
|
||||
# If not found, check for Homebrew package
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
|
||||
ASDF_DIR="$(brew --prefix asdf)"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
|
||||
fi
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
# System clipboard integration
|
||||
#
|
||||
# This file has support for doing system clipboard copy and paste operations
|
||||
# from the command line in a generic cross-platform fashion.
|
||||
#
|
||||
# This is uses essentially the same heuristic as neovim, with the additional
|
||||
# special support for Cygwin.
|
||||
# See: https://github.com/neovim/neovim/blob/e682d799fa3cf2e80a02d00c6ea874599d58f0e7/runtime/autoload/provider/clipboard.vim#L55-L121
|
||||
#
|
||||
# - pbcopy, pbpaste (macOS)
|
||||
# - cygwin (Windows running Cygwin)
|
||||
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
|
||||
# - xclip (if $DISPLAY is set)
|
||||
# - xsel (if $DISPLAY is set)
|
||||
# - lemonade (for SSH) https://github.com/pocke/lemonade
|
||||
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
|
||||
# - win32yank (Windows)
|
||||
# - tmux (if $TMUX is set)
|
||||
#
|
||||
# Defines two functions, clipcopy and clippaste, based on the detected platform.
|
||||
##
|
||||
#
|
||||
# clipcopy - Copy data to clipboard
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# <command> | clipcopy - copies stdin to clipboard
|
||||
#
|
||||
# clipcopy <file> - copies a file's contents to clipboard
|
||||
#
|
||||
##
|
||||
#
|
||||
# clippaste - "Paste" data from clipboard to stdout
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# clippaste - writes clipboard's contents to stdout
|
||||
#
|
||||
# clippaste | <command> - pastes contents and pipes it to another process
|
||||
#
|
||||
# clippaste > <file> - paste contents to a file
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# # Pipe to another process
|
||||
# clippaste | grep foo
|
||||
#
|
||||
# # Paste to a file
|
||||
# clippaste > file.txt
|
||||
#
|
||||
function detect-clipboard() {
|
||||
emulate -L zsh
|
||||
|
||||
if [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
|
||||
function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { xclip -out -selection clipboard; }
|
||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
||||
function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { xsel --clipboard --output; }
|
||||
elif (( ${+commands[lemonade]} )); then
|
||||
function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { lemonade paste; }
|
||||
elif (( ${+commands[doitclient]} )); then
|
||||
function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { doitclient wclip -r; }
|
||||
elif (( ${+commands[win32yank]} )); then
|
||||
function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { win32yank -o; }
|
||||
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
|
||||
function clipcopy() { termux-clipboard-set "${1:-/dev/stdin}"; }
|
||||
function clippaste() { termux-clipboard-get; }
|
||||
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
|
||||
function clipcopy() { tmux load-buffer "${1:--}"; }
|
||||
function clippaste() { tmux save-buffer -; }
|
||||
elif [[ $(uname -r) = *icrosoft* ]]; then
|
||||
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
||||
else
|
||||
function _retry_clipboard_detection_or_fail() {
|
||||
local clipcmd="${1}"; shift
|
||||
if detect-clipboard; then
|
||||
"${clipcmd}" "$@"
|
||||
else
|
||||
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; }
|
||||
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
|
||||
# which is not really an error. If the user calls them, they will attempt to redetect
|
||||
# (for example, perhaps the user has now installed xclip) and then either print an error
|
||||
# or proceed successfully.
|
||||
detect-clipboard || true
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# Ubuntu
|
||||
[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
|
||||
|
||||
# Arch Linux
|
||||
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||
|
||||
# Fedora
|
||||
if [ -f /usr/libexec/pk-command-not-found ]; then
|
||||
command_not_found_handler () {
|
||||
runcnf=1
|
||||
retval=127
|
||||
[ ! -S /var/run/dbus/system_bus_socket ] && runcnf=0
|
||||
[ ! -x /usr/libexec/packagekitd ] && runcnf=0
|
||||
if [ $runcnf -eq 1 ]
|
||||
then
|
||||
/usr/libexec/pk-command-not-found $@
|
||||
retval=$?
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
fi
|
||||
|
||||
# OSX Homebrew
|
||||
# https://github.com/Homebrew/homebrew-command-not-found
|
||||
if [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
|
||||
source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
|
||||
fi
|
||||
|
||||
# NixOS
|
||||
if [ -x /run/current-system/sw/bin/command-not-found ]; then
|
||||
command_not_found_handler () {
|
||||
/run/current-system/sw/bin/command-not-found $@
|
||||
}
|
||||
fi
|
|
@ -1,46 +0,0 @@
|
|||
zmodload -i zsh/complist
|
||||
|
||||
WORDCHARS='-_'
|
||||
|
||||
unsetopt menu_complete
|
||||
unsetopt flowcontrol
|
||||
setopt auto_menu
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
setopt auto_cd
|
||||
setopt multios
|
||||
setopt prompt_subst
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
|
||||
zstyle ':completion:*' use-cache yes
|
||||
zstyle ':completion:*' cache-path "$HOME/.cache/zsh/compcache/"
|
||||
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns '*'
|
||||
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||
zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||
zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost localhost4 localhost6 ip6-localhost broadcasthost megumi _gateway pxm
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' '*localdomain*' '*.eeleater.org' '*sublime*' '*.local'
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
|
||||
|
||||
autoload -U +X bashcompinit
|
||||
bashcompinit
|
|
@ -1,110 +0,0 @@
|
|||
function setup_using_base_dir() {
|
||||
# Declare all variables local not no mess with outside env in any way
|
||||
local fzf_base
|
||||
local fzf_shell
|
||||
local fzfdirs
|
||||
local dir
|
||||
|
||||
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
|
||||
|
||||
if [[ -z "${fzf_base}" ]]; then
|
||||
fzfdirs=(
|
||||
"${HOME}/.fzf"
|
||||
"${HOME}/.nix-profile/share/fzf"
|
||||
"/usr/local/opt/fzf"
|
||||
"/usr/share/fzf"
|
||||
"/usr/local/share/examples/fzf"
|
||||
)
|
||||
for dir in ${fzfdirs}; do
|
||||
if [[ -d "${dir}" ]]; then
|
||||
fzf_base="${dir}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "${fzf_base}" ]]; then
|
||||
if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
|
||||
if [[ -d "${dir}" ]]; then
|
||||
fzf_base="${dir}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -d "${fzf_base}" ]]; then
|
||||
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
|
||||
if [[ ! -d "${fzf_base}/shell" ]]; then
|
||||
fzf_shell="${fzf_base}"
|
||||
else
|
||||
fzf_shell="${fzf_base}/shell"
|
||||
fi
|
||||
|
||||
# Setup fzf binary path
|
||||
if ! (( ${+commands[fzf]} )) && [[ ! "$PATH" == *$fzf_base/bin* ]]; then
|
||||
export PATH="$PATH:$fzf_base/bin"
|
||||
fi
|
||||
|
||||
# Auto-completion
|
||||
if [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
|
||||
[[ $- == *i* ]] && source "${fzf_shell}/completion.zsh" 2> /dev/null
|
||||
fi
|
||||
|
||||
# Key bindings
|
||||
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
|
||||
source "${fzf_shell}/key-bindings.zsh"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function setup_using_debian_package() {
|
||||
(( $+commands[dpkg] )) && dpkg -s fzf &> /dev/null
|
||||
if (( $? )); then
|
||||
# Either not a debian based distro, or no fzf installed. In any case skip ahead
|
||||
return 1
|
||||
fi
|
||||
|
||||
# NOTE: There is no need to configure PATH for debian package, all binaries
|
||||
# are installed to /usr/bin by default
|
||||
|
||||
# Determine completion file path: first bullseye/sid, then buster/stretch
|
||||
local completions="/usr/share/doc/fzf/examples/completion.zsh"
|
||||
[[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
|
||||
|
||||
local key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
|
||||
|
||||
# Auto-completion
|
||||
if [[ $- == *i* ]] && [[ ! "$DISABLE_FZF_AUTO_COMPLETION" == "true" ]]; then
|
||||
source $completions 2> /dev/null
|
||||
fi
|
||||
|
||||
# Key bindings
|
||||
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
|
||||
source $key_bindings
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function indicate_error() {
|
||||
print "[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.\n"\
|
||||
"Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc" >&2
|
||||
}
|
||||
|
||||
# Check for debian package first, because it easy to short cut
|
||||
# Indicate to user that fzf installation not found if nothing worked
|
||||
setup_using_debian_package || setup_using_base_dir || indicate_error
|
||||
|
||||
unset -f setup_using_debian_package setup_using_base_dir indicate_error
|
||||
|
||||
if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
|
||||
if (( $+commands[rg] )); then
|
||||
export FZF_DEFAULT_COMMAND='rg --files --hidden'
|
||||
elif (( $+commands[fd] )); then
|
||||
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
|
||||
elif (( $+commands[ag] )); then
|
||||
export FZF_DEFAULT_COMMAND='ag -l --hidden -g ""'
|
||||
fi
|
||||
fi
|
|
@ -1,123 +0,0 @@
|
|||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
|
||||
|
||||
# Make sure that the terminal is in application mode when zle is active, since
|
||||
# only then values from $terminfo are valid
|
||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init() {
|
||||
echoti smkx
|
||||
}
|
||||
function zle-line-finish() {
|
||||
echoti rmkx
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
# Use emacs key bindings
|
||||
bindkey -e
|
||||
|
||||
# [PageUp] - Up a line of history
|
||||
if [[ -n "${terminfo[kpp]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kpp]}" up-line-or-history
|
||||
bindkey -M viins "${terminfo[kpp]}" up-line-or-history
|
||||
bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history
|
||||
fi
|
||||
|
||||
# [PageDown] - Down a line of history
|
||||
if [[ -n "${terminfo[knp]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[knp]}" down-line-or-history
|
||||
bindkey -M viins "${terminfo[knp]}" down-line-or-history
|
||||
bindkey -M vicmd "${terminfo[knp]}" down-line-or-history
|
||||
fi
|
||||
|
||||
# Start typing + [Up-Arrow] - fuzzy find history forward
|
||||
if [[ -n "${terminfo[kcuu1]}" ]]; then
|
||||
autoload -U up-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
|
||||
bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search
|
||||
fi
|
||||
|
||||
# Start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ -n "${terminfo[kcud1]}" ]]; then
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
|
||||
bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search
|
||||
fi
|
||||
|
||||
# [Home] - Go to beginning of line
|
||||
if [[ -n "${terminfo[khome]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[khome]}" beginning-of-line
|
||||
bindkey -M viins "${terminfo[khome]}" beginning-of-line
|
||||
bindkey -M vicmd "${terminfo[khome]}" beginning-of-line
|
||||
fi
|
||||
|
||||
# [End] - Go to end of line
|
||||
if [[ -n "${terminfo[kend]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kend]}" end-of-line
|
||||
bindkey -M viins "${terminfo[kend]}" end-of-line
|
||||
bindkey -M vicmd "${terminfo[kend]}" end-of-line
|
||||
fi
|
||||
|
||||
# [Shift-Tab] - move through the completion menu backwards
|
||||
if [[ -n "${terminfo[kcbt]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete
|
||||
bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete
|
||||
bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete
|
||||
fi
|
||||
|
||||
# [Backspace] - delete backward
|
||||
bindkey -M emacs '^?' backward-delete-char
|
||||
bindkey -M viins '^?' backward-delete-char
|
||||
bindkey -M vicmd '^?' backward-delete-char
|
||||
|
||||
# [Delete] - delete forward
|
||||
if [[ -n "${terminfo[kdch1]}" ]]; then
|
||||
bindkey -M emacs "${terminfo[kdch1]}" delete-char
|
||||
bindkey -M viins "${terminfo[kdch1]}" delete-char
|
||||
bindkey -M vicmd "${terminfo[kdch1]}" delete-char
|
||||
else
|
||||
bindkey -M emacs "^[[3~" delete-char
|
||||
bindkey -M viins "^[[3~" delete-char
|
||||
bindkey -M vicmd "^[[3~" delete-char
|
||||
|
||||
bindkey -M emacs "^[3;5~" delete-char
|
||||
bindkey -M viins "^[3;5~" delete-char
|
||||
bindkey -M vicmd "^[3;5~" delete-char
|
||||
fi
|
||||
|
||||
# [Ctrl-Delete] - delete whole forward-word
|
||||
bindkey -M emacs '^[[3;5~' kill-word
|
||||
bindkey -M viins '^[[3;5~' kill-word
|
||||
bindkey -M vicmd '^[[3;5~' kill-word
|
||||
|
||||
# [Ctrl-RightArrow] - move forward one word
|
||||
bindkey -M emacs '^[[1;5C' forward-word
|
||||
bindkey -M viins '^[[1;5C' forward-word
|
||||
bindkey -M vicmd '^[[1;5C' forward-word
|
||||
|
||||
# [Ctrl-LeftArrow] - move backward one word
|
||||
bindkey -M emacs '^[[1;5D' backward-word
|
||||
bindkey -M viins '^[[1;5D' backward-word
|
||||
bindkey -M vicmd '^[[1;5D' backward-word
|
||||
|
||||
bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark
|
||||
bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls
|
||||
bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
|
||||
bindkey ' ' magic-space # [Space] - don't do history expansion
|
||||
|
||||
|
||||
# Edit the current command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
||||
|
||||
# file rename magick
|
||||
bindkey "^[m" copy-prev-shell-word
|
|
@ -1,102 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
SITES_DIRECTORY="$HOME/Sites"
|
||||
CONFIG_FILE="./.lando.yml"
|
||||
|
||||
# Enable wp command
|
||||
function wp() {
|
||||
if checkForFile $CONFIG_FILE $SITES_DIRECTORY ; then
|
||||
lando wp "$@"
|
||||
else
|
||||
command wp "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable composer command
|
||||
function composer() {
|
||||
if checkForFile $CONFIG_FILE $SITES_DIRECTORY ; then
|
||||
lando composer "$@"
|
||||
else
|
||||
command composer "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable artisan command
|
||||
function artisan() {
|
||||
if checkForFile $CONFIG_FILE $SITES_DIRECTORY ; then
|
||||
lando artisan "$@"
|
||||
else
|
||||
command artisan "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable yarn command
|
||||
function yarn() {
|
||||
if checkForFile $CONFIG_FILE $SITES_DIRECTORY ; then
|
||||
lando yarn "$@"
|
||||
else
|
||||
command yarn "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable npm command
|
||||
function npm() {
|
||||
if checkForFile $CONFIG_FILE $SITES_DIRECTORY ; then
|
||||
lando npm "$@"
|
||||
else
|
||||
command npm "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# Enable gulp command
|
||||
function gulp() {
|
||||
if checkForFile $CONFIG_FILE $SITES_DIRECTORY ; then
|
||||
lando gulp "$@"
|
||||
else
|
||||
command gulp "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
checkForFile() {
|
||||
local current_directory="$PWD"
|
||||
|
||||
# Bash is backwards. 0 is true 1 (non-zero) is false.
|
||||
flag="1"
|
||||
|
||||
# Only bother checking for lando within the Sites directory.
|
||||
if [[ ":$PWD:" == *":$2"* ]]; then
|
||||
echo "Checking for file: $1 within $2..."
|
||||
|
||||
while true; do
|
||||
if [ $current_directory != "$2" ]; then
|
||||
if [ -f "$current_directory/$1" ]; then
|
||||
return "0"
|
||||
fi
|
||||
current_directory="$(dirname $current_directory)"
|
||||
else
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$flag" == "1" ]]; then
|
||||
echo "Could not find $1 in the current directory or in any of its parents up to $2."
|
||||
fi
|
||||
else
|
||||
echo "Checking for file: $1"
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
echo "Found it"
|
||||
return 0
|
||||
else
|
||||
echo "Not Found"
|
||||
return "1"
|
||||
fi
|
||||
|
||||
if [[ "$flag" == "1" ]]; then
|
||||
echo "Could not find $1."
|
||||
fi
|
||||
fi
|
||||
|
||||
return $flag
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
sudo-command-line() {
|
||||
[[ -z $BUFFER ]] && zle up-history
|
||||
if [[ $BUFFER == sudo\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudo }"
|
||||
elif [[ $BUFFER == $EDITOR\ * ]]; then
|
||||
LBUFFER="${LBUFFER#$EDITOR }"
|
||||
LBUFFER="sudoedit $LBUFFER"
|
||||
elif [[ $BUFFER == sudoedit\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudoedit }"
|
||||
LBUFFER="$EDITOR $LBUFFER"
|
||||
else
|
||||
LBUFFER="sudo $LBUFFER"
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N sudo-command-line
|
||||
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e\e" sudo-command-line
|
||||
bindkey -M vicmd '\e\e' sudo-command-line
|
|
@ -1,44 +0,0 @@
|
|||
function title {
|
||||
emulate -L zsh
|
||||
setopt prompt_subst
|
||||
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
: ${2=$1}
|
||||
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||
print -Pn "\e]2;$2:q\a"
|
||||
print -Pn "\e]1;$1:q\a"
|
||||
;;
|
||||
screen*|tmux*)
|
||||
print -Pn "\ek$1:q\e\\"
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function omz_termsupport_precmd {
|
||||
emulate -L zsh
|
||||
|
||||
title '%15<..<%~%<<' '%n@%m: %~'
|
||||
}
|
||||
|
||||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
70
zsh/rc.zsh
70
zsh/rc.zsh
|
@ -1,46 +1,53 @@
|
|||
export path=($path $HOME/.config/dotfiles/bin)
|
||||
export fpath=($fpath $ZDOTDIR/local/fpath)
|
||||
export FZF_MARKS_FILE=$HOME/.config/fzfmarks
|
||||
export FZF_MARKS_FILE="$HOME/.config/fzfmarks"
|
||||
export STARSHIP_CONFIG="$ZDOTDIR/starship.toml"
|
||||
export ZSH_CACHE_PATH="$HOME/.cache/zsh/compcache/"
|
||||
|
||||
# Stuff
|
||||
setopt auto_cd
|
||||
setopt multios
|
||||
setopt prompt_subst
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
|
||||
mkdir -p $HOME/.cache/zsh
|
||||
|
||||
# Zinit Clone if not exist
|
||||
if [[ ! -f $HOME/.config/zinit/bin/zinit.zsh ]]; then
|
||||
command git clone https://github.com/zdharma/zinit $HOME/.config/zinit/bin
|
||||
fi
|
||||
|
||||
# Zinit
|
||||
declare -A ZINIT
|
||||
ZINIT[BIN_DIR]="$HOME/.config/zinit/bin"
|
||||
ZINIT[HOME_DIR]="$HOME/.config/zinit"
|
||||
ZINIT[ZCOMPDUMP_PATH]="$HOME/.cache/zsh/compdump"
|
||||
|
||||
source $HOME/.config/zinit/bin/zinit.zsh
|
||||
autoload -U +X bashcompinit
|
||||
|
||||
# Theme
|
||||
export STARSHIP_CONFIG=$ZDOTDIR/starship.toml
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
# sharkdp/fd
|
||||
zinit ice as"command" from"gh-r" mv"fd* -> fd" pick"fd/fd"
|
||||
zinit light sharkdp/fd
|
||||
# Programs
|
||||
zinit ice as"program" from"gh-r" mv"fd* -> fd" pick"fd/fd"; zinit light sharkdp/fd
|
||||
zinit ice as"program" from"gh-r" mv"bat* -> bat" pick"bat/bat"; zinit light sharkdp/bat
|
||||
zinit ice as"program" from"gh-r" mv"exa* -> exa"; zinit light ogham/exa
|
||||
zinit ice as"program" from"gh-r" mv"pet* -> pet" pick"usr/local/bin/pet"; zinit light knqyf263/pet
|
||||
|
||||
# sharkdp/bat
|
||||
zinit ice as"command" from"gh-r" mv"bat* -> bat" pick"bat/bat"
|
||||
zinit light sharkdp/bat
|
||||
|
||||
# ogham/exa, replacement for ls
|
||||
zinit ice as"program" from"gh-r" mv"exa* -> exa"
|
||||
zinit light ogham/exa
|
||||
|
||||
# knqyf263/pet, replacement for ls
|
||||
zinit ice as"program" from"gh-r" mv"pet* -> pet" pick"usr/local/bin/pet"
|
||||
zinit light knqyf263/pet
|
||||
|
||||
zinit wait lucid light-mode blockf atpull'zinit creinstall -q .' for zsh-users/zsh-completions
|
||||
zinit wait lucid light-mode atload"_zsh_autosuggest_start" for zsh-users/zsh-autosuggestions
|
||||
# Completions and Autosuggestions
|
||||
zinit ice wait lucid blockf atpull'zinit creinstall -q .'; zinit light zsh-users/zsh-completions
|
||||
zinit ice wait lucid atload"_zsh_autosuggest_start"; zinit light zsh-users/zsh-autosuggestions
|
||||
|
||||
# Needed
|
||||
source $ZDOTDIR/files/dircolor.zsh
|
||||
source $ZDOTDIR/files/aliases.zsh
|
||||
source $ZDOTDIR/files/completion.zsh
|
||||
source $ZDOTDIR/files/history.zsh
|
||||
source $ZDOTDIR/files/direnv.zsh
|
||||
zinit snippet OMZL::functions.zsh
|
||||
zinit snippet OMZL::completion.zsh
|
||||
zinit snippet OMZL::directories.zsh
|
||||
zinit snippet OMZL::key-bindings.zsh
|
||||
zinit snippet OMZL::termsupport.zsh
|
||||
|
@ -51,17 +58,24 @@ zinit snippet OMZP::command-not-found
|
|||
zinit snippet OMZP::fzf
|
||||
zinit snippet OMZP::lando
|
||||
|
||||
#eval "$(fasd --init auto)"
|
||||
zinit wait lucid light-mode for wookayin/fzf-fasd
|
||||
zinit wait lucid light-mode for urbainvaes/fzf-marks
|
||||
zinit wait lucid light-mode for voronkovich/gitignore.plugin.zsh
|
||||
zinit wait lucid light-mode for reegnz/jq-zsh-plugin
|
||||
zinit wait lucid light-mode for @asdf-vm/asdf
|
||||
zinit wait lucid light-mode for Aloxaf/fzf-tab
|
||||
# Completion Stuff
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns '*'
|
||||
#zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' '*localdomain*' '*.eeleater.org'
|
||||
|
||||
eval "$(fasd --init auto)"
|
||||
zinit ice wait lucid; zinit light wookayin/fzf-fasd
|
||||
zinit ice wait lucid; zinit light urbainvaes/fzf-marks
|
||||
zinit ice wait lucid; zinit light voronkovich/gitignore.plugin.zsh
|
||||
zinit ice wait lucid; zinit light reegnz/jq-zsh-plugin
|
||||
zinit ice wait lucid; zinit light asdf-vm/asdf
|
||||
zinit ice wait lucid; zinit light Aloxaf/fzf-tab
|
||||
|
||||
# syntax highlighting
|
||||
zpcompinit
|
||||
zinit wait lucid light-mode atinit"zpcdreplay -q" for zsh-users/zsh-syntax-highlighting
|
||||
bashcompinit
|
||||
zinit ice wait lucid atinit"zpcdreplay -q"; zinit light zsh-users/zsh-syntax-highlighting
|
||||
|
||||
# Local RC
|
||||
[[ -f "$ZDOTDIR/local/rc.zsh" ]] && source "$ZDOTDIR/local/rc.zsh"
|
||||
|
|
Loading…
Add table
Reference in a new issue