commit 1034976152d51d399a9e39e9edc8d9212bf0f8f3
parent debf7d63b74268f611da7f4e931c9266124374c3
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Mon, 6 Apr 2020 20:18:05 +0200
shell: organisational stuff
Former-commit-id: b703fb5f3277cf94908b304c677f60e339120806
Diffstat:
5 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/shell/aliases b/shell/aliases
@@ -1,3 +1,4 @@
+#!/bin/sh
alias fucking="sudo" # Because sometimes I'm frustrated
alias cp='cp -iv' # Prompt if overwrite, verbose
alias mv='mv -iv' # Prompt if overwrite, verbose
@@ -18,4 +19,3 @@ alias j='joplin'
alias tree="tree -CAFa -I 'CVS|*.*.package|.svn|.git|node_modules' --dirsfirst" # Colorize, ANSI graphics hack, indicate ft with appendices, print all files, ignore certain patterns, list dirs first
alias lsblk="lsblk -o NAME,LABEL,PARTLABEL,TYPE,FSTYPE,SIZE,MOUNTPOINT,STATE" # The columns I want to see in lsblk
alias confucius="curl confucius-quote.herokuapp.com" # A joke curl service I made
-alias be="bundle exec"
diff --git a/shell/bashrc b/shell/bashrc
@@ -5,14 +5,15 @@
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
-HISTCONTROL=ignoreboth
+export HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
-HISTSIZE=1000
-HISTFILESIZE=2000
+export HISTSIZE=1000
+export HISTFILESIZE=2000
+export HISTFILE="$HOME/.cache/bash/bash_history"
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
diff --git a/shell/functions b/shell/functions
@@ -1,8 +1,8 @@
-#!/usr/bin/env bash
+#!/bin/sh bash
# vim:foldmethod=indent:foldlevel=0
cd() { builtin cd -P "$@" || return; } # 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)
+mkcd() { mkdir -p -- "$1" && cd -P -- "$1" || return; } # make dir and cd at the same time
+procinfo() { pgrep -f "$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
@@ -114,7 +114,7 @@ if [ -f ~/.fzf.zsh ] || [ -f ~/.fzf.bash ]; then
# config edit
ce() {
local files
- IFS=$'\n' files=($(command find ~/.dotfiles -type f ! -ipath "*/.git/*" ! -ipath "*/bin/*" ! -ipath "*/oh-my-zsh/*" | fzf -m --inline-info --prompt="edit> " --height=40 --reverse))
+ IFS=$'\n' files=($(command find ~/.dotfiles -type f ! -ipath "*/.git/*" ! -ipath "*/bin/*" ! -ipath "*/oh-my-zsh/*" ! -name ".DS_Store" | fzf -m --inline-info --prompt="edit> " --height=40 --reverse))
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
}
# vim setting edit
diff --git a/shell/profile b/shell/profile
@@ -1,3 +1,4 @@
+#!/bin/sh
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
@@ -6,7 +7,7 @@
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
- eval `/usr/libexec/path_helper -s`
+ eval "$(/usr/libexec/path_helper -s)"
fi
if [ "${BASH-no}" != "no" ]; then
@@ -48,7 +49,7 @@ fi
if [ -d "/usr/local/sbin" ]; then
PATH="/usr/local/sbin:$PATH"
fi
-if command -v rbenv &>/dev/null; then
+if command -v rbenv 1>/dev/null 2>&1; then
eval "$(rbenv init -)"
fi
if [ -d "/usr/local/opt/gnu-sed/libexec/gnubin" ]; then
@@ -59,9 +60,9 @@ if [ -d "$HOME/.local/gnat/bin" ]; then
fi
export DOTFILES="$HOME/.dotfiles"
-export EDITOR="`which vim`"
+EDITOR="$(command -v vim)"; export EDITOR
export MUSIC_DIR="/Volumes/HDD/Music/iTunes/iTunes Media/Music"
-if command -v bat &> /dev/null; then
+if command -v bat 1>/dev/null 2>&1; then
export PAGER="bat"
else
export PAGER="less -R"
@@ -71,3 +72,5 @@ export LC_TIME=en_US.UTF-8
export LC_COLLATE=en_US.UTF-8
export LC_MONETARY=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
+
+source "$DOTFILES/shell/use-config-dir"
diff --git a/shell/use-config-dir b/shell/use-config-dir
@@ -0,0 +1,6 @@
+# Make programs use the ~/.config directory
+alias irssi="irssi --home=$HOME/.config/irssi"
+
+export JUPYTER_CONFIG_DIR="$HOME/.config/jupyter"
+export BUNDLE_USER_HOME="$HOME/.config/bundle"
+export BUNDLE_USER_CACHE="$HOME/.cache/bundle"