Merge branch 'fix-ci-linting' into 'master'

Fix ci linting

See merge request marty-oehme/dotfiles!16
This commit is contained in:
Marty Oehme 2019-07-24 09:47:15 +00:00
commit e4f444cfe5
30 changed files with 325 additions and 309 deletions

View file

@ -274,11 +274,13 @@ let g:ale_fixers = {
\'*': ['remove_trailing_lines', 'trim_whitespace'], \'*': ['remove_trailing_lines', 'trim_whitespace'],
\'go': ['gofmt'], \'go': ['gofmt'],
\'sh': ['shfmt'], \'sh': ['shfmt'],
\'zsh': ['shfmt'],
\} \}
let g:ale_linters = { let g:ale_linters = {
\ 'go': ['gopls'], \ 'go': ['gopls'],
\ 'sh': ['language_server','shellcheck'], \ 'sh': ['language_server','shellcheck'],
\ 'zsh': ['language_server','shellcheck'],
\} \}
" PLUGIN: AIRLINE " PLUGIN: AIRLINE

View file

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

View file

@ -1,3 +1,4 @@
# //FIXME this needs to get the hell out of here -> put it in an env loading file #!/bin/sh
export GOPATH="$HOME/projects/gopath/" export GOPATH="$HOME/projects/gopath/"
export PATH="$PATH:$GOPATH/bin" export PATH="$PATH:$GOPATH/bin"

View file

@ -1,3 +1,5 @@
#!/bin/sh
# these are mandatory for the shell to work # these are mandatory for the shell to work
export XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache" export XDG_CACHE_HOME="$HOME/.cache"

View file

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

View file

@ -1,5 +1,7 @@
#!/bin/sh
# Prettify ls commands # Prettify ls commands
if [[ "$(uname -s)" == "Linux" ]]; then if [ "$(uname -s)" = "Linux" ]; then
# we're on linux # we're on linux
alias l-d="ls -lFad" alias l-d="ls -lFad"
alias l="ls -lAhF" # Overwritten for k in -aliasing-k alias l="ls -lAhF" # Overwritten for k in -aliasing-k
@ -8,7 +10,10 @@ if [[ "$(uname -s)" == "Linux" ]]; then
fi fi
# Show the top 5 commands used in recent history # Show the top 5 commands used in recent history
alias zhtop="history | awk '{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}' | sort -rn | head" _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 # Display timestamped recent command history
alias zh="fc -l -d -D" alias zh="fc -l -d -D"
@ -28,5 +33,5 @@ alias cl="clear"
# let me exit out of the shell same way as vim # let me exit out of the shell same way as vim
# TODO integrate session management with w? # TODO integrate session management with w?
alias ":q"="exit" alias :q="exit"
alias ":wq"="exit" alias :wq="exit"

View file

@ -1,3 +1,5 @@
#!/bin/sh
# enables git management through dot command # enables git management through dot command
alias dot='/usr/bin/git --git-dir=/home/marty/.dotfiles/ --work-tree=/home/marty' alias dot='/usr/bin/git --git-dir=/home/marty/.dotfiles/ --work-tree=/home/marty'

View file

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
# more usage instructions at https://github.com/clvv/fasd # more usage instructions at https://github.com/clvv/fasd
eval "$(fasd --init auto)" eval "$(fasd --init auto)"

View file

@ -27,8 +27,8 @@ else
fi fi
# set up fuzzy file and directory search # set up fuzzy file and directory search
alias f="fzf -c 'find . -type f' --preview='head -$LINES {}' | xargs xdg-open" alias f="fzf -c 'find . -type f' --preview='"'head -$LINES {}'"' | xargs -0 xdg-open"
alias F="fzf -c 'find ~ -type f' --preview='head -$LINES {}' | xargs xdg-open" alias F="fzf -c 'find ~ -type f' --preview='"'head -$LINES {}'"' | xargs -0 xdg-open"
alias d="fzf -c 'find . -type d' --preview='ls --color='always' {}' | cd" alias d="fzf -c 'find . -type d' --preview='ls --color='always' {}' | cd"
alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | cd" alias D="fzf -c 'find ~ -type d' --preview='ls --color='always' {}' --color=dark --ansi | cd"

View file

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

View file

@ -2,4 +2,4 @@
# set wiki root to nextcloud notes folder, # set wiki root to nextcloud notes folder,
# will be picked up by vim wiki plugin as root # will be picked up by vim wiki plugin as root
export WIKIROOT='~/Nextcloud/Notes/' export WIKIROOT="$HOME/Nextcloud/Notes/"

View file

@ -1,3 +1,5 @@
#!/bin/bash
## Integration at the Bottom ## Integration at the Bottom
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com> # Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
@ -29,204 +31,184 @@ declare -a _LIVE_AGENT_SOCK_LIST
_LIVE_AGENT_SOCK_LIST=() _LIVE_AGENT_SOCK_LIST=()
_debug_print() { _debug_print() {
if [[ $_DEBUG -gt 0 ]] if [[ $_DEBUG -gt 0 ]]; then
then printf "%s\n" "$1"
printf "%s\n" $1 fi
fi
} }
find_all_ssh_agent_sockets() { find_all_ssh_agent_sockets() {
_SSH_AGENT_SOCKETS=`find /tmp/ -type s -name agent.\* 2> /dev/null | grep '/tmp/ssh-.*/agent.*'` _SSH_AGENT_SOCKETS=$(find /tmp/ -type s -name agent.\* 2>/dev/null | grep '/tmp/ssh-.*/agent.*')
_debug_print "$_SSH_AGENT_SOCKETS" _debug_print "$_SSH_AGENT_SOCKETS"
} }
find_all_gpg_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'` _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" _debug_print "$_GPG_AGENT_SOCKETS"
} }
find_all_gnome_keyring_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$'` _GNOME_KEYRING_AGENT_SOCKETS=$(find /tmp/ -type s -name "ssh" 2>/dev/null | grep '/tmp/keyring-.*/ssh$')
_debug_print "$_GNOME_KEYRING_AGENT_SOCKETS" _debug_print "$_GNOME_KEYRING_AGENT_SOCKETS"
} }
find_all_osx_keychain_agent_sockets() { find_all_osx_keychain_agent_sockets() {
[[ -n "$TMPDIR" ]] || TMPDIR=/tmp [[ -n "$TMPDIR" ]] || TMPDIR=/tmp
_OSX_KEYCHAIN_AGENT_SOCKETS=`find $TMPDIR/ -type s -regex '.*/ssh-.*/agent..*$' 2> /dev/null` _OSX_KEYCHAIN_AGENT_SOCKETS=$(find $TMPDIR/ -type s -regex '.*/ssh-.*/agent..*$' 2>/dev/null)
_debug_print "$_OSX_KEYCHAIN_AGENT_SOCKETS" _debug_print "$_OSX_KEYCHAIN_AGENT_SOCKETS"
} }
test_agent_socket() { test_agent_socket() {
local SOCKET=$1 local SOCKET=$1
SSH_AUTH_SOCK=$SOCKET ssh-add -l 2> /dev/null > /dev/null SSH_AUTH_SOCK=$SOCKET ssh-add -l 2>/dev/null >/dev/null
result=$? result=$?
_debug_print $result _debug_print $result
if [[ $result -eq 0 ]] if [[ $result -eq 0 ]]; then
then # contactible and has keys loaded
# contactible and has keys loaded _KEY_COUNT=$(SSH_AUTH_SOCK=$SOCKET ssh-add -l | wc -l | tr -d ' ')
_KEY_COUNT=`SSH_AUTH_SOCK=$SOCKET ssh-add -l | wc -l | tr -d ' '` fi
fi
if [[ $result -eq 1 ]] if [[ $result -eq 1 ]]; then
then # contactible butno keys loaded
# contactible butno keys loaded _KEY_COUNT=0
_KEY_COUNT=0 fi
fi
if [[ ( ( $result -eq 0 ) || ( $result -eq 1 ) ) ]] if [ $result -eq 0 ] || [ $result -eq 1 ]; then
then if [[ -n "$_LIVE_AGENT_LIST" ]]; then
if [[ -n "$_LIVE_AGENT_LIST" ]] _LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT"
then else
_LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT" _LIVE_AGENT_LIST="${SOCKET}:$_KEY_COUNT"
else fi
_LIVE_AGENT_LIST="${SOCKET}:$_KEY_COUNT" return 0
fi fi
return 0
fi
return 1 return 1
} }
find_live_gnome_keyring_agents() { find_live_gnome_keyring_agents() {
for i in $_GNOME_KEYRING_AGENT_SOCKETS for i in $_GNOME_KEYRING_AGENT_SOCKETS; do
do test_agent_socket "$i"
test_agent_socket $i done
done
} }
find_live_osx_keychain_agents() { find_live_osx_keychain_agents() {
for i in $_OSX_KEYCHAIN_AGENT_SOCKETS for i in $_OSX_KEYCHAIN_AGENT_SOCKETS; do
do test_agent_socket "$i"
test_agent_socket $i done
done
} }
find_live_gpg_agents() { find_live_gpg_agents() {
for i in $_GPG_AGENT_SOCKETS for i in $_GPG_AGENT_SOCKETS; do
do test_agent_socket "$i"
test_agent_socket $i done
done
} }
find_live_ssh_agents() { find_live_ssh_agents() {
for i in $_SSH_AGENT_SOCKETS for i in $_SSH_AGENT_SOCKETS; do
do test_agent_socket "$i"
test_agent_socket $i done
done
} }
function fingerprints() { function fingerprints() {
local file="$1" local file="$1"
while read l; do while read -r l; do
[[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f /dev/stdin <<<$l [[ -n $l && ${l###} == "$l" ]] && ssh-keygen -l -f /dev/stdin <<<"$l"
done < $file done <"$file"
} }
find_all_agent_sockets() { find_all_agent_sockets() {
_SHOW_IDENTITY=0 _SHOW_IDENTITY=0
if [ "$1" = "-i" ] ; then if [ "$1" = "-i" ]; then
_SHOW_IDENTITY=1 _SHOW_IDENTITY=1
fi fi
_LIVE_AGENT_LIST= _LIVE_AGENT_LIST=
find_all_ssh_agent_sockets find_all_ssh_agent_sockets
find_all_gpg_agent_sockets find_all_gpg_agent_sockets
find_all_gnome_keyring_agent_sockets find_all_gnome_keyring_agent_sockets
find_all_osx_keychain_agent_sockets find_all_osx_keychain_agent_sockets
find_live_ssh_agents find_live_ssh_agents
find_live_gpg_agents find_live_gpg_agents
find_live_gnome_keyring_agents find_live_gnome_keyring_agents
find_live_osx_keychain_agents find_live_osx_keychain_agents
_debug_print "$_LIVE_AGENT_LIST" _debug_print "$_LIVE_AGENT_LIST"
_LIVE_AGENT_LIST=$(echo $_LIVE_AGENT_LIST | tr ' ' '\n' | sort -n -t: -k 2 -k 1 | uniq) _LIVE_AGENT_LIST=$(echo $_LIVE_AGENT_LIST | tr ' ' '\n' | sort -n -t: -k 2 -k 1 | uniq)
_LIVE_AGENT_SOCK_LIST=() _LIVE_AGENT_SOCK_LIST=()
_debug_print "SORTED: $_LIVE_AGENT_LIST" _debug_print "SORTED: $_LIVE_AGENT_LIST"
if [ -e ~/.ssh/authorized_keys ] ; then if [[ $_SHOW_IDENTITY -gt 0 ]]; then
_FINGERPRINTS=$(fingerprints ~/.ssh/authorized_keys) i=0
fi for a in $_LIVE_AGENT_LIST; do
if [[ $_SHOW_IDENTITY -gt 0 ]] sock=${a/:*/}
then _LIVE_AGENT_SOCK_LIST[$i]=$sock
i=0 # technically we could have multiple keys forwarded
for a in $_LIVE_AGENT_LIST ; do # But I haven't seen anyone do it
sock=${a/:*/} akeys=$(SSH_AUTH_SOCK=$sock ssh-add -l)
_LIVE_AGENT_SOCK_LIST[$i]=$sock fingerprint=$(echo "${akeys}" | awk '{print $2}')
# technically we could have multiple keys forwarded if [ -e ~/.ssh/authorized_keys ]; then
# But I haven't seen anyone do it authorized_entry=$(fingerprints ~/.ssh/authorized_keys | grep "$fingerprint")
akeys=$(SSH_AUTH_SOCK=$sock ssh-add -l) fi
key_size=$(echo ${akeys} | awk '{print $1}') comment=$(echo "${authorized_entry}" | awk '{print $3,$4,$5,$6,$7}')
fingerprint=$(echo ${akeys} | awk '{print $2}') printf "export SSH_AUTH_SOCK=%s \t#%i) \t%s\n" "$sock" $((i + 1)) "$comment"
remote_name=$(echo ${akeys} | awk '{print $3}') i=$((i + 1))
if [ -e ~/.ssh/authorized_keys ] ; then done
authorized_entry=$(fingerprints ~/.ssh/authorized_keys | grep $fingerprint) else
fi printf "%s\n" "$_LIVE_AGENT_LIST" | sed -e 's/ /\n/g' | sort -n -t: -k 2 -k 1
comment=$(echo ${authorized_entry} | awk '{print $3,$4,$5,$6,$7}') fi
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() { set_ssh_agent_socket() {
if [ "$1" = "-c" -o "$1" = "--choose" ] if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
then find_all_agent_sockets -i
find_all_agent_sockets -i
if [ -z "$_LIVE_AGENT_LIST" ] ; then if [ -z "$_LIVE_AGENT_LIST" ]; then
echo "No agents found" echo "No agents found"
return 1 return 1
fi fi
echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? " echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? "
read choice read -r choice
if [ -n "$choice" ] if [ -n "$choice" ]; then
then n=$((choice - 1))
n=$((choice-1)) if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ]; then
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ] ; then echo "Invalid choice"
echo "Invalid choice" return 1
return 1 fi
fi echo "Setting export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}"
echo "Setting export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}" export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}
export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]} fi
fi else
else # Choose the first available
# Choose the first available SOCK=$(find_all_agent_sockets | tail -n 1 | awk -F: '{print $1}')
SOCK=$(find_all_agent_sockets|tail -n 1|awk -F: '{print $1}') if [ -z "$SOCK" ]; then
if [ -z "$SOCK" ] ; then return 1
return 1 fi
fi export SSH_AUTH_SOCK=$SOCK
export SSH_AUTH_SOCK=$SOCK fi
fi
# set agent pid # set agent pid
if [ -n "$SSH_AUTH_SOCK" ] ; then if [ -n "$SSH_AUTH_SOCK" ]; then
export SSH_AGENT_PID=$((`echo $SSH_AUTH_SOCK | cut -d. -f2` + 1)) export SSH_AGENT_PID=$(($(echo "$SSH_AUTH_SOCK" | cut -d. -f2) + 1))
fi fi
return 0 return 0
} }
ssh-find-agent() { ssh-find-agent() {
if [ "$1" = "-c" -o "$1" = "--choose" ] if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
then set_ssh_agent_socket -c
set_ssh_agent_socket -c return $?
return $? elif [ "$1" = "-a" ] || [ "$1" = "--auto" ]; then
elif [ "$1" = "-a" -o "$1" = "--auto" ] set_ssh_agent_socket
then return $?
set_ssh_agent_socket else
return $? find_all_agent_sockets -i
else return 0
find_all_agent_sockets -i fi
return 0
fi
} }
# Automatically add ssh-agent to any new ssh connection # Automatically add ssh-agent to any new ssh connection
ssh-find-agent -a ssh-find-agent -a
if [ -z "$SSH_AUTH_SOCK" ] if [ -z "$SSH_AUTH_SOCK" ]; then
then eval "$(ssh-agent)" >/dev/null
eval $(ssh-agent) > /dev/null ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh' fi
fi

View file

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

View file

@ -1,3 +1,5 @@
#!/bin/zsh
### Set ZSH History defaults ### Set ZSH History defaults
# set some history options # set some history options
@ -20,8 +22,7 @@ setopt pushd_ignore_dups
#setopt pushd_silent #setopt pushd_silent
# Keep a ton of history. # Keep a ton of history.
HISTSIZE=100000 export HISTSIZE=100000
SAVEHIST=100000 export SAVEHIST=100000
HISTFILE=~/.zsh_history HISTFILE=~/.zsh_history
export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help" export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help"

View file

@ -1,10 +1,12 @@
#!/bin/zsh
#
# Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html # Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html
globalias() { globalias() {
if [[ $LBUFFER =~ ' [A-Z0-9]+$' ]]; then if [[ $LBUFFER =~ [A-Z0-9]+$ ]]; then
zle _expand_alias zle _expand_alias
zle expand-word zle expand-word
fi fi
zle self-insert zle self-insert
} }
zle -N globalias zle -N globalias

View file

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

View file

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

View file

@ -1,3 +1,4 @@
#!/bin/zsh
# Correct spelling for commands # Correct spelling for commands
setopt correct setopt correct
@ -8,4 +9,4 @@ unsetopt correctall
ENABLE_CORRECTION="true" ENABLE_CORRECTION="true"
# Display red dots whilst waiting for completion. # Display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true" COMPLETION_WAITING_DOTS="true"

View file

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

View file

@ -1,3 +1,5 @@
#!/bin/zsh
POWERLEVEL9K_MODE='nerdfont-complete' POWERLEVEL9K_MODE='nerdfont-complete'
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 #POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
#POWERLEVEL9K_SHORTEN_DELIMITER="" #POWERLEVEL9K_SHORTEN_DELIMITER=""
@ -11,7 +13,7 @@ POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%F{white}"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%F{white} " POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%F{white} "
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir dir_writable_joined) POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir dir_writable_joined)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time
vcs background_jobs_joined time_joined) vcs background_jobs_joined time_joined)
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND="clear" POWERLEVEL9K_VCS_MODIFIED_BACKGROUND="clear"
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND="clear" POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND="clear"
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow" POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow"

View file

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

View file

@ -1,3 +1,4 @@
#!/bin/zsh
# uses k (installed with plugins) but makes it accessible through l as well # uses k (installed with plugins) but makes it accessible through l as well
alias k="k -h" alias k="k -h"
alias l="k -A" alias l="k -A"

View file

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

View file

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

View file

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

View file

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

View file

@ -1,19 +1,22 @@
#!/bin/zsh
# shellcheck disable=SC2206
# shellcheck disable=SC2179
# shellcheck disable=SC2154
# In case a plugin adds a redundant path entry, remove duplicate entries # In case a plugin adds a redundant path entry, remove duplicate entries
# from PATH # from PATH
# # from: https://unix.stackexchange.com/questions/40749/remove-duplicate-path-entries-with-awk-command
# This snippet is from Mislav Marohnić <mislav.marohnic@gmail.com>'s get_var() {
# dotfiles repo at https://github.com/mislav/dotfiles eval 'printf "%s\n" "${'"$1"'}"'
dedupe_path() {
typeset -a paths result
paths=($path)
while [[ ${#paths} -gt 0 ]]; do
p="${paths[1]}"
shift paths
[[ -z ${paths[(r)$p]} ]] && result+="$p"
done
export PATH=${(j+:+)result}
} }
set_var() {
dedupe_path 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,3 +1,4 @@
#!/bin/zsh
# Assumes enhancd is installed (via plugin) # Assumes enhancd is installed (via plugin)
# Let's you go back a directory with .. (usual cd .. behavior) # Let's you go back a directory with .. (usual cd .. behavior)
# Let's the enhancd backtrack menu appear with cd .. (usual enhancd behavior) # Let's the enhancd backtrack menu appear with cd .. (usual enhancd behavior)

View file

@ -5,17 +5,17 @@
# you can delete this line if you're not using Docker # you can delete this line if you're not using Docker
image: fnichol/check-shell:latest image: fnichol/check-shell:latest
shellcheck: analyze:
stage: test stage: test
before_script: before_script:
- shellcheck --version - shellcheck --version
script: script:
- echo "--------- CHECKING POSIX SHELLSCRIPTS -------------" - echo "--------- CHECKING POSIX SHELLSCRIPTS -------------"
- find . -type f -name '*.sh' | xargs shellcheck -s sh - find . -type f -name '*.sh' | xargs shellcheck -Calways
- echo "--------- CHECKING ZSH SHELLSCRIPTS -------------" - echo "--------- CHECKING ZSH SHELLSCRIPTS -------------"
- find . -type f -name '*.zsh' | xargs shellcheck -s bash - find . -type f -name '*.zsh' | xargs shellcheck -Calways -s bash -e SC2034
shfmt: lint:
stage: test stage: test
before_script: before_script:
- shfmt -version - shfmt -version

View file

@ -3,10 +3,5 @@
# from swalladge: # from swalladge:
# https://github.com/swalladge/dotfiles/blob/master/local/share/qutebrowser/userscripts/wallabag_add.sh # https://github.com/swalladge/dotfiles/blob/master/local/share/qutebrowser/userscripts/wallabag_add.sh
# for wallabag v1.*
# `-w 0` disables auto line wrapping in base64
# echo "open -t https://www.framabag.org/u/swalladge/?action=add&url='`echo -n "$QUTE_URL" | base64 -w 0`'" >> "$QUTE_FIFO"
# v2.* # v2.*
echo "open https://read.martyoeh.me/bookmarklet?url=$QUTE_URL" >> "$QUTE_FIFO" echo "open https://read.martyoeh.me/bookmarklet?url=$QUTE_URL" >>"$QUTE_FIFO"