From 3f5e822fb38f6846bab75771033770b0f5411466 Mon Sep 17 00:00:00 2001 From: Nikolas Weger Date: Thu, 20 Jul 2017 09:19:38 +0200 Subject: [PATCH] reverted to before zulu --- .gitmodules | 27 ++++++++++--- CHANGELOG | 2 + README.md | 2 + lib/bin/nma | 16 ++++++++ lib/completions | 1 + lib/dasht | 1 + lib/fzf | 1 + lib/highlighting | 1 + lib/k | 1 + lib/ohmyzsh | 1 + lib/util | 1 + zsh/aliases.d/cd.zsh | 28 +++++++++++++ zsh/aliases.d/find.zsh | 5 +++ zsh/aliases.d/grep.zsh | 4 ++ zsh/aliases.d/interactive.zsh | 5 +++ zsh/aliases.d/list.zsh | 10 +++++ zsh/aliases.d/own.zsh | 20 ++++++++++ zsh/aliases.d/stuff.zsh | 7 ++++ zsh/aliases.d/tail.zsh | 2 + zsh/aliases.d/transfer.zsh | 54 +++++++++++++++++++++++++ zsh/zshrc | 75 +++++++++++++++-------------------- 21 files changed, 216 insertions(+), 48 deletions(-) create mode 100755 lib/bin/nma create mode 160000 lib/completions create mode 160000 lib/dasht create mode 160000 lib/fzf create mode 160000 lib/highlighting create mode 160000 lib/k create mode 160000 lib/ohmyzsh create mode 160000 lib/util create mode 100644 zsh/aliases.d/cd.zsh create mode 100644 zsh/aliases.d/find.zsh create mode 100644 zsh/aliases.d/grep.zsh create mode 100644 zsh/aliases.d/interactive.zsh create mode 100644 zsh/aliases.d/list.zsh create mode 100644 zsh/aliases.d/own.zsh create mode 100644 zsh/aliases.d/stuff.zsh create mode 100644 zsh/aliases.d/tail.zsh create mode 100644 zsh/aliases.d/transfer.zsh diff --git a/.gitmodules b/.gitmodules index 11e333f..5bb3504 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,27 @@ [submodule "dotbot"] path = dotbot url = https://github.com/anishathalye/dotbot +[submodule "lib/highlighting"] + path = lib/highlighting + url = https://github.com/zsh-users/zsh-syntax-highlighting +[submodule "lib/completions"] + path = lib/completions + url = https://github.com/zsh-users/zsh-completions [submodule "lib/nano/syntax"] path = lib/nano/syntax url = https://github.com/scopatz/nanorc -[submodule "lib/zulu/core"] - path = lib/zulu/core - url = https://github.com/zulu-zsh/zulu -[submodule "lib/zulu/index"] - path = lib/zulu/index - url = https://github.com/zulu-zsh/index +[submodule "lib/ohmyzsh"] + path = lib/ohmyzsh + url = https://github.com/robbyrussell/oh-my-zsh +[submodule "lib/k"] + path = lib/k + url = https://github.com/rimraf/k +[submodule "lib/fzf"] + path = lib/fzf + url = https://github.com/junegunn/fzf.git +[submodule "lib/util"] + path = lib/util + url = https://github.com/skx/sysadmin-util +[submodule "lib/dasht"] + path = lib/dasht + url = https://github.com/sunaku/dasht diff --git a/CHANGELOG b/CHANGELOG index 2082b36..5947e3e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +eeleater, 22.02.2017, Cleaned up a bit + eeleater, 06.10.2015, Stuff (look at commits) eeleater, 22.09.2015, removed Ansible Completion (again...) diff --git a/README.md b/README.md index 8d4cd85..c63b0a3 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,5 @@ This Repo contains my dotfiles Install with the ```./install``` script. + +Also need to install xmlstarlet, use ```yaourt -S xmlstarlet``` diff --git a/lib/bin/nma b/lib/bin/nma new file mode 100755 index 0000000..8b6bf7b --- /dev/null +++ b/lib/bin/nma @@ -0,0 +1,16 @@ +#!/bin/bash + +out=$(mktemp /tmp/nma.XXXXXXXX) + +curl --silent --data-ascii "apikey=1e9cfe3bddab21f271b742eb04f9918a76ad0ef0333be7d3" \ + --data-ascii "application=Server" --data-ascii "event=megumi.eeleater.org" \ + --data-asci "description=$1" --data-asci "priority=0" \ + "https://www.notifymyandroid.com/publicapi/notify" -o "$out" + +if test $(xml sel -t -m "nma/success" -v "@code" "$out") == "200"; then + echo "Sent" + exit 0 +else + echo "Not sent: $(xml sel -t -m "nma/error" -v "." "$out")" + exit 1 +fi diff --git a/lib/completions b/lib/completions new file mode 160000 index 0000000..fb28eaf --- /dev/null +++ b/lib/completions @@ -0,0 +1 @@ +Subproject commit fb28eaf1d6c3c697f1e9721ee9ec911b8d0118ec diff --git a/lib/dasht b/lib/dasht new file mode 160000 index 0000000..7ea9158 --- /dev/null +++ b/lib/dasht @@ -0,0 +1 @@ +Subproject commit 7ea915837f7ca3227fe6ca8e8420e1ec2ae638e0 diff --git a/lib/fzf b/lib/fzf new file mode 160000 index 0000000..1896aa1 --- /dev/null +++ b/lib/fzf @@ -0,0 +1 @@ +Subproject commit 1896aa174877da2e5c6be35219a0a1abcdc4fbf1 diff --git a/lib/highlighting b/lib/highlighting new file mode 160000 index 0000000..aac4a44 --- /dev/null +++ b/lib/highlighting @@ -0,0 +1 @@ +Subproject commit aac4a4423898fccbd1ab72c369ac09995a9139f1 diff --git a/lib/k b/lib/k new file mode 160000 index 0000000..1fa7c03 --- /dev/null +++ b/lib/k @@ -0,0 +1 @@ +Subproject commit 1fa7c039d40684d39cb225599bda4a86a62e765d diff --git a/lib/ohmyzsh b/lib/ohmyzsh new file mode 160000 index 0000000..0b4bba4 --- /dev/null +++ b/lib/ohmyzsh @@ -0,0 +1 @@ +Subproject commit 0b4bba4ca2d6115dabfdb0852ce516e30765d2e6 diff --git a/lib/util b/lib/util new file mode 160000 index 0000000..2d69cda --- /dev/null +++ b/lib/util @@ -0,0 +1 @@ +Subproject commit 2d69cda49b1f15b3026f2de0b7178f63b37b8b33 diff --git a/zsh/aliases.d/cd.zsh b/zsh/aliases.d/cd.zsh new file mode 100644 index 0000000..d02755a --- /dev/null +++ b/zsh/aliases.d/cd.zsh @@ -0,0 +1,28 @@ +# CD +alias ..='cd ../' +alias ...='cd ../../' +alias ....='cd ../../../' +alias .....='cd ../../../../' + +# Go up [n] directories +function up() +{ + local cdir="$(pwd)" + if [[ "${1}" == "" ]]; then + cdir="$(dirname "${cdir}")" + elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then + echo "Error: argument must be a number" + elif ! [[ "${1}" -gt "0" ]]; then + echo "Error: argument must be positive" + else + for i in {1..${1}}; do + local ncdir="$(dirname "${cdir}")" + if [[ "${cdir}" == "${ncdir}" ]]; then + break + else + cdir="${ncdir}" + fi + done + fi + cd "${cdir}" +} diff --git a/zsh/aliases.d/find.zsh b/zsh/aliases.d/find.zsh new file mode 100644 index 0000000..42852f9 --- /dev/null +++ b/zsh/aliases.d/find.zsh @@ -0,0 +1,5 @@ +# Du/Find +alias dud='du -d 1 -h' +alias duf='du -sh *' +alias fd='find . -type d -name' +alias ff='find . -type f -name' diff --git a/zsh/aliases.d/grep.zsh b/zsh/aliases.d/grep.zsh new file mode 100644 index 0000000..00992b1 --- /dev/null +++ b/zsh/aliases.d/grep.zsh @@ -0,0 +1,4 @@ +# Grep +alias grep='grep --color' +alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}' +alias psg='ps aux | grep -v grep | grep' diff --git a/zsh/aliases.d/interactive.zsh b/zsh/aliases.d/interactive.zsh new file mode 100644 index 0000000..09a1988 --- /dev/null +++ b/zsh/aliases.d/interactive.zsh @@ -0,0 +1,5 @@ +# Interactive +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + diff --git a/zsh/aliases.d/list.zsh b/zsh/aliases.d/list.zsh new file mode 100644 index 0000000..2ab0dd7 --- /dev/null +++ b/zsh/aliases.d/list.zsh @@ -0,0 +1,10 @@ +# Listing +alias l='ls -lFh' #size,show type,human readable +alias la='ls -lAFh' #long list,show almost all,show type,human readable +alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable +alias lt='ls -ltFh' #long list,sorted by date,show type,human readable +alias ll='ls -l' #long list +alias ldot='ls -ld .*' +alias lS='ls -1FSsh' +alias lart='ls -1Fcart' +alias lrt='ls -1Fcrt' diff --git a/zsh/aliases.d/own.zsh b/zsh/aliases.d/own.zsh new file mode 100644 index 0000000..028cba9 --- /dev/null +++ b/zsh/aliases.d/own.zsh @@ -0,0 +1,20 @@ +# Command Line Foo +alias clf='clf --color' + +# The Fuck +TF_ALIAS=fuck alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R' + +# PClear +pclear () { + clear + printf '\033[3J' +} + +# Termbin +alias tb='nc termbin.com 9999' + +# Make Dir and enter it +mkcd() { + mkdir $1 >/dev/null 2>&1 + [ -e $1 ] && cd $1 +} diff --git a/zsh/aliases.d/stuff.zsh b/zsh/aliases.d/stuff.zsh new file mode 100644 index 0000000..a12e646 --- /dev/null +++ b/zsh/aliases.d/stuff.zsh @@ -0,0 +1,7 @@ +# Stuff +alias h='history' +alias hgrep="fc -El 0 | grep" +alias j='jobs' +alias p='ps -f' +alias sortnr='sort -n -r' + diff --git a/zsh/aliases.d/tail.zsh b/zsh/aliases.d/tail.zsh new file mode 100644 index 0000000..c03c012 --- /dev/null +++ b/zsh/aliases.d/tail.zsh @@ -0,0 +1,2 @@ +# Tail +alias t='tail -f' diff --git a/zsh/aliases.d/transfer.zsh b/zsh/aliases.d/transfer.zsh new file mode 100644 index 0000000..ea89303 --- /dev/null +++ b/zsh/aliases.d/transfer.zsh @@ -0,0 +1,54 @@ +# +# Defines transfer alias and provides easy command line file and folder sharing. +# +# Authors: +# Remco Verhoef +# + +transfer() { + # check arguments + if [ $# -eq 0 ]; + then + echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" + return 1 + fi + + # get temporarily filename, output is written to this file show progress can be showed + tmpfile=$( mktemp -t transferXXX ) + + # upload stdin or file + file=$1 + + if tty -s; + then + basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g') + + if [ ! -e $file ]; + then + echo "File $file doesn't exists." + return 1 + fi + + if [ -d $file ]; + then + # zip directory and transfer + zipfile=$( mktemp -t transferXXX.zip ) + cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile + curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile + rm -f $zipfile + else + # transfer file + curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile + fi + else + # transfer pipe + curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile + fi + + # cat output link + cat $tmpfile + + # cleanup + rm -f $tmpfile +} + diff --git a/zsh/zshrc b/zsh/zshrc index 92aebda..35bd1d1 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,61 +1,52 @@ -# Oh My ZSH Path +# Exports export ZSH=${HOME}/dotfiles/lib/ohmyzsh - -# Oh My ZSH Theme ZSH_THEME="mortalscumbag" - -# Disable Auto Update of Oh My ZSH DISABLE_AUTO_UPDATE="true" - -# Go Path export GOPATH=${HOME}/go - -# Path -export PATH="${GOPATH}/bin:${HOME}/.gem/ruby/2.2.0/bin:${HOME}/dotfiles/lib/util:${HOME}/dotfiles/lib/dasht/bin:${PATH}" - -# Dasht +export PATH="${GOPATH}/bin:${HOME}/.gem/ruby/2.3.0/bin:${HOME}/dotfiles/lib/util:${HOME}/dotfiles/lib/bin:${HOME}/dotfiles/lib/dasht/bin:${PATH}:/opt/android-sdk/build-tools/26.0.0/" export DASHT_DOCSETS_DIR=$HOME/.local/share/Zeal/Zeal/docsets +export EDITOR='nano' +export TERM=linux # Plugins -plugins=(gem bundler composer git vagrant docker python) -plugins+=(npm systemd systemadmin gitignore tmux extract) -plugins+=(command-not-found colored-man-pages fabric ansible) +plugins=(gem bundler git vagrant docker python ansible) +plugins+=(systemd systemadmin tmux command-not-found extract) +case $(uname -n) in +"megumi") + plugins+=(archlinux) + ;; +"sayaka") + plugins+=(archlinux) + ;; +"git") + plugins+=(debian) + ;; +"test") + plugins+=(debian) + ;; +esac -if [ $(uname -n) = "megumi" -o $(uname -n) = "kimari" -o $(uname -n) = "sayaka" ]; then - plugins+=(archlinux) -fi -if [ $(uname -n) = "mx" -o $(uname -n) = "git" ]; then - plugins+=(debian) -fi - -# Preferred editor for local and remote sessions -export EDITOR='nano' - -# Load Oh My ZSH +# OMZ source ${ZSH}/oh-my-zsh.sh -# Fix home/end key at work -bindkey "^[[1~" beginning-of-line -bindkey "^[[4~" end-of-line +# Fix MobaXterm Home/End key with ZSH +bindkey '^[[H' beginning-of-line +bindkey '^[[F' end-of-line -# Source k.sh -source ${HOME}/dotfiles/lib/k/k.sh - -# Shell Syntax Highlighter +# Syntax Highlighting source ${HOME}/dotfiles/lib/highlighting/zsh-syntax-highlighting.zsh ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) +# Aliases +for file in ${HOME}/dotfiles/zsh/aliases.d/*.zsh; do + source $file +done + +# FZF +[ -f ${HOME}/.fzf.zsh ] && source ${HOME}/.fzf.zsh + # Dircolors eval `dircolors ${HOME}/dotfiles/zsh/dircolors` -# Source Aliases -source ${HOME}/dotfiles/zsh/aliases.zsh - -# Source FZF -[ -f ${HOME}/.fzf.zsh ] && source ${HOME}/.fzf.zsh - # Completions Path fpath=(${HOME}/dotfiles/lib/completions/src $fpath) - -# Source local zshrc -[ -f ${HOME}/local.zshrc ] && source ${HOME}/local.zshrc