Naive fixing of linter errors

This commit is contained in:
Marty Oehme 2019-07-24 07:33:28 +02:00
parent 21c40fa774
commit ef73a11e51
27 changed files with 207 additions and 194 deletions

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 PATH="$PATH:$GOPATH/bin"

View file

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

View file

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

View file

@ -1,5 +1,7 @@
#!/bin/sh
# Prettify ls commands
if [[ "$(uname -s)" == "Linux" ]]; then
if [ "$(uname -s)" = "Linux" ]; then
# we're on linux
alias l-d="ls -lFad"
alias l="ls -lAhF" # Overwritten for k in -aliasing-k
@ -8,7 +10,10 @@ if [[ "$(uname -s)" == "Linux" ]]; then
fi
# 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
alias zh="fc -l -d -D"
@ -28,5 +33,5 @@ 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"
alias :q="exit"
alias :wq="exit"

View file

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

View file

@ -27,8 +27,8 @@ else
fi
# 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 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 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' {}' --color=dark --ansi | cd"

View file

@ -1 +1,2 @@
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,
# 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/sh
## Integration at the Bottom
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
@ -29,56 +31,51 @@ declare -a _LIVE_AGENT_SOCK_LIST
_LIVE_AGENT_SOCK_LIST=()
_debug_print() {
if [[ $_DEBUG -gt 0 ]]
then
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.*'`
_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'`
_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$'`
_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`
_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
SSH_AUTH_SOCK=$SOCKET ssh-add -l 2>/dev/null >/dev/null
result=$?
_debug_print $result
if [[ $result -eq 0 ]]
then
if [[ $result -eq 0 ]]; then
# 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
if [[ $result -eq 1 ]]
then
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
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"
@ -90,29 +87,25 @@ test_agent_socket() {
}
find_live_gnome_keyring_agents() {
for i in $_GNOME_KEYRING_AGENT_SOCKETS
do
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
for i in $_OSX_KEYCHAIN_AGENT_SOCKETS; do
test_agent_socket $i
done
}
find_live_gpg_agents() {
for i in $_GPG_AGENT_SOCKETS
do
for i in $_GPG_AGENT_SOCKETS; do
test_agent_socket $i
done
}
find_live_ssh_agents() {
for i in $_SSH_AGENT_SOCKETS
do
for i in $_SSH_AGENT_SOCKETS; do
test_agent_socket $i
done
}
@ -120,13 +113,13 @@ find_live_ssh_agents() {
function fingerprints() {
local file="$1"
while read l; do
[[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f /dev/stdin <<<$l
done < $file
[[ -n $l && ${l###} == $l ]] && ssh-keygen -l -f /dev/stdin <<<$l
done <$file
}
find_all_agent_sockets() {
_SHOW_IDENTITY=0
if [ "$1" = "-i" ] ; then
if [ "$1" = "-i" ]; then
_SHOW_IDENTITY=1
fi
_LIVE_AGENT_LIST=
@ -142,13 +135,12 @@ find_all_agent_sockets() {
_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 [ -e ~/.ssh/authorized_keys ] ; then
if [ -e ~/.ssh/authorized_keys ]; then
_FINGERPRINTS=$(fingerprints ~/.ssh/authorized_keys)
fi
if [[ $_SHOW_IDENTITY -gt 0 ]]
then
if [[ $_SHOW_IDENTITY -gt 0 ]]; then
i=0
for a in $_LIVE_AGENT_LIST ; do
for a in $_LIVE_AGENT_LIST; do
sock=${a/:*/}
_LIVE_AGENT_SOCK_LIST[$i]=$sock
# technically we could have multiple keys forwarded
@ -157,12 +149,12 @@ find_all_agent_sockets() {
key_size=$(echo ${akeys} | awk '{print $1}')
fingerprint=$(echo ${akeys} | awk '{print $2}')
remote_name=$(echo ${akeys} | awk '{print $3}')
if [ -e ~/.ssh/authorized_keys ] ; then
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))
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
@ -170,21 +162,19 @@ find_all_agent_sockets() {
}
set_ssh_agent_socket() {
if [ "$1" = "-c" -o "$1" = "--choose" ]
then
if [ "$1" = "-c" -o "$1" = "--choose" ]; then
find_all_agent_sockets -i
if [ -z "$_LIVE_AGENT_LIST" ] ; then
if [ -z "$_LIVE_AGENT_LIST" ]; then
echo "No agents found"
return 1
fi
echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? "
read choice
if [ -n "$choice" ]
then
n=$((choice-1))
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ] ; then
if [ -n "$choice" ]; then
n=$((choice - 1))
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ]; then
echo "Invalid choice"
return 1
fi
@ -193,28 +183,26 @@ set_ssh_agent_socket() {
fi
else
# Choose the first available
SOCK=$(find_all_agent_sockets|tail -n 1|awk -F: '{print $1}')
if [ -z "$SOCK" ] ; then
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))
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" -o "$1" = "--choose" ]
then
if [ "$1" = "-c" -o "$1" = "--choose" ]; then
set_ssh_agent_socket -c
return $?
elif [ "$1" = "-a" -o "$1" = "--auto" ]
then
elif [ "$1" = "-a" -o "$1" = "--auto" ]; then
set_ssh_agent_socket
return $?
else
@ -225,8 +213,7 @@ ssh-find-agent() {
# Automatically add ssh-agent to any new ssh connection
ssh-find-agent -a
if [ -z "$SSH_AUTH_SOCK" ]
then
eval $(ssh-agent) > /dev/null
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

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

View file

@ -1,6 +1,8 @@
#!/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
if [[ $LBUFFER =~ [A-Z0-9]+$ ]]; then
zle _expand_alias
zle expand-word
fi

View file

@ -1,3 +1,4 @@
#!/bin/zsh
# Clone zgen if you haven't already
check_zgen_installation() {
if [[ -z "$ZGEN_PARENT_DIR" ]]; then
@ -8,10 +9,11 @@ check_zgen_installation() {
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
mkdir -p "$ZGEN_PARENT_DIR"
fi
pushd $ZGEN_PARENT_DIR
cd $ZGEN_PARENT_DIR || return
git clone https://github.com/tarjoilija/zgen.git $ZGEN_DIR
popd
fi
# shellcheck source=/home/marty/.config/zgen/zgen.zsh
# shellcheck disable=SC1091
source $ZGEN_DIR/zgen.zsh
unset ZGEN_PARENT_DIR
}
@ -34,8 +36,8 @@ load_plugins() {
# Set keystrokes for substring searching
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
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
@ -91,7 +93,7 @@ load_plugins() {
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
if type autojump >/dev/null 2>&1; then
zgen oh-my-zsh plugins/autojump
fi
zgen oh-my-zsh plugins/tmux

View file

@ -1,8 +1,9 @@
#!/bin/zsh
# deal with screen, if we're using it - courtesy MacOSXHints.com
# 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)
if [ ! -z "$detached_screens" ]; then
if [ -n "$detached_screens" ]; then
echo "+---------------------------------------+"
echo "| Detached screens are available: |"
echo "$detached_screens"

View file

@ -1,3 +1,4 @@
#!/bin/zsh
# Correct spelling for commands
setopt correct

View file

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

View file

@ -1,3 +1,5 @@
#!/bin/zsh
POWERLEVEL9K_MODE='nerdfont-complete'
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
#POWERLEVEL9K_SHORTEN_DELIMITER=""

View file

@ -1,3 +1,5 @@
#!/bin/zsh
#
# Clone tmux plugin manager if not existing
if [[ -z "$TPM_PARENT_DIR" ]]; then
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
mkdir -p "$TPM_PARENT_DIR"
fi
pushd $TPM_PARENT_DIR
cd "$TPM_PARENT_DIR" || exit
git clone https://github.com/tmux-plugins/tpm plugins/tpm
popd
fi
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_SUB_DIR

View file

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

View file

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

View file

@ -1,3 +1,4 @@
#!/bin/zsh
# show newest files
# http://www.commandlinefu.com/commands/view/9015/find-the-most-recently-changed-files-recursively
newest (){

View file

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

View file

@ -1,3 +1,8 @@
#!/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
#

View file

@ -1,3 +1,4 @@
#!/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)

View file

@ -3,10 +3,5 @@
# from swalladge:
# 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.*
echo "open https://read.martyoeh.me/bookmarklet?url=$QUTE_URL" >> "$QUTE_FIFO"