Remove legacy shell directory

This commit is contained in:
Marty Oehme 2020-02-01 19:32:10 +01:00
parent bb900a090f
commit c9f0ca46e3
31 changed files with 0 additions and 841 deletions

View file

@ -1,16 +0,0 @@
#!/usr/bin/env sh
# important directories
# will be picked up by vim wiki plugin as root directory
export WIKIROOT="${WIKIROOT:-$HOME/documents/notes}"
export LIBRARYROOT="${LIBRARYROOT:-$HOME/documents/library}"
export BIBFILE="${BIBFILE:-$LIBRARYROOT/academia/academia.bib}"
# these are my personal 'important' environment settings
export EDITOR=nvim
export BROWSER=qutebrowser
export TERMINAL="alacritty"
export FILEREADER="zathura"
export FILEMANAGER="vifm"

View file

@ -1,8 +0,0 @@
#!/bin/sh
# these are mandatory for the shell to work
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
# these are my personal 'important' directories
export XDG_PROJECTS_DIR="$HOME/projects"

View file

@ -1,4 +0,0 @@
#!/bin/sh
export GOPATH="$HOME/projects/gopath/"
export PATH="$PATH:$GOPATH/bin"

View file

@ -1,5 +0,0 @@
#!/bin/sh
# put personal scripts on the PATH to be callable
PATH=$(du "$HOME"/.local/bin | cut -f2 | tr '\n' ':')$PATH
export PATH

View file

@ -1,65 +0,0 @@
# FIXME why is one saved with trailing "/" , the other not?
DEFAULT_NOTES="$HOME/documents/notes"
DEFAULT_LIB="$HOME/documents/library"
DEFAULT_BIB="$DEFAULT_LIB/academia/academia.bib"
setup() {
testfile="$BATS_TEST_DIRNAME/../env-vars.sh"
}
teardown() {
unset WIKIROOT
unset LIBRARYROOT
unset BIBFILE
}
@test "Populates WIKIROOT environment variable" {
source $testfile
[ -n "$WIKIROOT" ]
}
@test "Sets WIKIROOT to correct default path" {
source $testfile
echo $WIKIROOT
[ "$WIKIROOT" = "$DEFAULT_NOTES" ]
}
@test "Leaves WIKIROOT as is if it is already set" {
export WIKIROOT="MY/CUSTOM/DIR"
source $testfile
[ "$WIKIROOT" = "MY/CUSTOM/DIR" ]
}
@test "Populates LIBRARYROOT environment variable" {
source $testfile
[ -n "$LIBRARYROOT" ]
}
@test "Sets LIBRARYROOT to correct default path" {
source $testfile
echo $LIBRARYROOT
[ "$LIBRARYROOT" = "$DEFAULT_LIB" ]
}
@test "Leaves LIBRARYROOT as is if it is already set" {
export LIBRARYROOT="MY/CUSTOM/DIR"
source $testfile
[ "$LIBRARYROOT" = "MY/CUSTOM/DIR" ]
}
@test "Populates BIBFILE environment variable" {
source $testfile
[ -n "$BIBFILE" ]
}
@test "Sets BIBFILE to correct default path" {
source $testfile
echo $BIBFILE
[ "$BIBFILE" = "$DEFAULT_BIB" ]
}
@test "Leaves BIBFILE as is if it is already set" {
export BIBFILE="MY/CUSTOM/DIR"
source $testfile
[ "$BIBFILE" = "MY/CUSTOM/DIR" ]
}

View file

@ -1,37 +0,0 @@
#!/bin/sh
# Prettify ls commands
if [ "$(uname -s)" = "Linux" ]; then
# we're on linux
alias l-d="ls -lFad"
alias l="ls -lAhF" # Overwritten for k in -aliasing-k
alias ll="ls -lFa | TERM=vt100 less"
alias ls='ls --color=auto'
fi
# Show the top 5 commands used in recent history
_zhtop() {
history | awk "{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}" | sort -rn | head
}
alias zhtop=_zhtop
# Display timestamped recent command history
alias zh="fc -l -d -D"
# Display your current ip address
alias myip="curl -s icanhazip.com"
# move around faster for often used cd commands
alias ..="cd .." # overwritten by enhancd config in .zshrc.d/
alias ...="cd ../.."
alias ~="cd ~"
# make v call vim
alias v="vim"
# short, consise, clear my screen
alias cl="clear"
# let me exit out of the shell same way as vim
# TODO integrate session management with w?
alias :q="exit"
alias :wq="exit"

View file

@ -1,83 +0,0 @@
#!/bin/sh
# check for existence of fuzzy finders. If found, substitute fzf with it.
# order is skim > fzy > fzf > nothing
if type sk >/dev/null 2>&1; then
alias fzf=sk
elif type fzy >/dev/null 2>&1; then
alias fzf=fzy
elif type fzf >/dev/null 2>&1; then
alias fzf=fzf
else
echo "[WARNING]: No fuzzy finder found - install skim/fzf/fzy to enable functionality"
fi
# check for existence of greplikes. If found, substitute fzf with it.
# order is skim > fzy > fzf > nothing
if type rg >/dev/null 2>&1; then
alias rg=rg
elif type ag >/dev/null 2>&1; then
alias rg=ag
elif type ack >/dev/null 2>&1; then
alias rg=ack
else
echo "[WARNING]: No grep-like found - install ripgrep/the silver surfer (ag)/ack to enable functionality"
fi
# TODO Allow yanking of urls, c-e to open in editor, preview window with a-p and more
# FZF FILES AND FOLDERS
fzf_cd_weighted() {
cd "$(fasd -d | sk --nth=1 --with-nth=2 --tac | cut -d' ' -f2- | sed 's/^[ \t]*//;s/[\t]*$//')" || echo "cd not successful"
}
fzf_cd_all() {
cd "$(sk --cmd 'find / -type d -not \( -path /proc -prune \)')" || echo "cd not successful"
}
fzf_files_weighted() {
xdg-open "$(fasd -f | sk --nth=1 --with-nth=2 --tac | cut -d' ' -f2- | sed 's/^[ \t]*//;s/[\t]*$//')" || echo "xdg-open not successful"
}
fzf_files_all() {
xdg-open "$(sk --cmd 'find / -type d -not \( -path /proc -prune \)')" || echo "xdg-open not successful"
}
fzf_mru_weighted() {
target="$(fasd -t | sk --nth=1 --with-nth=2 --tac | cut -d' ' -f2- | sed 's/^[ \t]*//;s/[\t]*$//')"
if [ -f "$target" ]; then
xdg-open "$target" || echo "xdg-open not successful"
elif [ -d "$target" ]; then
cd "$target" || echo "cd not successful"
fi
}
# FZF NOTES
fzf_notes() {
sk --cmd "command rg --follow --ignore-case --line-number --color never --no-messages --no-heading --with-filename '' /home/marty/Nextcloud/Notes" --ansi --multi --tiebreak='length,begin' --delimiter=':' --with-nth=3.. --preview='cat {1}' --preview-window=:wrap
}
# FZF BIBTEX REFERENCES
fzf_bibtex() {
target=$(sk --cmd "bibtex-ls -cache $XDG_CACHE_HOME ~/Nextcloud/Library/academia/academia.bib" --ansi --with-nth=.. --preview-window=:wrap --prompt "Citation> " --preview="papis edit -e cat ref=$(echo {} | bibtex-cite | sed 's/^@//')")
papis edit ref="$(echo "$target" | bibtex-cite | sed 's/^@//')"
}
# set up fuzzy file and directory search
alias f=fzf_files_weighted
alias F=fzf_files_all
alias d=fzf_cd_weighted
alias D=fzf_cd_all
alias ru=fzf_mru_weighted
# set up fuzzy bibtex reference search
alias ref=fzf_bibtex
# Display fuzzy-searchable history
alias zhfind="history | fzf --tac --height 20"
# Fuzzy search packages to install
alias fzay="yay -Slq | fzf -m --preview 'yay -Si {1}' | xargs -ro yay -S"
# Fuzzy uninstall packages
alias uzay="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rs"

View file

@ -1,4 +0,0 @@
#!/bin/sh
# Check for existence of nvim command. If found, substitute vim with it.
type nvim >/dev/null 2>&1 && alias vim=nvim

View file

@ -1,8 +0,0 @@
#!/bin/sh
if type wal >/dev/null 2>&1; then
alias sd="wal --theme gruvbox" # grubbox dark
alias sD="wal --theme vscode" # pencil-like dark theme
alias sl="wal --theme base16-gruvbox-medium -l" # pencil-like light theme
alias sL="wal --theme 3024 -l" # pencil-like light theme
fi

View file

@ -1,10 +0,0 @@
#!/bin/sh
# Check for existence of vifm command. If found, substitute vifm with it.
type vifm >/dev/null 2>&1 && alias vm=vifm
# if vifm exists, also let me open current dir in vifm with vmm
type vifm >/dev/null 2>&1 && alias vmm='vifm ${PWD}'
# Check for existence of vifmrun command. If found, substitute vifm with it.
type vifmrun >/dev/null 2>&1 && alias vifm=vifmrun

View file

@ -1,5 +0,0 @@
#!/bin/sh
if [ ! "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then
exec startx "$XDG_CONFIG_HOME"/xresources/xinitrc
fi

View file

@ -1,27 +0,0 @@
#!/bin/sh
# more usage instructions at https://github.com/clvv/fasd
eval "$(fasd --init posix-hook posix_alias bash-hook zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)"
# eval "$(fasd --init auto)"
alias a='fasd -a' # any
alias s='fasd -si' # show / search / select
# alias d='fasd -d' # directory
# alias f='fasd -f' # file
# alias sd='fasd -sid' # interactive directory selection
# alias sf='fasd -sif' # interactive file selection
alias z='fasd_cd -d' # cd, same functionality as j in autojump
alias zz='fasd_cd -d -i' # cd with interactive selection
# from: https://github.com/clvv/fasd/issues/10
# since I can only load auto configuration and have default fasd_cd AND useless aliases
# or manually load the modules and NOT have fasd_cd
# it's easier to use this function
fasd_cd() {
fasd_ret="$(fasd -d "$@")"
if [ -d "$fasd_ret" ]; then
cd "$fasd_ret" || exit
else
print "$fasd_ret"
fi
unset fasd_ret
}

View file

@ -1,6 +0,0 @@
#!/bin/sh
# if wal exists
# Import colorscheme from 'wal' asynchronously
# & # Run the process in the background.
# ( ) # Hide shell job control messages.
type wal >/dev/null 2>&1 && (cat ~/.cache/wal/sequences &)

View file

@ -1,4 +0,0 @@
#!/bin/sh
export LC_ALL="en_US.utf-8"
export LANG="en_US.utf-8"

View file

@ -1,214 +0,0 @@
#!/bin/bash
## Integration at the Bottom
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
#
# Released under one of the versions of the MIT License.
#
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
_LIVE_AGENT_LIST=""
declare -a _LIVE_AGENT_SOCK_LIST
_LIVE_AGENT_SOCK_LIST=()
_debug_print() {
if [[ $_DEBUG -gt 0 ]]; then
printf "%s\n" "$1"
fi
}
find_all_ssh_agent_sockets() {
_SSH_AGENT_SOCKETS=$(find /tmp/ -type s -name agent.\* 2>/dev/null | grep '/tmp/ssh-.*/agent.*')
_debug_print "$_SSH_AGENT_SOCKETS"
}
find_all_gpg_agent_sockets() {
_GPG_AGENT_SOCKETS=$(find /tmp/ -type s -name S.gpg-agent.ssh 2>/dev/null | grep '/tmp/gpg-.*/S.gpg-agent.ssh')
_debug_print "$_GPG_AGENT_SOCKETS"
}
find_all_gnome_keyring_agent_sockets() {
_GNOME_KEYRING_AGENT_SOCKETS=$(find /tmp/ -type s -name "ssh" 2>/dev/null | grep '/tmp/keyring-.*/ssh$')
_debug_print "$_GNOME_KEYRING_AGENT_SOCKETS"
}
find_all_osx_keychain_agent_sockets() {
[[ -n "$TMPDIR" ]] || TMPDIR=/tmp
_OSX_KEYCHAIN_AGENT_SOCKETS=$(find $TMPDIR/ -type s -regex '.*/ssh-.*/agent..*$' 2>/dev/null)
_debug_print "$_OSX_KEYCHAIN_AGENT_SOCKETS"
}
test_agent_socket() {
local SOCKET=$1
SSH_AUTH_SOCK=$SOCKET ssh-add -l 2>/dev/null >/dev/null
result=$?
_debug_print $result
if [[ $result -eq 0 ]]; then
# contactible and has keys loaded
_KEY_COUNT=$(SSH_AUTH_SOCK=$SOCKET ssh-add -l | wc -l | tr -d ' ')
fi
if [[ $result -eq 1 ]]; then
# contactible butno keys loaded
_KEY_COUNT=0
fi
if [ $result -eq 0 ] || [ $result -eq 1 ]; then
if [[ -n "$_LIVE_AGENT_LIST" ]]; then
_LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT"
else
_LIVE_AGENT_LIST="${SOCKET}:$_KEY_COUNT"
fi
return 0
fi
return 1
}
find_live_gnome_keyring_agents() {
for i in $_GNOME_KEYRING_AGENT_SOCKETS; do
test_agent_socket "$i"
done
}
find_live_osx_keychain_agents() {
for i in $_OSX_KEYCHAIN_AGENT_SOCKETS; do
test_agent_socket "$i"
done
}
find_live_gpg_agents() {
for i in $_GPG_AGENT_SOCKETS; do
test_agent_socket "$i"
done
}
find_live_ssh_agents() {
for i in $_SSH_AGENT_SOCKETS; do
test_agent_socket "$i"
done
}
function fingerprints() {
local file="$1"
while read -r l; do
[[ -n $l && ${l###} == "$l" ]] && ssh-keygen -l -f /dev/stdin <<<"$l"
done <"$file"
}
find_all_agent_sockets() {
_SHOW_IDENTITY=0
if [ "$1" = "-i" ]; then
_SHOW_IDENTITY=1
fi
_LIVE_AGENT_LIST=
find_all_ssh_agent_sockets
find_all_gpg_agent_sockets
find_all_gnome_keyring_agent_sockets
find_all_osx_keychain_agent_sockets
find_live_ssh_agents
find_live_gpg_agents
find_live_gnome_keyring_agents
find_live_osx_keychain_agents
_debug_print "$_LIVE_AGENT_LIST"
_LIVE_AGENT_LIST=$(echo $_LIVE_AGENT_LIST | tr ' ' '\n' | sort -n -t: -k 2 -k 1 | uniq)
_LIVE_AGENT_SOCK_LIST=()
_debug_print "SORTED: $_LIVE_AGENT_LIST"
if [[ $_SHOW_IDENTITY -gt 0 ]]; then
i=0
for a in $_LIVE_AGENT_LIST; do
sock=${a/:*/}
_LIVE_AGENT_SOCK_LIST[$i]=$sock
# technically we could have multiple keys forwarded
# But I haven't seen anyone do it
akeys=$(SSH_AUTH_SOCK=$sock ssh-add -l)
fingerprint=$(echo "${akeys}" | awk '{print $2}')
if [ -e ~/.ssh/authorized_keys ]; then
authorized_entry=$(fingerprints ~/.ssh/authorized_keys | grep "$fingerprint")
fi
comment=$(echo "${authorized_entry}" | awk '{print $3,$4,$5,$6,$7}')
printf "export SSH_AUTH_SOCK=%s \t#%i) \t%s\n" "$sock" $((i + 1)) "$comment"
i=$((i + 1))
done
else
printf "%s\n" "$_LIVE_AGENT_LIST" | sed -e 's/ /\n/g' | sort -n -t: -k 2 -k 1
fi
}
set_ssh_agent_socket() {
if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
find_all_agent_sockets -i
if [ -z "$_LIVE_AGENT_LIST" ]; then
echo "No agents found"
return 1
fi
echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? "
read -r choice
if [ -n "$choice" ]; then
n=$((choice - 1))
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ]; then
echo "Invalid choice"
return 1
fi
echo "Setting export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}"
export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}
fi
else
# Choose the first available
SOCK=$(find_all_agent_sockets | tail -n 1 | awk -F: '{print $1}')
if [ -z "$SOCK" ]; then
return 1
fi
export SSH_AUTH_SOCK=$SOCK
fi
# set agent pid
if [ -n "$SSH_AUTH_SOCK" ]; then
export SSH_AGENT_PID=$(($(echo "$SSH_AUTH_SOCK" | cut -d. -f2) + 1))
fi
return 0
}
ssh-find-agent() {
if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
set_ssh_agent_socket -c
return $?
elif [ "$1" = "-a" ] || [ "$1" = "--auto" ]; then
set_ssh_agent_socket
return $?
else
find_all_agent_sockets -i
return 0
fi
}
# Automatically add ssh-agent to any new ssh connection
ssh-find-agent -a
if [ -z "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent)" >/dev/null
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
fi

View file

@ -1,15 +0,0 @@
setup() {
testfile="$BATS_TEST_DIRNAME/../locale-utf-8.sh"
}
teardown() {
export LC_ALL=""
export LANG=""
}
@test "Sets LC_ALL and LANG to en_US.utf-8" {
source $testfile
expected="en_US.utf-8"
[ "$LC_ALL" = "en_US.utf-8" ]
[ "$LANG" = "en_US.utf-8" ]
}

View file

@ -1,28 +0,0 @@
#!/bin/zsh
### Set ZSH History defaults
# set some history options
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_all_dups
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt hist_save_no_dups
setopt hist_verify
# Share your history across all your terminal windows
setopt share_history
#setopt noclobber
# set some more options
setopt pushd_ignore_dups
#setopt pushd_silent
# Keep a ton of history.
export HISTSIZE=100000
export SAVEHIST=100000
HISTFILE=~/.zsh_history
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"

View file

@ -1,16 +0,0 @@
#!/bin/zsh
#
# Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html
globalias() {
if [[ $LBUFFER =~ [A-Z0-9]+$ ]]; then
zle _expand_alias
zle expand-word
fi
zle self-insert
}
zle -N globalias
bindkey " " globalias
bindkey "^ " magic-space # control-space to bypass completion
bindkey -M isearch " " magic-space # normal space during searches

View file

@ -1,123 +0,0 @@
#!/bin/zsh
# Clone zgen if you haven't already
check_zgen_installation() {
if [[ -z "$ZGEN_PARENT_DIR" ]]; then
ZGEN_PARENT_DIR=${XDG_CONFIG_HOME:="$HOME/.config/"}
ZGEN_DIR="$ZGEN_PARENT_DIR/zgen"
fi
if [[ ! -f $ZGEN_DIR/zgen.zsh ]]; then
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
mkdir -p "$ZGEN_PARENT_DIR"
fi
cd "$ZGEN_PARENT_DIR" || return
git clone https://github.com/tarjoilija/zgen.git "$ZGEN_DIR"
fi
# shellcheck source=/home/marty/.config/zgen/zgen.zsh
# shellcheck disable=SC1091
source "$ZGEN_DIR"/zgen.zsh
unset ZGEN_PARENT_DIR
}
load_plugins() {
ZGEN_LOADED=()
ZGEN_COMPLETIONS=()
zgen oh-my-zsh
# If you want to customize your plugin list, create a file named
# .zgen-local-plugins in your home directory. That file will be sourced
# during startup *instead* of running this load-starter-plugin-list function,
# so make sure to include everything from this function that you want to keep.
# If zsh-syntax-highlighting is bundled after zsh-history-substring-search,
# they break, so get the order right.
zgen load zdharma/fast-syntax-highlighting
zgen load zsh-users/zsh-history-substring-search
# Set keystrokes for substring searching
zmodload zsh/terminfo
bindkey "${terminfo[kcuu1]:?}" history-substring-search-up
bindkey "${terminfo[kcud1]:?}" history-substring-search-down
# Automatically run zgen update and zgen selfupdate every 7 days.
zgen load unixorn/autoupdate-zgen
# Warn you when you run a command that you've set an alias for without
# using the alias.
zgen load djui/alias-tips
# Colorize the things if you have grc installed. Well, some of the
# things, anyway.
zgen load unixorn/warhol.plugin.zsh
zgen load chrissicool/zsh-256color
# Add Fish-like autosuggestions to your ZSH.
zgen load zsh-users/zsh-autosuggestions
# Bullet train prompt setup.
zgen load bhilburn/powerlevel9k powerlevel9k
# automatically sources (known/whitelisted) .autoenv.zsh files
# as long as you're in the folder (and can optionally 'unsource' on leaving)
zgen load Tarrasch/zsh-autoenv
# radically enhanced cd command, all sorts of options
zgen load b4b4r07/enhancd
# set up nvm, the npm version manager
zgen load lukechilds/zsh-nvm
# Add git helper scripts.
zgen load unixorn/git-extra-commands
# Tom Limoncelli's tooling for storing private information (keys, etc)
# in a repository securely by encrypting them with gnupg.
zgen load StackExchange/blackbox
# Load some oh-my-zsh plugins
zgen oh-my-zsh plugins/pip
zgen oh-my-zsh plugins/sudo
zgen oh-my-zsh plugins/aws
zgen oh-my-zsh plugins/chruby
zgen oh-my-zsh plugins/colored-man-pages
zgen oh-my-zsh plugins/git
zgen oh-my-zsh plugins/github
zgen oh-my-zsh plugins/python
zgen oh-my-zsh plugins/rsync
zgen oh-my-zsh plugins/screen
zgen oh-my-zsh plugins/vagrant
# check for autojump install before applying plugin
if type autojump >/dev/null 2>&1; then
zgen oh-my-zsh plugins/autojump
fi
zgen oh-my-zsh plugins/tmux
zgen oh-my-zsh plugins/tmuxinator
# when in a directory with vagrant/docker files can use start, stop, up, down
zgen load Cloudstek/zsh-plugin-appup
# Load more completion files for zsh from the zsh-lovers github repo.
zgen load zsh-users/zsh-completions src
# Docker completion
zgen load srijanshetty/docker-zsh
# Very cool plugin that generates zsh completion functions for commands
# if they have getopt-style help text. It doesn't generate them on the fly,
# you'll have to explicitly generate a completion, but it's still quite cool.
zgen load RobSis/zsh-completion-generator
# Tab complete rakefile targets.
zgen load unixorn/rake-completion.zshplugin
# Load me last
GENCOMPL_FPATH=$HOME/.zsh/complete
zgen save
}
check_zgen_installation
if ! zgen saved; then
load_plugins
fi

View file

@ -1,12 +0,0 @@
#!/bin/zsh
# deal with screen, if we're using it - courtesy MacOSXHints.com
# Login greeting ------------------
if [ "$TERM" = "screen" ] && [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then
detached_screens=$(screen -list | grep Detached)
if [ -n "$detached_screens" ]; then
echo "+---------------------------------------+"
echo "| Detached screens are available: |"
echo "$detached_screens"
echo "+---------------------------------------+"
fi
fi

View file

@ -1,12 +0,0 @@
#!/bin/zsh
# Correct spelling for commands
setopt correct
# turn off the infernal correctall for filenames
unsetopt correctall
# Enable command auto-correction.
ENABLE_CORRECTION="true"
# Display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"

View file

@ -1,5 +0,0 @@
#!/bin/zsh
# Long running processes should return time after they complete. Specified
# in seconds.
export REPORTTIME=2
export TIMEFMT="%U user %S system %P cpu %*Es total"

View file

@ -1,42 +0,0 @@
#!/bin/zsh
POWERLEVEL9K_MODE='nerdfont-complete'
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
#POWERLEVEL9K_SHORTEN_DELIMITER=""
#POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right"
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%F{white}"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%F{white} "
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir dir_writable_joined)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time
vcs background_jobs_joined time_joined)
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND="clear"
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND="clear"
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow"
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND="yellow"
POWERLEVEL9K_DIR_HOME_BACKGROUND="clear"
POWERLEVEL9K_DIR_HOME_FOREGROUND="blue"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="clear"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="blue"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND="clear"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="red"
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="clear"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white"
POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red"
POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="white"
POWERLEVEL9K_STATUS_OK_BACKGROUND="clear"
POWERLEVEL9K_STATUS_OK_FOREGROUND="green"
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="clear"
POWERLEVEL9K_STATUS_ERROR_FOREGROUND="red"
POWERLEVEL9K_TIME_BACKGROUND="clear"
POWERLEVEL9K_TIME_FOREGROUND="cyan"
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='clear'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='magenta'
POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND='clear'
POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND='green'
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=250"

View file

@ -1,20 +0,0 @@
#!/bin/zsh
#
# Clone tmux plugin manager if not existing
if [[ -z "$TPM_PARENT_DIR" ]]; then
TPM_PARENT_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/tmux
fi
if [[ ! -f $TPM_PARENT_DIR/plugins/tpm/tpm ]]; then
if [[ ! -d "$TPM_PARENT_DIR" ]]; then
mkdir -p "$TPM_PARENT_DIR"
fi
cd "$TPM_PARENT_DIR" || exit
git clone https://github.com/tmux-plugins/tpm plugins/tpm
fi
export TMUX_PLUGIN_MANAGER_PATH=$TPM_PARENT_DIR/plugins
alias tmux="tmux -f "'"${TPM_PARENT_DIR}"'"/tmux.conf"
unset TPM_PARENT_DIR
unset TPM_SUB_DIR

View file

@ -1,8 +0,0 @@
#!/bin/zsh
# uses exa in detail mode
alias l="exa -l --git --git-ignore"
# shows hidden files
alias L="exa -hal --grid --git"
# a recursive tree - usually want to change levels recused with -L2 -L3 or similar
alias ll="exa --tree -L2"
alias LL="exa -a --tree -L2"

View file

@ -1,5 +0,0 @@
#!/bin/zsh
# mkdir & cd
function mkcd() {
mkdir -p "$@" && cd "$_" || return
}

View file

@ -1,10 +0,0 @@
#!/bin/zsh
# show newest files
# http://www.commandlinefu.com/commands/view/9015/find-the-most-recently-changed-files-recursively
newest() {
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' |
grep -v cache |
grep -v '.hg' | grep -v '.git' |
sort -r |
less
}

View file

@ -1,6 +0,0 @@
#!/bin/zsh
# automatically use tmux whenever we ssh to a server
function ssht() {
ssh "$@" -t 'tmux a || tmux || /bin/bash'
}

View file

@ -1,16 +0,0 @@
#!/bin/zsh
#
# Speed up autocomplete, force prefix mapping
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
# shellcheck disable=SC2016
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'
# Load any custom zsh completions we've installed
if [ -d ~/.zsh-completions ]; then
for completion in ~/.zsh-completions/*; do
# shellcheck source=/dev/null
source "$completion"
done
fi

View file

@ -1,22 +0,0 @@
#!/bin/zsh
# shellcheck disable=SC2206
# shellcheck disable=SC2179
# shellcheck disable=SC2154
# In case a plugin adds a redundant path entry, remove duplicate entries
# from PATH
# from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
get_var() {
eval 'printf "%s\n" "${'"$1"'}"'
}
set_var() {
eval "$1=\"\$2\""
}
dedup_pathvar() {
pathvar_name="$1"
pathvar_value="$(get_var "$pathvar_name")"
deduped_path="$(perl -e 'print join(":",grep { not $seen{$_}++ } split(/:/, $ARGV[0]))' "$pathvar_value")"
set_var "$pathvar_name" "$deduped_path"
}
dedup_pathvar PATH
dedup_pathvar MANPATH

View file

@ -1,5 +0,0 @@
#!/bin/zsh
# Assumes enhancd is installed (via plugin)
# Let's you go back a directory with .. (usual cd .. behavior)
# Let's the enhancd backtrack menu appear with cd .. (usual enhancd behavior)
alias ..="ENHANCD_DISABLE_DOT=1 && cd .. && ENHANCD_DISABLE_DOT=0"