dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 35019d4e81a6e7acfb9ed1ab2a0f652aa919411a
parent 7864af40239979fedba6c89694fa6629acafc8b3
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Mon, 10 Feb 2020 12:48:17 +0100

Delete old shell files, no longer useful


Former-commit-id: 48ccf00780e0337a8e9474cb7ff424e2b5a3ecbc
Diffstat:
Dshell-old/bash_profile | 5-----
Dshell-old/commonprofile | 266-------------------------------------------------------------------------------
Dshell-old/zshrc | 96-------------------------------------------------------------------------------
3 files changed, 0 insertions(+), 367 deletions(-)

diff --git a/shell-old/bash_profile b/shell-old/bash_profile @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -source "$HOME/.commonprofile" -PATH=$PATH:/opt/metasploit-framework/bin -export PATH=$PATH:/opt/metasploit-framework/bin -[ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/shell-old/commonprofile b/shell-old/commonprofile @@ -1,266 +0,0 @@ -#!/usr/bin/env bash -# vim:foldmethod=marker:foldlevel=0 -# Env variables {{{ - -# Original path: -# PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - -export \ - PATH GOPATH GO111MODULE\ - DOTFILES MUSIC_DIR \ - EDITOR HOMEBREW_EDITOR \ - VIRTUALENVWRAPPER_PYTHON PIP_REQUIRE_VIRTUALENV WORKON_HOME VIRTUALENVWRAPPER_SCRIPT\ - CASK_REPO \ - SHELLCHECK_OPTS - -# Add API keys and stuff -if [ -f "$HOME/.secret_env_variables" ]; then - source "$HOME/.secret_env_variables" -fi - -# Include my scripts in PATH (conditionally) -if [[ $PATH != *"$HOME/.bin"* ]]; then - PATH=$HOME/.bin:$PATH -fi -if [[ $PATH != *"$HOME/.scripts"* ]]; then - PATH=$HOME/.scripts:$PATH -fi - -# Golang -if command -v go &> /dev/null; then - GOPATH="$HOME"/.go - GO111MODULE=off - if [[ $PATH != *"$GOPATH"* ]]; then - PATH=$PATH:"$GOPATH"/bin - fi -fi - -# Homebrew -if [[ $PATH != *"/usr/local/sbin"* ]]; then - PATH="/usr/local/sbin:$PATH" -fi - -if [[ $PATH != *"/usr/local/opt/gnu-sed/libexec/gnubin"* ]]; then - PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" -fi - -# Haskell -if [[ $PATH != *"$HOME/.ghcup/bin"* ]]; then - PATH="$HOME/.ghcup/bin:$PATH" -fi - -# Set a variable for my confidr -DOTFILES="$HOME/.dotfiles" - -# Where my music is located -MUSIC_DIR="$HOME/Music/iTunes/iTunes Media/Music" - -# My editor -EDITOR="vim" - -if command -v brew &> /dev/null; then - HOMEBREW_EDITOR="$EDITOR" - CASK_REPO=$(brew --repository)/Library/Taps/homebrew/homebrew-cask -fi - -# Set python 3 location -VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 - -# pip should only run if there is a virtualenv currently activated -PIP_REQUIRE_VIRTUALENV=true - -WORKON_HOME=$HOME/.virtualenvs -VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh -[ -f /usr/local/bin/virtualenvwrapper_lazy.py ] && source /usr/local/bin/virtualenvwrapper_lazy.sh - -# what to exclude for shellcheck -SHELLCHECK_OPTS='--exclude=SC1090,SC1091,SC2009' - -# }}} - -# Aliases (simple) {{{ -alias c="clear" -alias fucking="sudo" -alias wtf="tldr" -alias virc="vim ~/.vimrc" -alias cp='cp -iv' # Preferred 'cp' implementation -alias mv='mv -iv' # Preferred 'mv' implementation -alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation -alias ls="ls -lh" # Preferred 'ls' implementation -alias l="ls -lah" # Preferred 'ls -a' implementation -alias ll="ls -FGlAhpO@" # Preferred detailed 'ls' implementation -alias less='less -iRXc' # Preferred 'less' implementation -alias du="du -skh" # Preferred 'du' implementation -alias df="df -h" # Preferred 'df' implementation -alias htop='sudo htop' # Top should launch htop with sudo -alias g='git' # Make git easier to type -alias wheredef='type -a' # Where is a function defined? -alias lsblk="lsblk -o NAME,LABEL,PARTLABEL,TYPE,FSTYPE,SIZE,MOUNTPOINT,STATE" -alias rmcolors="sed \"s,\x1B\[[0-9;]*[a-zA-Z],,g\"" # Remove ANSI color codes from text -alias bc="bc -ql" # Preferred 'bc' implementation -alias nls="expr \`ls -l | wc -l | xargs echo\` - 1" # Count the number of files in the directory -alias tree="tree -CAFa -I 'CVS|*.*.package|.svn|.git|node_modules' --dirsfirst" -# }}} - -# Aliases (Mac UI) {{{ -alias changedock="defaults write com.apple.dock contents-immutable -bool false;killall Dock" -alias nochangedock="defaults write com.apple.dock contents-immutable -bool true;killall Dock" -alias dockspacer="defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type='spacer-tile';}'; killall Dock" -alias spotlighton="sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist" -alias spotlightoff="sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist" -# }}} - -# Aliases (services) {{{ -alias loadftp="sudo launchctl load /System/Library/LaunchDaemons/ftp.plist" -alias unloadftp="sudo launchctl unload /System/Library/LaunchDaemons/ftp.plist" -alias startftp="sudo launchctl start com.apple.ftpd" -alias stopftp="sudo launchctl stop com.apple.ftpd" -alias startapache="sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist" -alias stopapache="sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist" -alias startpg='pg_ctl -D $(brew --prefix)/var/postgres start' -# }}} - -# Aliases (Dougscripts trial resets) {{{ -alias rs_notinplaylist="rm $HOME/Library/iTunes/.ntnny.txt" -alias rs_removedeadtracks="rm $HOME/Library/iTunes/.superremoveapp.plist" -# }}} - -# One-liners {{{ -cd() { builtin cd -p "$@" || return; ls; } # list contents after cding -mkcd() { mkdir -p -- "$1" && cd -p -- "$1" || return; } # make dir and cd at the same time -procinfo() { ps aux | grep "$1"; } # get info about a process (by name) -rmempty() { find "${1-.}" -type d -empty -depth -delete; } # remove empty directories -hr() { for ((i=0; i<$(tput cols); i++)); do echo -n "#"; done; echo; } # insert a <hr> in the terminal -vimq() { vim -q <($(fc -nl -1)); } # load results of last command (often ag) in vim quickfix - -# create commands to override pip restriction. -# use `gpip` to force installation of -# a package in the global python environment -gpip(){ PIP_REQUIRE_VIRTUALENV="" pip "$@"; } - -# }}} - -# General functions {{{ -# Define a notification fuction -- notify $title $message -notify() { - if type terminal-notifier &> /dev/null; then - terminal-notifier -title "$1" -message "$2" -activate com.googlecode.iterm2 - else - echo '\a' - fi -} - -# Reload configs -reload() { - local START_TIME=$SECONDS - source "$HOME"/.commonprofile - - if [[ $SHELL = *"zsh"* ]]; then - source "$HOME"/.zshrc - elif [[ $SHELL = *"bash"* ]]; then - source "$HOME"/.bash_profile - fi - echo "Reloaded config ($(( SECONDS-START_TIME )) sec)." -} - - -# Extract any archive -extract () { - if [ -f "$1" ] ; then - case $1 in - *.tar.bz2) tar xjf "$1" ;; - *.tar.gz) tar xzf "$1" ;; - *.bz2) bunzip2 "$1" ;; - *.rar) unrar e "$1" ;; - *.gz) gunzip "$1" ;; - *.tar) tar xf "$1" ;; - *.tbz2) tar xjf "$1" ;; - *.tgz) tar xzf "$1" ;; - *.zip) unzip "$1" ;; - *.Z) uncompress "$1" ;; - *.7z) 7z x "$1" ;; - *) echo "'$1' cannot be extracted via extract()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -# Echo the current wifi password -current_wifi_password() { - security find-generic-password -ga "$1" | grep password -} - -# }}} - -# Applescript functions {{{ -if command -v osascript &> /dev/null; then - - # cd to current Finder directory - cdf() { - local target=$(osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)') - if [ "$target" != "" ]; then - cd "$target" || return; pwd - else - echo 'No Finder window found' >&2 - fi - } -# echo current Finder directory -gdf() { - osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)' -} -# echo selected Finder file -fsel() { - osascript -e 'tell application "Finder" to return POSIX path of (first item of (get selection as alias list) as alias)' | rev | sed 's/^\///' | rev; -}; - fi - # }}} - -# fzf functions {{{ -if [ -f ~/.fzf.zsh ] || [ -f ~/.fzf.bash ]; then - export FZF_DEFAULT_OPTS="--preview-window right:100:hidden:wrap --bind '?:toggle-preview' --preview='(bat --style=numbers --color=always {} || cat {}) 2>/dev/null | head -500'" - export FZF_DEFAULT_COMMAND="ag -l -g \"\"" - # script edit - se() { - local files - IFS=$'\n' files=($(command find "$(readlink ~/.scripts)" -type f -not -ipath "*/.git/*" | fzf -m --inline-info --prompt="edit> " --height=40 --reverse)) - [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" - } - # script create - sc() { - [ -z "$1" ] && echo "Filename must be passed as an argument." && return 1 - vim $DOTFILES/scripts/"$1" && chmod +x $DOTFILES/scripts/"$1" - } - - # config edit - ce() { - local files - IFS=$'\n' files=($(command find ~/.dotfiles -type f -not -ipath "*/.git/*" | fzf -m --inline-info --prompt="edit> " --height=40 --reverse)) - [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" - } - # vim setting edit - ve() { - local files - IFS=$'\n' files=($(command find ~/.dotfiles/vim -type f -not -ipath "*/.git/*" | fzf -m --inline-info --prompt="edit> " --height=40 --reverse)) - [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" - } - # run python - rp() { - fzf --print-query --preview-window=right:50% --preview 'python -c {q}' <<<'' - } - # Run ruby - rr() { - fzf --print-query --preview-window=right:50% --preview 'ruby -e {q}' <<<'' - } - # run bash - rb() { - fzf --print-query --preview-window=right:50% --preview 'bash -c {q}' <<<'' - } - # run json - rj() { - fzf --preview "cat $1 | jq {q}" - } -fi -# }}} - -command -v wal &>/dev/null && (cat ~/.cache/wal/sequences &) diff --git a/shell-old/zshrc b/shell-old/zshrc @@ -1,96 +0,0 @@ -#!/usr/bin/env zsh -# oh-my-zsh {{{ -# Path to your oh-my-zsh installation. -export ZSH="$HOME"/.oh-my-zsh - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-zsh is loaded. -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -ZSH_THEME="powerlevel10k/powerlevel10k" - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git - sudo - zsh-syntax-highlighting - gitignore -) - -#POWERLEVEL9K -POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user dir virtualenv vcs) -POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history ram time battery) - -source $ZSH/oh-my-zsh.sh -# }}} -# ZSH config {{{ -export LANG=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 - -# Keybinds -insert-arg-of-prev-cmd() { -: ${NUMERIC:-1} -(( NUMERIC++ )) -words=($(fc -ln -1)) -RBUFFER+="$words[$NUMERIC] " -zle end-of-line -} - -zle -N insert-arg-of-prev-cmd -bindkey "\e^y" insert-arg-of-prev-cmd - -# readline-style line commenting -bindkey '\e#' pound-insert - -# readline-style searching -bindkey '^]' vi-find-next-char -bindkey '^\e]' vi-find-prev-char - -# Use lf to switch directories and bind it to ctrl-o -lfcd () { - if ! command -v lf &>/dev/null; then echo "lf not installed." && return; fi - tmp="$(mktemp)" - lf -last-dir-path="$tmp" "$@" - if [ -f "$tmp" ]; then - dir="$(cat "$tmp")" - rm -f "$tmp" - [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" - fi -} -bindkey -s '^o' 'lfcd\n' - -fpath=($HOME/.dotfiles/shell/zsh-completions $fpath) -autoload -U compinit -compinit -# }}} -# Other scripts {{{ -# FZF -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - -# Aliases -source $HOME/.commonprofile - -# Z initialization -if ! command -v z &> /dev/null; then - . $DOTFILES/shell/z/z.sh -fi - -# rbenv init -if [[ $PATH != *"$HOME/.rbenv/shims"* ]] && command -v rbenv &> /dev/null; then - eval "$(rbenv init -)" -fi - -# jenv -if command -v jenv &> /dev/null; then - if [[ $PATH != *"$HOME/.jenv/bin"* ]]; then - export PATH="$HOME/.jenv/bin:$PATH" - fi - eval "$(jenv init -)" - export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home" -fi - -test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" -# }}} -# vim: foldmethod=marker foldlevel=0